public int ModifyAlreadyAuditing(int Code, SqlTransaction Transaction) { TY_OA_MgrTaskModel objModel = this.GetModel(Code, Transaction); objModel.State = "2"; return(this.Update(objModel, Transaction)); }
public int Update(TY_OA_MgrTaskModel ObjModel) { int num = 0; using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString())) { connection.Open(); SqlTransaction transaction = connection.BeginTransaction(); try { try { num = new TY_OA_MgrTaskBLL().Update(ObjModel, transaction); transaction.Commit(); } catch (Exception exception) { transaction.Rollback(); connection.Close(); throw exception; } return(num); } finally { connection.Close(); } } return(num); }
private int _Insert(TY_OA_MgrTaskModel mObj) { StringBuilder builder = new StringBuilder(); builder.Append("insert into TY_OA_MgrTask("); builder.Append("MgrTaskID,State,TaskName,TaskDetail,IsFinish,TaskTail,CreateDate,CreateMan,ReferLink,DeadLine)"); builder.Append(" values ("); builder.Append("@MgrTaskID,@State,@TaskName,@TaskDetail,@IsFinish,@TaskTail,@CreateDate,@CreateMan,@ReferLink,@DeadLine) "); builder.Append("SELECT @Code = SCOPE_IDENTITY()"); this._DataProcess.CommandText = builder.ToString(); this._DataProcess.ProcessParametersAdd("@MgrTaskID", SqlDbType.VarChar, 50, mObj.MgrTaskID); this._DataProcess.ProcessParametersAdd("@State", SqlDbType.VarChar, 50, mObj.State); this._DataProcess.ProcessParametersAdd("@TaskName", SqlDbType.VarChar, 500, mObj.TaskName); this._DataProcess.ProcessParametersAdd("@TaskDetail", SqlDbType.VarChar, 500, mObj.TaskDetail); this._DataProcess.ProcessParametersAdd("@IsFinish", SqlDbType.VarChar, 50, mObj.IsFinish); this._DataProcess.ProcessParametersAdd("@TaskTail", SqlDbType.VarChar, 0x3e8, mObj.TaskTail); this._DataProcess.ProcessParametersAdd("@CreateDate", SqlDbType.DateTime, 8, mObj.CreateDate); this._DataProcess.ProcessParametersAdd("@CreateMan", SqlDbType.VarChar, 50, mObj.CreateMan); this._DataProcess.ProcessParametersAdd("@ReferLink", SqlDbType.VarChar, 500, (mObj.ReferLink == null) ? "" : mObj.ReferLink); DateTime deadLine = mObj.DeadLine; this._DataProcess.ProcessParametersAdd("@DeadLine", SqlDbType.DateTime, 8, mObj.DeadLine); SqlParameter parameter = this._DataProcess.ProcessParametersAdd("@Code", SqlDbType.Int, 4, null); parameter.Direction = ParameterDirection.Output; this._DataProcess.RunSql(); mObj.Code = (int)parameter.Value; return(mObj.Code); }
private TY_OA_MgrTaskModel _DataBind(int Code) { TY_OA_MgrTaskModel model = new TY_OA_MgrTaskModel(); StringBuilder builder = new StringBuilder(); builder.Append("select * from TY_OA_MgrTask "); builder.Append(" where Code=@Code"); this._DataProcess.CommandText = builder.ToString(); this._DataProcess.ProcessParametersAdd("@Code", SqlDbType.Int, 4, Code); SqlDataReader sqlDataReader = null; try { try { sqlDataReader = this._DataProcess.GetSqlDataReader(); while (sqlDataReader.Read()) { this.Initialize(sqlDataReader, model); } } catch (SqlException exception) { throw exception; } } finally { if (sqlDataReader != null) { sqlDataReader.Close(); } } return(model); }
private void UpdateMgrTaskDeadLine(DateTime dt) { TY_OA_MgrTaskBFL TaskBFL = new TY_OA_MgrTaskBFL(); TY_OA_MgrTaskDtlBFL TaskDtlBFL = new TY_OA_MgrTaskDtlBFL(); TY_OA_MgrTaskDtlModel TaskDtlMdl = TaskDtlBFL.GetTY_OA_MgrTaskDtl(RmsPM.BLL.ConvertRule.ToInt(Request.QueryString["MgrDtlCode"])); TY_OA_MgrTaskModel TaskMdl = TaskBFL.GetTY_OA_MgrTask(TaskDtlMdl.MgrCodeID); TaskMdl.DeadLine = dt; TaskBFL.Update(TaskMdl); }
private List <TY_OA_MgrTaskModel> _Select(TY_OA_MgrTaskQueryModel qmObj) { List <TY_OA_MgrTaskModel> list = new List <TY_OA_MgrTaskModel>(); StringBuilder builder = new StringBuilder(); builder.Append("select * from TY_OA_MgrTask "); builder.Append(qmObj.QueryConditionStr); if (qmObj.SortColumns.Length == 0) { builder.Append(" ORDER BY Code desc"); } else { builder.Append(" ORDER BY " + qmObj.SortColumns); } this._DataProcess.CommandText = builder.ToString(); this._DataProcess.SqlParameters = qmObj.Parameters; SqlDataReader sqlDataReader = null; int num = 0; try { try { sqlDataReader = this._DataProcess.GetSqlDataReader(); while (sqlDataReader.Read()) { if ((num >= qmObj.StartRecord) && ((list.Count < qmObj.MaxRecords) || (qmObj.MaxRecords == -1))) { TY_OA_MgrTaskModel model = new TY_OA_MgrTaskModel(); this.Initialize(sqlDataReader, model); list.Add(model); } num++; } } catch (SqlException exception) { throw exception; } } finally { if (sqlDataReader != null) { sqlDataReader.Close(); } } return(list); }
private void Initialize(SqlDataReader reader, TY_OA_MgrTaskModel obj) { if (reader.GetValue(0) != DBNull.Value) { obj.Code = reader.GetInt32(0); } if (reader.GetValue(1) != DBNull.Value) { obj.MgrTaskID = reader.GetString(1); } if (reader.GetValue(2) != DBNull.Value) { obj.State = reader.GetString(2); } if (reader.GetValue(3) != DBNull.Value) { obj.TaskName = reader.GetString(3); } if (reader.GetValue(4) != DBNull.Value) { obj.TaskDetail = reader.GetString(4); } if (reader.GetValue(5) != DBNull.Value) { obj.IsFinish = reader.GetString(5); } if (reader.GetValue(6) != DBNull.Value) { obj.TaskTail = reader.GetString(6); } if (reader.GetValue(7) != DBNull.Value) { obj.CreateDate = reader.GetDateTime(7); } if (reader.GetValue(8) != DBNull.Value) { obj.CreateMan = reader.GetString(8); } if (reader.GetValue(9) != DBNull.Value) { obj.ReferLink = reader.GetString(9); } if (reader.GetValue(10) != DBNull.Value) { obj.DeadLine = reader.GetDateTime(10); } }
public TY_OA_MgrTaskModel GetTY_OA_MgrTask(int Code) { TY_OA_MgrTaskModel model = new TY_OA_MgrTaskModel(); using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString())) { try { connection.Open(); model = new TY_OA_MgrTaskBLL().GetModel(Code, connection); connection.Close(); } catch (Exception exception) { throw exception; } } return(model); }
private DateTime GetTaskDeadLine() { //主表要求完成时间为明细中最晚的那个 DateTime LastDate = new DateTime(); TY_OA_MgrTaskBFL TaskBFL = new TY_OA_MgrTaskBFL(); TY_OA_MgrTaskDtlBFL TaskDtlBFL = new TY_OA_MgrTaskDtlBFL(); TY_OA_MgrTaskDtlModel TaskDtlMdl = TaskDtlBFL.GetTY_OA_MgrTaskDtl(RmsPM.BLL.ConvertRule.ToInt(Request.QueryString["MgrDtlCode"])); List <TY_OA_MgrTaskDtlModel> TaskDtlMdls = TaskDtlBFL.GetTY_OA_MgrTaskDtlList(TaskDtlMdl.MgrCodeID); TY_OA_MgrTaskModel TaskMdl = TaskBFL.GetTY_OA_MgrTask(TaskDtlMdl.MgrCodeID); int i = 0; foreach (TY_OA_MgrTaskDtlModel SingleTaskMdl in TaskDtlMdls) { if (0 == i) { LastDate = SingleTaskMdl.DeadLine; } else { System.TimeSpan ts = LastDate.Subtract(SingleTaskMdl.DeadLine); if (ts.Days < 0) { LastDate = SingleTaskMdl.DeadLine; } } i++; } if (TaskMdl.DeadLine == LastDate) { LastDate = DateTime.MinValue; } return(LastDate); }
public int Insert(TY_OA_MgrTaskModel ObjModel, SqlTransaction Transaction) { TY_OA_MgrTaskDAL kdal = new TY_OA_MgrTaskDAL(Transaction); return(kdal.Insert(ObjModel)); }
public int Update(TY_OA_MgrTaskModel ObjModel, SqlTransaction Transaction) { TY_OA_MgrTaskDAL kdal = new TY_OA_MgrTaskDAL(Transaction); return(kdal.Update(ObjModel)); }
protected void FormView1_DataBound(object sender, EventArgs e) { if (FormView1.CurrentMode == FormViewMode.ReadOnly) { Button btnDelete = ((Button)this.FormView1.Row.FindControl("btnDelete")); if (btnDelete != null) { btnDelete.Attributes["OnClick"] = "javascript:return confirm('确实要删除当前事宜吗?')"; } TY_OA_MgrTaskBFL Taskbfl = new TY_OA_MgrTaskBFL(); TY_OA_MgrTaskDtlBFL Taskdtlbfl = new TY_OA_MgrTaskDtlBFL(); TY_OA_MgrTaskModel TaskMl = Taskbfl.GetTY_OA_MgrTask(RmsPM.BLL.ConvertRule.ToInt(this.MgrCode.Text)); List <TY_OA_MgrTaskDtlModel> TaskDtlMl = Taskdtlbfl.GetTY_OA_MgrTaskDtlList(RmsPM.BLL.ConvertRule.ToInt(this.MgrCode.Text)); foreach (TY_OA_MgrTaskDtlModel DtlMl in TaskDtlMl) { //有审核中或审核完的明细的任务不能删除 if (DtlMl.State == "2" || DtlMl.State == "3") { btnDelete.Visible = false; break; } } string[] Links = TaskMl.ReferLink.Split(';'); int i = -1; foreach (string EachLink in Links) { i++; if (!string.IsNullOrEmpty(EachLink)) { string[] ForLink = EachLink.Split(','); //lblWorkFlowTitle.Text = ShowApplicationHyperLink(entity.GetString("WorkFlowTitle"), string.Format(ud_sHyperLinkFormat, this.OperationCode, this.ProjectCode)); ((System.Web.UI.HtmlControls.HtmlTableCell) this.FormView1.Row.FindControl("ReferLinkID")).InnerHtml += "<a href='##' onclick='MonitorgotoDirect(\"" + ForLink[0] + "\",\"" + ForLink[1] + "\",\"" + ForLink[2] + "\",\"" + ForLink[3] + "\",\"" + ForLink[4] + "\"); return false;'>" + RmsPM.BLL.WorkFlowRule.GetWorkFlowCaseTitle(ForLink[0]) + "</a> "; //((System.Web.UI.HtmlControls.HtmlTableCell)this.FormView1.Row.FindControl("ReferLinkID")).InnerHtml += "<a href='##' onclick='MonitorgotoDirect(" + EachLink + "," + "," + "," + "," + "); return false;'>" + RmsPM.BLL.WorkFlowRule.GetWorkFlowCaseTitle(EachLink) + "</a> "; } } Label status = (Label)this.FormView1.Row.FindControl("StatusID"); bool isend = true; TY_OA_MgrTaskDtlBFL dtbfl = new TY_OA_MgrTaskDtlBFL(); if (this.MgrCode.Text != "") { List <TY_OA_MgrTaskDtlModel> dtlmdLst = dtbfl.GetTY_OA_MgrTaskDtlList(RmsPM.BLL.ConvertRule.ToInt(this.MgrCode.Text)); foreach (TY_OA_MgrTaskDtlModel mdl in dtlmdLst) { //有审核中流程则状态为未完成 if (mdl.State == "2") { isend = false; if (status != null) { status.Text = "流程审评中"; } break; } } } if (isend && status != null) { status.Text = "无审核中流程"; } //RmsOA.BFL.TY_OA_MgrTaskDtlBFL bfl = new RmsOA.BFL.TY_OA_MgrTaskDtlBFL(); //List<TY_OA_MgrTaskDtlModel> Models = bfl.GetTY_OA_MgrTaskDtlList(RmsPM.BLL.ConvertRule.ToInt(this.MgrCode.Text)); //ViewState["Models"] = Models; } else { DataGrid dgDtl = (DataGrid)this.FormView1.Row.FindControl("dgDtl"); if (dgDtl != null) { RmsOA.BFL.TY_OA_MgrTaskDtlBFL bfl = new RmsOA.BFL.TY_OA_MgrTaskDtlBFL(); List <TY_OA_MgrTaskDtlModel> Models = bfl.GetTY_OA_MgrTaskDtlList(RmsPM.BLL.ConvertRule.ToInt(this.MgrCode.Text)); ViewState["Models"] = Models; BindDtl(Models); } } }
public int Update(TY_OA_MgrTaskModel mObj) { return(this._Update(mObj)); }
public int Insert(TY_OA_MgrTaskModel mObj) { return(this._Insert(mObj)); }
public int Delete(TY_OA_MgrTaskModel mObj) { return(this._Delete(mObj.Code)); }
private int _Update(TY_OA_MgrTaskModel mObj) { StringBuilder builder = new StringBuilder(); builder.Append("update TY_OA_MgrTask set "); if (mObj.MgrTaskID != null) { builder.Append("MgrTaskID=@MgrTaskID,"); this._DataProcess.ProcessParametersAdd("@MgrTaskID", SqlDbType.VarChar, 50, mObj.MgrTaskID); } if (mObj.State != null) { builder.Append("State=@State,"); this._DataProcess.ProcessParametersAdd("@State", SqlDbType.VarChar, 50, mObj.State); } if (mObj.TaskName != null) { builder.Append("TaskName=@TaskName,"); this._DataProcess.ProcessParametersAdd("@TaskName", SqlDbType.VarChar, 500, mObj.TaskName); } if (mObj.TaskDetail != null) { builder.Append("TaskDetail=@TaskDetail,"); this._DataProcess.ProcessParametersAdd("@TaskDetail", SqlDbType.VarChar, 500, mObj.TaskDetail); } if (mObj.IsFinish != null) { builder.Append("IsFinish=@IsFinish,"); this._DataProcess.ProcessParametersAdd("@IsFinish", SqlDbType.VarChar, 50, mObj.IsFinish); } if (mObj.TaskTail != null) { builder.Append("TaskTail=@TaskTail,"); this._DataProcess.ProcessParametersAdd("@TaskTail", SqlDbType.VarChar, 0x3e8, mObj.TaskTail); } if (mObj.CreateDate != DateTime.MinValue) { builder.Append("CreateDate=@CreateDate,"); this._DataProcess.ProcessParametersAdd("@CreateDate", SqlDbType.DateTime, 8, mObj.CreateDate); } if (mObj.CreateMan != null) { builder.Append("CreateMan=@CreateMan,"); this._DataProcess.ProcessParametersAdd("@CreateMan", SqlDbType.VarChar, 50, mObj.CreateMan); } if (mObj.ReferLink != null) { builder.Append("ReferLink=@ReferLink,"); this._DataProcess.ProcessParametersAdd("@ReferLink", SqlDbType.VarChar, 500, mObj.ReferLink); } if (mObj.DeadLine != DateTime.MinValue) { builder.Append("DeadLine=@DeadLine,"); this._DataProcess.ProcessParametersAdd("@DeadLine", SqlDbType.DateTime, 8, mObj.DeadLine); } builder.Remove(builder.Length - 1, 1); builder.Append(" where Code=@Code"); this._DataProcess.ProcessParametersAdd("@Code", SqlDbType.Int, 4, mObj.Code); this._DataProcess.CommandText = builder.ToString(); return(this._DataProcess.RunSql()); }