using DIXWeb.DAL; using DIXWeb.Entity.GlobalM; using DIXWeb.Entity.Workflow; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DIXWeb.Business.Workflow { public class BillBusiness { public List GetWorkflowBillType() { List list = null; using (DBContext db = new DBContext()) { list = db.BillType.ToList(); } return list; } public ReceiveBill GetBillById(int BillId) { ReceiveBill record = null; using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@BillId", BillId), }; record = db.Database.SqlQuery("EXEC meta.p_getBillById @BillId ", paramList).FirstOrDefault(); } return record; } public Receive SubmitBill(string Code, string Name, int BillTypeId, int UserId) { Receive record = null; using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@Code", Code), new System.Data.SqlClient.SqlParameter("@Name", Name), new System.Data.SqlClient.SqlParameter("@BillTypeId", BillTypeId), new System.Data.SqlClient.SqlParameter("@UserId", UserId), }; record = db.Database.SqlQuery("EXEC meta.p_submitBill @Code,@Name,@BillTypeId,@UserId ", paramList).FirstOrDefault(); } return record; } public Receive SubmitBill(int BookId, int BillTypeId, int UserId) { Receive record = null; using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@BookId", BookId), new System.Data.SqlClient.SqlParameter("@BillTypeId", BillTypeId), new System.Data.SqlClient.SqlParameter("@UserId", UserId), }; record = db.Database.SqlQuery("EXEC biz.p_submitInspectBook @BookId,@BillTypeId,@UserId ", paramList).FirstOrDefault(); } return record; } public Receive ReckDataUpdateHistory(int InspectBookId,string FilterType, int rows, int page) { int Total = 0; Receive record = new Receive(); try { using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@InspectBookId", InspectBookId), new System.Data.SqlClient.SqlParameter("@pageSize", rows), new System.Data.SqlClient.SqlParameter("@pageIndex", page), new System.Data.SqlClient.SqlParameter("@filterType", FilterType), new System.Data.SqlClient.SqlParameter("@Total", Total), }; int index = paramList.Length - 1; paramList[index].Direction = ParameterDirection.Output; record.rows = db.Database.SqlQuery("exec biz.p_getReckDataUpdateHistory @InspectBookId,@pageSize,@pageIndex,@filterType,@Total output ", paramList).ToList(); record.total = int.Parse(paramList[index].Value.ToString()); } record.Code = 200; record.Message = "SUCCESS"; } catch (Exception ex) { record.Code = 500; record.Message = ex.Message; } return record; } public Receive ReckImgUpdateHistory(int InspectBookId,string FilterType, int rows, int page) { int Total = 0; Receive record = new Receive(); try { using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@InspectBookId", InspectBookId), new System.Data.SqlClient.SqlParameter("@pageSize", rows), new System.Data.SqlClient.SqlParameter("@pageIndex", page), new System.Data.SqlClient.SqlParameter("@filterType", FilterType), new System.Data.SqlClient.SqlParameter("@Total", Total), }; int index = paramList.Length - 1; paramList[index].Direction = ParameterDirection.Output; record.rows = db.Database.SqlQuery("exec biz.p_getReckImgUpdateHistory @InspectBookId,@pageSize,@pageIndex,@filterType,@Total output ", paramList).ToList(); record.total = int.Parse(paramList[index].Value.ToString()); } record.Code = 200; record.Message = "SUCCESS"; } catch (Exception ex) { record.Code = 500; record.Message = ex.Message; } return record; } public Receive GetInspectBook(string InspectObjectCode, DateTime TimeBegin, DateTime TimeEnd, int Status, int rows, int page,string filterType,int UserId ) { int Total = 0; Receive record = new Receive(); try { using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@InspectObjectCode", InspectObjectCode), new System.Data.SqlClient.SqlParameter("@TimeBegin", TimeBegin), new System.Data.SqlClient.SqlParameter("@TimeEnd", TimeEnd), new System.Data.SqlClient.SqlParameter("@Status", Status), new System.Data.SqlClient.SqlParameter("@pageSize", rows), new System.Data.SqlClient.SqlParameter("@pageIndex", page), new System.Data.SqlClient.SqlParameter("@FilterType", filterType), new System.Data.SqlClient.SqlParameter("@UserId", UserId), new System.Data.SqlClient.SqlParameter("@Total", Total), }; int index = paramList.Length - 1; paramList[index].Direction = ParameterDirection.Output; record.rows = db.Database.SqlQuery("exec biz.p_getInspectBook @InspectObjectCode,@TimeBegin,@TimeEnd,@Status,@pageSize,@pageIndex,@FilterType,@UserId,@Total output ", paramList).ToList(); record.total = int.Parse(paramList[index].Value.ToString()); } record.Code = 200; record.Message = "SUCCESS"; } catch (Exception ex) { record.Code = 500; record.Message = ex.Message; } return record; } public Receive GetFalseInspectBook(int InspectAreaId, int InspectObjectTypeId, string InspectObjectCode, DateTime TimeBegin, DateTime TimeEnd, int rows, int page) { int Total = 0; Receive record = new Receive(); try { using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@InspectAreaId", InspectAreaId), new System.Data.SqlClient.SqlParameter("@InspectObjectTypeId", InspectObjectTypeId), new System.Data.SqlClient.SqlParameter("@InspectObjectCode", InspectObjectCode), new System.Data.SqlClient.SqlParameter("@TimeBegin", TimeBegin), new System.Data.SqlClient.SqlParameter("@TimeEnd", TimeEnd), new System.Data.SqlClient.SqlParameter("@pageSize", rows), new System.Data.SqlClient.SqlParameter("@pageIndex", page), new System.Data.SqlClient.SqlParameter("@Total", Total), }; int index = paramList.Length - 1; paramList[index].Direction = ParameterDirection.Output; record.rows = db.Database.SqlQuery("exec biz.p_getFalseInspectBook @InspectAreaId,@InspectObjectTypeId,@InspectObjectCode,@TimeBegin,@TimeEnd,@pageSize,@pageIndex,@Total output ", paramList).ToList(); record.total = int.Parse(paramList[index].Value.ToString()); } record.Code = 200; record.Message = "SUCCESS"; } catch (Exception ex) { record.Code = 500; record.Message = ex.Message; } return record; } public Receive GetInspectDetailByBookId(int BookId,string filterType) { int Total = 0; Receive record = new Receive(); try { using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@BookId", BookId), new System.Data.SqlClient.SqlParameter("@filterType", filterType), new System.Data.SqlClient.SqlParameter("@Total", Total), }; int index = paramList.Length - 1; paramList[index].Direction = ParameterDirection.Output; record.rows = db.Database.SqlQuery("exec biz.p_getInspectDetailByBookId @BookId,@filterType,@Total output ", paramList).ToList(); if (string.IsNullOrEmpty(paramList[index].Value.ToString())) { record.total = 0; } else { record.total = int.Parse(paramList[index].Value.ToString()); } } record.Code = 200; record.Message = "SUCCESS"; } catch (Exception ex) { record.Code = 500; record.Message = ex.Message; } return record; } public Receive UpdateInspectReck(int InspectReckId, string InspectLimit, int Judge, string NGReason, int DealInScene, string Answer, string InspectOperator,string FilterType) { Receive receive = new Receive(); try { using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@InspectReckId", InspectReckId), new System.Data.SqlClient.SqlParameter("@InspectLimit", InspectLimit), new System.Data.SqlClient.SqlParameter("@Judge", Judge), new System.Data.SqlClient.SqlParameter("@NGReason", NGReason), new System.Data.SqlClient.SqlParameter("@DealInScene", DealInScene), new System.Data.SqlClient.SqlParameter("@Answer", Answer), new System.Data.SqlClient.SqlParameter("@InspectOperator", InspectOperator), new System.Data.SqlClient.SqlParameter("@filterType", FilterType), }; receive = db.Database.SqlQuery("exec biz.p_updateInspectReck @InspectReckId,@InspectLimit,@Judge,@NGReason,@DealInScene,@Answer,@InspectOperator,@filterType ", paramList).FirstOrDefault(); } } catch (Exception ex) { receive.Code = 500; receive.Message = ex.Message; } return receive; } public Receive UpdateInspectReck(int InspectReckId, string ImgArrStr, string InspectOperator,string FilterType) { Receive receive = new Receive(); try { using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@InspectReckId", InspectReckId), new System.Data.SqlClient.SqlParameter("@ImgArrStr", ImgArrStr), new System.Data.SqlClient.SqlParameter("@InspectOperator", InspectOperator), new System.Data.SqlClient.SqlParameter("@filterType", FilterType), }; receive = db.Database.SqlQuery("exec biz.p_updateInspectReckImg @InspectReckId,@ImgArrStr,@InspectOperator,@filterType ", paramList).FirstOrDefault(); } } catch (Exception ex) { receive.Code = 500; receive.Message = ex.Message; } return receive; } public string GetNeedDealtNumByUserCode(string UserNo) { string result = string.Empty; try { using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@UserCode", UserNo), }; result = db.Database.SqlQuery("exec biz.p_GetNeedDealtNumByUserCode @UserCode ", paramList).FirstOrDefault(); } } catch (Exception ex) { result = ex.Message; result = ""; } return result; } } }