private void dglist_UpdateCommand(object source, DataGridCommandEventArgs e) { ProgressEvaluateInfo progressEvaluateInfo = new ProgressEvaluateInfo(); progressEvaluateInfo.Appraise = ((TextBox)e.Item.Cells[2].FindControl("Appraise")).Text.Trim(); progressEvaluateInfo.AppraisePeople = e.Item.Cells[0].Text.Trim(); progressEvaluateInfo.AppraiseTime = DateTime.Parse(((TextBox)e.Item.Cells[1].FindControl("AppriaseTime")).Text.Trim()); progressEvaluateInfo.MainID = this.dglist.DataKeys[e.Item.ItemIndex].ToString(); UserInfo currentUserInfo = userManageDb.GetCurrentUserInfo(); if (currentUserInfo == null) { this.js.Text = "alert('用户身份过期,请重新登录!');window.close();"; return; } if (e.Item.Cells[0].Text.Trim() != currentUserInfo.UserName) { this.js.Text = "alert(\"没有操作权限!\");"; return; } if (ProgressImplementAction.EditEvaluation(progressEvaluateInfo)) { this.js.Text = "alert(\"操作成功!\");"; this.dglist.EditItemIndex = -1; this.BindData(); return; } this.js.Text = "alert(\"操作失败!\");"; }
public ProgressEvaluateInfo GetEvaluateInfo(string MainId) { string sqlString = string.Format("select * from Prj_ProgressPlan_Appraise where MainID='{0}'", MainId); ProgressEvaluateInfo info = new ProgressEvaluateInfo(); DataTable table = publicDbOpClass.DataTableQuary(sqlString); if (table.Rows.Count > 0) { info = this.FormatToEvaModel(table.Rows[0]); } table.Dispose(); return(info); }
private void BindData() { UserInfo currentUserInfo = userManageDb.GetCurrentUserInfo(); ProgressImplementAction progressImplementAction = new ProgressImplementAction(); ProgressEvaluateInfo evaluateInfo = progressImplementAction.GetEvaluateInfo(this.AppraiseId); this.txtAppraise.Text = evaluateInfo.Appraise; this.txtAppraiseTime.Text = evaluateInfo.AppraiseTime.ToShortDateString(); this.txtAppraiseTime.ReadOnly = true; if (currentUserInfo != null) { this.txtAppraisePeople.Text = currentUserInfo.UserName; return; } this.js.Text = "alert(\"登录时间过期,请重新登陆!\");window.close();"; }
protected void btnSave_Click(object sender, EventArgs e) { ProgressEvaluateInfo progressEvaluateInfo = new ProgressEvaluateInfo(); bool isEdit = this.ViewState["ISNEW"] != null && !Convert.ToBoolean(this.ViewState["ISNEW"].ToString().ToLower()); progressEvaluateInfo.AppraisePeople = this.txtAppraisePeople.Text; progressEvaluateInfo.AppraiseTime = DateTime.Parse(this.txtAppraiseTime.Text); progressEvaluateInfo.ParentMainID = this.mainId; progressEvaluateInfo.MainID = this.AppraiseId; progressEvaluateInfo.Appraise = this.txtAppraise.Text; if (ProgressImplementAction.AddEvaluate(progressEvaluateInfo, isEdit)) { base.RegisterScript("top.ui.tabSuccess({ parentName: '_progressimplementitem' });"); } else { base.RegisterScript("top.ui.alert('保存失败');"); } this.BindData(); }
public static bool AddEvaluate(ProgressEvaluateInfo objInfo, bool isEdit) { string sqlString = "select * from Prj_ProgressPlan_Appraise where MainId='" + objInfo.MainID + "'"; if (publicDbOpClass.DataTableQuary(sqlString).Rows.Count > 0) { if (!isEdit) { objInfo.MainID = GetNewAppraiseId(); AddEvaluate(objInfo, isEdit); } else { sqlString = string.Format("update Prj_ProgressPlan_Appraise set AppraisePeople='{0}',AppraiseTime='{1}',Appraise='{2}' where MainID='{3}'", new object[] { objInfo.AppraisePeople, objInfo.AppraiseTime, objInfo.Appraise, objInfo.MainID }); } } else { string str2 = "insert into Prj_ProgressPlan_Appraise values('" + objInfo.MainID + "','"; sqlString = (str2 + objInfo.ParentMainID + "','" + objInfo.AppraisePeople + "','" + objInfo.AppraiseTime.ToString()) + "','" + objInfo.Appraise + "')"; } return(publicDbOpClass.NonQuerySqlString(sqlString)); }
public static bool EditEvaluation(ProgressEvaluateInfo objInfo) { return(publicDbOpClass.NonQuerySqlString("update Prj_ProgressPlan_Appraise set Appraise='" + objInfo.Appraise + "',AppraisePeople='" + objInfo.AppraisePeople + "',AppraiseTime='" + objInfo.AppraiseTime.ToString() + "' where MainId='" + objInfo.MainID + "'")); }