private async void RefreshData() { Info = true; await Task.Run(() => { lock (SqlDataBase) { TransactionData = null; TransactionData = SqlDataBase.GetTable(CurrentPurchase); EmployeeData = SqlDataBase.GetTable("Employee"); SaleData = SqlDataBase.GetTable("ClientSale"); SeekerData = SqlDataBase.GetTable("ClientSeeker"); OfficeData = SqlDataBase.GetTable("Office"); OfficeEmployeeData = SqlDataBase.GetTable("OfficeEmployee"); TransactionData.RowChanged += TransactionData_RowChanged; EmployeeData.RowChanged += EmployeeData_RowChanged; SaleData.RowChanged += SaleData_RowChanged; SeekerData.RowChanged += SeekerData_RowChanged; OfficeData.RowChanged += OfficeData_RowChanged; OfficeEmployeeData.RowChanged += OfficeEmployee_RowChanged; } }); Info = false; }
/// <summary> /// 得到所有提案信息 /// </summary> /// <param name="term"></param> /// <returns></returns> public JsonResult GetTextSelectUrlProposalInfo(string term) { string SystemID = Request["SystemID"] == null ?"-1": Request["SystemID"].ToString(); System.Data.DataTable dtContent = new System.Data.DataTable(); // DataTable dtUser = GPMS.Interface.DataLibrary.GetUserDataByFuzzy(term.Trim(), 10); SqlDataBase dd = new SqlDataBase(); string str = "select top(10) a.ProposalID,a.ProposalName from[IPP].[dbo].[ipp_Proposal] a where a.BillType <> 10 and a.SystemInfo =" + SystemID + " and ( a.ProposalName like '%" + term + "%' or a.ProposalID like '%" + term + "%') "; DataTable dtUser = dd.GetTable(str); dtContent.Columns.Add("value"); //这几个就是传到视图的值 dtContent.Columns.Add("label"); //这里估计就是得到输入值后控件下方显示的文本格式,也是点击后显示在控件的值 dtContent.Columns.Add("desc"); //排序 dtContent.Columns.Add("icon"); foreach (DataRow drUser in dtUser.Rows) { //if (i.ToString().IndexOf(term) == -1) //{//模拟查询 // continue; //} DataRow dr = dtContent.NewRow(); dr[0] = drUser["ProposalID"].ToString(); dr[1] = drUser["ProposalName"].ToString(); dr[2] = drUser["ProposalID"].ToString(); dr[3] = drUser["ProposalID"].ToString(); dtContent.Rows.Add(dr); } //select a as value,b as label,c as desc ,d as icon from table where title='term' Donlim.Library.Entitys.EntityBase entityBase = new Donlim.Library.Entitys.EntityBase();//向上转型以使用父类的方法 entityBase.Dt = dtContent; JsonResult jsonResult = entityBase.ToJsonOnlyData(); return(jsonResult); }
/// <summary> /// 查询开发工程师 /// </summary> /// <param name="term"></param> /// <returns></returns> public JsonResult GetTextSelectUrlDevUser(string term) { System.Data.DataTable dtContent = new System.Data.DataTable(); // DataTable dtUser = GPMS.Interface.DataLibrary.GetUserDataByFuzzy(term.Trim(), 10); SqlDataBase dd = new SqlDataBase(); string str = "select top(10) a.UserCode,a.UserName from [IPP].[dbo].[V_Developer] a where (a.UserCode like '%" + term + "%' or a.UserName like '%" + term + "%')"; DataTable dtUser = dd.GetTable(str); dtContent.Columns.Add("value"); //这几个就是传到视图的值 dtContent.Columns.Add("label"); //这里估计就是得到输入值后控件下方显示的文本格式,也是点击后显示在控件的值 dtContent.Columns.Add("desc"); //排序 dtContent.Columns.Add("icon"); foreach (DataRow drUser in dtUser.Rows) { //if (i.ToString().IndexOf(term) == -1) //{//模拟查询 // continue; //} DataRow dr = dtContent.NewRow(); dr[0] = drUser["UserCode"].ToString(); dr[1] = drUser["UserName"].ToString(); dr[2] = drUser["UserCode"].ToString(); dr[3] = drUser["UserCode"].ToString(); dtContent.Rows.Add(dr); } //select a as value,b as label,c as desc ,d as icon from table where title='term' Donlim.Library.Entitys.EntityBase entityBase = new Donlim.Library.Entitys.EntityBase();//向上转型以使用父类的方法 entityBase.Dt = dtContent; JsonResult jsonResult = entityBase.ToJsonOnlyData(); return(jsonResult); }
private async void TRefreshData() { Info = true; await Task.Run(() => { lock (SqlDataBase) { TransactionData = null; TransactionData = SqlDataBase.GetTable(CurrentPurchase); TransactionData.RowChanged += TransactionData_RowChanged; } }); if (TransactionData != null) { Info = false; } }
public JsonResult BackTo(string txtIppNo, string txtIppName) { SqlDataBase db = new SqlDataBase(); DataTable dt = db.GetTable(string.Format(@"SELECT B.WorkflowID FROM dbo.ipp_Proposal A INNER JOIN wf_WorkflowBill B ON A.ProposalID=B.ModelBillID WHERE A.ProposalID='{0}' AND A.ProposalName='{1}'", txtIppNo, txtIppName)); if (dt.Rows.Count == 0) { return(base.GetJsonResult("没有找到该提案单据", false, null)); } else { SqlParameter[] parms = new SqlParameter[2]; parms[0] = new SqlParameter("@ProposalID", SqlDbType.VarChar, 20); parms[1] = new SqlParameter("@ProposalName", SqlDbType.NVarChar, 100); parms[0].Value = txtIppNo; parms[1].Value = txtIppName; db.RunProc("P_BackToOneKey", parms); return(base.GetJsonResult("退回成功!", true, null)); } }
public TechnicalReviewBLL(string TechnicalReviewID, string Reviewer) { if (string.IsNullOrEmpty(TechnicalReviewID)) { TechnicalReviewID = "-1";//这样取出的就是一个空的视图 } this.Reviewer = Reviewer; this.Isexist = 0; string flagReviewer = Reviewer; //技术评审主表实体 TechnicalReviewPrimaryEntity = new V_TechnicalReviewPrimaryEntity(); TechnicalReviewPrimaryEntity.ResetForSearch(); TechnicalReviewPrimaryEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewPrimaryEntity.GetTable(true); //月度计划表实体实体 TechnicalReviewProgressEntity = new TechnicalReviewProgressEntity(); TechnicalReviewProgressEntity.PageSize = 0; TechnicalReviewProgressEntity.ResetForSearch(); TechnicalReviewProgressEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewProgressEntity.OrderFields = "ID"; TechnicalReviewProgressEntityList = TechnicalReviewProgressEntity.ToList <TechnicalReviewProgressEntity>(); //评分明细实体 TechnicalReviewScoreDetailsEntity = new V_TechnicalReviewScoreDetailsEntity(); TechnicalReviewScoreDetailsEntity.PageSize = 0;//设置返回数据,即集合变量的大小,为0则放回全部数据 TechnicalReviewScoreDetailsEntity.ResetForSearch(); TechnicalReviewScoreDetailsEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewScoreDetailsEntity.OrderFields = "StandardType,SequenceID"; TechnicalReviewScoreDetailsList = TechnicalReviewScoreDetailsEntity.ToList <V_TechnicalReviewScoreDetailsEntity>(); TechnicalReviewerScoreEntity = new V_TechnicalReviewerScoreEntity(); TechnicalReviewerScoreEntity.ResetForSearch(); TechnicalReviewerScoreEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewerScoreEntity.Reviewer = Reviewer; TechnicalReviewerScoreEntity.GetTable(true); TReviewProposalSingle = new TReviewProposalEntity(); TReviewProposalSingle.PageSize = 0; TReviewProposalSingle.ResetForSearch(); TReviewProposalSingle.TechnicalReviewID = TechnicalReviewID; TReviewProposalSingleList = TReviewProposalSingle.ToList <TReviewProposalEntity>(); foreach (var s in TechnicalReviewScoreDetailsList) { if (string.IsNullOrEmpty(s.ReviewerCode)) { Isexist = 0;//插入 break; } else if (s.ReviewerCode == flagReviewer) { Reviewer = flagReviewer; Isexist = 1;//更新 break; } else { Reviewer = s.ReviewerCode; Isexist = 2;//插入。评委第一次评分,旁观者啥也不做 //更新时根据标识判断更新还是插入 } } if (Isexist == 0) { } else { TechnicalReviewScoreDetailsEntity = new V_TechnicalReviewScoreDetailsEntity(); try { TechnicalReviewScoreDetailsEntity.PageSize = 0;//设置返回数据,即集合变量的大小,为0则放回全部数据 TechnicalReviewScoreDetailsEntity.ResetForSearch(); } catch { } TechnicalReviewScoreDetailsEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewScoreDetailsEntity.ReviewerCode = Reviewer; TechnicalReviewScoreDetailsEntity.OrderFields = "StandardType,SequenceID"; TechnicalReviewScoreDetailsList = TechnicalReviewScoreDetailsEntity.ToList <V_TechnicalReviewScoreDetailsEntity>(); if (Isexist == 2 && Reviewer != flagReviewer) { if (TechnicalReviewPrimaryEntity.ReviewerList.Contains(flagReviewer)) { foreach (var i in TechnicalReviewScoreDetailsList) {//第一次评分时消除历史数据 i.CheckQuantity = null; i.QualifiedQuantity = null; i.ReviewerScore = null; } } else { //其他人员查看 int flag = 0; SqlDataBase db = new SqlDataBase(); DataTable dt = db.GetTable("SELECT * FROM (SELECT SequenceID,ISNULL(SUM(CheckQuantity),-1) CheckQuantity " + ",ISNULL(SUM(QualifiedQuantity),-1) QualifiedQuantity,ISNULL(CAST(CONVERT(DECIMAL,SUM(QualifiedQuantity))*100/SUM(CheckQuantity)AS numeric(5,2)),100) ReviewerScore" + " FROM dbo.V_TechnicalReviewScoreDetails WHERE TechnicalReviewID = '" + TechnicalReviewID + "' GROUP BY SequenceID) A ORDER BY A.SequenceID"); int?checkQuantity = null; int?qualifiedQuantity = null; foreach (var i in TechnicalReviewScoreDetailsList) { checkQuantity = (int)dt.Rows[flag]["CheckQuantity"]; qualifiedQuantity = (int)dt.Rows[flag]["QualifiedQuantity"]; if (checkQuantity == -1) { i.CheckQuantity = null; } else { i.CheckQuantity = checkQuantity; } if (qualifiedQuantity == -1) { i.QualifiedQuantity = null; } else { i.QualifiedQuantity = qualifiedQuantity; } i.ReviewerScore = (decimal)dt.Rows[flag]["ReviewerScore"]; flag++; } } } else if (Isexist == 2 && Reviewer == flagReviewer)//废弃 { } } }
/// <summary> /// 用于获取评审人评分数据 /// </summary> /// <param name="FrameReviewID">框架评审单号</param> /// <param name="Reviewer">评审人工号</param> public FrameReviewBLL(string FrameReviewID, string Reviewer) { string flagReviewer = null; flagReviewer = Reviewer; FrameReviewEntity1 = new V_FrameReviewEntity(); FrameReviewEntity1.ResetForSearch(); FrameReviewEntity1.FrameReviewID = FrameReviewID; FrameReviewEntity1.GetTable(true); FrameReviewerShowEntity = new FrameReviewerEntity(); FrameReviewerShowEntity.ResetForSearch(); FrameReviewerShowEntity.FrameReviewID = FrameReviewID; FrameReviewerShowEntity.Reviewer = Reviewer; FrameReviewerShowEntity.GetTable(true); FrameReviewScoreEntity = new V_FrameReviewScoreShowEntity(); FrameReviewScoreEntity.PageSize = 0;//设置返回数据,即集合变量的大小,为0则放回全部数据 FrameReviewScoreEntity.ResetForSearch(); FrameReviewScoreEntity.FrameReviewID = FrameReviewID; FrameReviewScoreEntity.OrderFields = "StandardType,SequenceID"; FrameReviewScoreList = FrameReviewScoreEntity.ToList <V_FrameReviewScoreShowEntity>(); foreach (var s in FrameReviewScoreList) { if (string.IsNullOrEmpty(s.Reviewer)) { Isexist = 0;//插入 break; } else if (s.Reviewer == flagReviewer) { Reviewer = flagReviewer; Isexist = 1;//更新 break; } else { Reviewer = s.Reviewer; Isexist = 2;//插入,评委第一次评分 } } //其实这里可以用一个foreach来遍历标准表,依次插数据到实体类中然后插入 if (Isexist != 0) { FrameReviewScoreEntity = new V_FrameReviewScoreShowEntity(); FrameReviewScoreEntity.PageSize = 0; FrameReviewScoreEntity.ResetForSearch(); if (string.IsNullOrEmpty(FrameReviewID) || string.IsNullOrEmpty(Reviewer)) { FrameReviewID = "-1"; Reviewer = "-1"; } FrameReviewScoreEntity.FrameReviewID = FrameReviewID; FrameReviewScoreEntity.Reviewer = Reviewer; FrameReviewScoreList = FrameReviewScoreEntity.ToList <V_FrameReviewScoreShowEntity>(); if (Isexist == 2 && Reviewer != flagReviewer) { if (FrameReviewEntity1.FrameReviewers.Contains(flagReviewer)) { foreach (var i in FrameReviewScoreList)//第一次评分时消除历史数据 { i.reviewerReview = null; } } else { //其他人员查看 V_FrameReviewEntity FrameReviewEntity = new V_FrameReviewEntity(); FrameReviewEntity.ResetForSearch(); FrameReviewEntity.FrameReviewID = FrameReviewID; FrameReviewEntity.GetTable(true); decimal?devDay = FrameReviewEntity.DevelopDays; decimal?passRate = FrameReviewEntity.PassingRate; SqlDataBase db = new SqlDataBase(); //妙,这里取最小值作为分数,避免了相加的麻烦,good for you DataTable dt = db.GetTable(" SELECT A.Reviewerreview FROM(SELECT StandardType,SequenceID,MIN(reviewerReview) reviewerReview FROM dbo.V_FrameReviewScore " + " WHERE ISNULL(Reviewer, '') <> '' AND FrameReviewID = '" + FrameReviewID + "' GROUP BY StandardType, SequenceID) A ORDER BY A.StandardType,A.SequenceID"); int flag = 0; foreach (var i in FrameReviewScoreList)//替换数据为综合数据 { i.reviewerReview = (int)dt.Rows[flag]["reviewerReview"]; flag++; } } } } }
/// <summary> /// 作废单据 /// </summary> /// <param name="url"></param> /// <returns></returns> public JsonResult RunFail(string TableName, string KeyField, string KeyValue) { SqlDataBase sql = new SqlDataBase(); DataTable TM = null; string BillState = null; bool Faill = false; string Account = ""; string instanceId = ""; string ErrMsg = "作废失败"; string Where = KeyField + "= '" + KeyValue + "'"; string Where_wf = ""; TM = sql.GetTable("select BillState,CreateMan,WorkflowID from " + TableName + " where " + Where + ""); if (TM.Rows.Count > 0) { BillState = TM.Rows[0]["BillState"].ToString(); Account = TM.Rows[0]["CreateMan"].ToString(); instanceId = TM.Rows[0]["WorkflowID"].ToString(); Where_wf = "InstanceID= '" + instanceId + "'"; } bool flag = false; //检查审批,是否是退审的 SqlDataBase sql_developmentform = new SqlDataBase(); sql_developmentform.SqlConnectionString = ConfigurationManager.ConnectionStrings["DevelopPlatForm"].ToString(); DataTable dtFlow = sql_developmentform.GetTable(string.Format(@"SELECT C.StepSN FROM [wf_Instance] A INNER JOIN wf_InstanceStep B ON A.InstanceID=B.InstanceID INNER JOIN wf_ProjectStep C ON B.StepID=C.StepID where B.IsActive='true' and A.BillID='{0}' AND A.BillIDTableName='{1}'", KeyValue, TableName)); if (dtFlow.Rows.Count > 0) { if (dtFlow.Rows[0]["StepSN"].ToString() == "0") { flag = true; } } if (BillState == "0" || flag == true) { if (UserEntity.Account == Account)//制单人才可以作废 { sql.RunSql("update " + TableName + " set BillState=3 where " + Where + ""); sql_developmentform.RunSql("update wf_InstanceStep set IsActive=0 where " + Where_wf + ""); sql_developmentform.RunSql("update wf_InstanceStepPersonLiable set IsActive=0 where " + Where_wf + ""); sql_developmentform.RunSql("update wf_Instance set IsActive=0 where " + Where_wf + ""); ErrMsg = "作废成功"; Faill = true; } } else if (BillState == "3") { ErrMsg = "单据已作废\r\n不能进行重复操作"; Faill = false; } else { ErrMsg = "单据已提交\r\n不能进行作废操作"; Faill = false; } return(GetJsonResult(ErrMsg, Faill, null)); }