using System; using System.Linq; using System.Web.Mvc; using DSWeb.Areas.Account.DAL.Chfee_Payapplication; using DSWeb.Areas.Account.Models.Chfee_Payapplication; using DSWeb.Areas.Account.DAL.Chfee_Invoicehexiao; using DSWeb.Areas.Account.Models.Chfee_Invoicehexiao; using DSWeb.MvcShipping.Helper; using DSWeb.Areas.CommMng.DAL; using System.Collections.Generic; using HcUtility.Comm; using System.IO; using System.Text; using DSWeb.Areas.CommMng.Models; using System.Data; using DSWeb.Common.DB; using System.Web.UI.WebControls; namespace DSWeb.Areas.CommMng.Controllers { [JsonRequestBehavior] public class DSWEBAPPInterfaceController : Controller { /// /// 用于提供给app的查询入口 /// 需传入userid /// /// /// /// /// public class AppParam { public string userid { get; set; } public string formname { get; set; } public string isaudit { get; set; } public string condition { get; set; } } /// /// 付费申请审批 /// /// public ContentResult PayApplicationInterface() { StreamReader sr = new StreamReader(Request.InputStream, Encoding.UTF8); var strJson = new StringBuilder(); string line = null; while (((line = sr.ReadLine())) != null) { strJson.Append(line); } var appparam = JsonConvert.Deserialize(strJson.ToString()); var cdc = new CommonDataContext(); string userid = appparam.userid; string formname = appparam.formname; string isaudit = appparam.isaudit; string condition = appparam.condition; var userlist = cdc.VW_user.Where(x => x.USERID == userid).ToList(); if (userlist == null || userlist.Count == 0) { var json0 = JsonConvert.Serialize(new { Success = false, Message = "没有找到用户" }); return new ContentResult() { Content = json0 }; } var json = JsonConvert.Serialize(new { Success = true, Message = "未找到查询方法" }); var user = userlist[0]; if (formname == "查询列表") { var dataList = ChpayapplicationDAL.GetAuditDataList(condition, user.USERID, isaudit, user.SHOWNAME, user.COMPANYID, null); var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() }); return new ContentResult() { Content = json1 }; } if (formname == "查询明细") { var dataList = ChpayapplicationDAL.GetBodyAuditList(0, 9999, condition, ""); var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() }); return new ContentResult() { Content = json1 }; } if (formname == "审批通过") { var audithead = ChpayapplicationDAL.GetData(condition, user.USERID, user.SHOWNAME, user.COMPANYID); var bodyList = new List() { audithead }; DBResult result = ChpayapplicationDAL.AuditList(bodyList, user.USERID); return BasicDataRefDAL.GetContentResult(result); } if (formname == "驳回") { var audithead = ChpayapplicationDAL.GetData(condition, user.USERID, user.SHOWNAME, user.COMPANYID); var bodyList = new List() { audithead }; DBResult result = ChpayapplicationDAL.AuditBackList(bodyList, user.USERID, isaudit); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } return new ContentResult() { Content = json }; } /// /// 付费发票审核 /// /// public ContentResult PayInvInterface() { StreamReader sr = new StreamReader(Request.InputStream, Encoding.UTF8); var strJson = new StringBuilder(); string line = null; while (((line = sr.ReadLine())) != null) { strJson.Append(line); } var appparam = JsonConvert.Deserialize(strJson.ToString()); var cdc = new CommonDataContext(); string userid = appparam.userid; string formname = appparam.formname; string isaudit = appparam.isaudit; string condition = appparam.condition; var userlist = cdc.VW_user.Where(x => x.USERID == userid).ToList(); if (userlist == null || userlist.Count == 0) { var json0 = JsonConvert.Serialize(new { Success = false, Message = "没有找到用户" }); return new ContentResult() { Content = json0 }; } var json = JsonConvert.Serialize(new { Success = true, Message = "未找到查询方法" }); var user = userlist[0]; if (formname == "查询列表") { var dataList = ChinvoicehexiaoDAL.GetAuditDataList(condition, user.USERID, isaudit, user.SHOWNAME, user.COMPANYID, null); var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() }); return new ContentResult() { Content = json1 }; } if (formname == "查询明细") { var dataList = ChinvoicehexiaoDAL.GetBodyList( condition, ""); var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() }); return new ContentResult() { Content = json1 }; } if (formname == "审批通过") { var audithead = ChinvoicehexiaoDAL.GetData(condition); var bodyList = new List() { audithead }; DBResult result = ChinvoicehexiaoDAL.AuditList(bodyList, user.USERID); return BasicDataRefDAL.GetContentResult(result); } if (formname == "驳回") { var audithead = ChinvoicehexiaoDAL.GetData(condition); var bodyList = new List() { audithead }; DBResult result = ChinvoicehexiaoDAL.AuditBackList(bodyList, user.USERID); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } return new ContentResult() { Content = json }; } /// /// 往来单位审批 /// /// public ContentResult InfoClientAuditInterface() { StreamReader sr = new StreamReader(Request.InputStream, Encoding.UTF8); var strJson = new StringBuilder(); string line = null; while (((line = sr.ReadLine())) != null) { strJson.Append(line); } var appparam = JsonConvert.Deserialize(strJson.ToString()); var cdc = new CommonDataContext(); string userid = appparam.userid; string formname = appparam.formname; string isaudit = appparam.isaudit; string condition = appparam.condition; var userlist = cdc.VW_user.Where(x => x.USERID == userid).ToList(); if (userlist == null || userlist.Count == 0) { var json0 = JsonConvert.Serialize(new { Success = false, Message = "没有找到用户" }); return new ContentResult() { Content = json0 }; } var json = JsonConvert.Serialize(new { Success = true, Message = "未找到查询方法" }); var user = userlist[0]; if (formname == "查询列表") { var dataList = ChinvoicehexiaoDAL.GetAuditDataList(condition, user.USERID, isaudit, user.SHOWNAME, user.COMPANYID, null); var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() }); return new ContentResult() { Content = json1 }; } if (formname == "查询明细") { var dataList = ChinvoicehexiaoDAL.GetBodyList(condition, ""); var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() }); return new ContentResult() { Content = json1 }; } if (formname == "审批通过") { var audithead = ChinvoicehexiaoDAL.GetData(condition); var bodyList = new List() { audithead }; DBResult result = ChinvoicehexiaoDAL.AuditList(bodyList, user.USERID); return BasicDataRefDAL.GetContentResult(result); } if (formname == "驳回") { var audithead = ChinvoicehexiaoDAL.GetData(condition); var bodyList = new List() { audithead }; DBResult result = ChinvoicehexiaoDAL.AuditBackList(bodyList, user.USERID); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } return new ContentResult() { Content = json }; } /// /// 发票申请审批 /// /// public ContentResult InvApplicationAuditInterface() { StreamReader sr = new StreamReader(Request.InputStream, Encoding.UTF8); var strJson = new StringBuilder(); string line = null; while (((line = sr.ReadLine())) != null) { strJson.Append(line); } var appparam = JsonConvert.Deserialize(strJson.ToString()); var cdc = new CommonDataContext(); string userid = appparam.userid; string formname = appparam.formname; string isaudit = appparam.isaudit; string condition = appparam.condition; var userlist = cdc.VW_user.Where(x => x.USERID == userid).ToList(); if (userlist == null || userlist.Count == 0) { var json0 = JsonConvert.Serialize(new { Success = false, Message = "没有找到用户" }); return new ContentResult() { Content = json0 }; } var json = JsonConvert.Serialize(new { Success = true, Message = "未找到查询方法" }); var user = userlist[0]; if (formname == "查询列表") { var dataList = ChpayapplicationDAL.GetAuditDataList(condition, user.USERID, isaudit, user.SHOWNAME, user.COMPANYID, null); var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() }); return new ContentResult() { Content = json1 }; } if (formname == "查询明细") { var dataList = ChpayapplicationDAL.GetBodyAuditList(0, 9999, condition, ""); var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() }); return new ContentResult() { Content = json1 }; } if (formname == "审批通过") { var audithead = ChpayapplicationDAL.GetData(condition, user.USERID, user.SHOWNAME, user.COMPANYID); var bodyList = new List() { audithead }; DBResult result = ChpayapplicationDAL.AuditList(bodyList, user.USERID); return BasicDataRefDAL.GetContentResult(result); } if (formname == "驳回") { var audithead = ChpayapplicationDAL.GetData(condition, user.USERID, user.SHOWNAME, user.COMPANYID); var bodyList = new List() { audithead }; DBResult result = ChpayapplicationDAL.AuditBackList(bodyList, user.USERID, isaudit); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } return new ContentResult() { Content = json }; } } }