public void setStageProject(StageProject stage, AdvanceUtil.paramStagInsert param) { stageProject = stage; paramInsert = param; if (stage != null) { if (param == AdvanceUtil.paramStagInsert.NOSUB) { textBoxNameStage.Text = stage.NameStage; comboBoxUser.SelectedItem = new KeyValuePair(stage.User.Id.ToString(), stage.User.FullName); dateBegin.Value = stage.DateBeginPlan; dateEnd.Value = stage.DateEndPlan; dateBeginUser.Checked = true; dateEndUser.Checked = true; dateBeginUser.Value = stage.DateBeginUser < dateBeginUser.MinDate ? stage.DateBeginPlan : stage.DateBeginUser; dateEndUser.Value = stage.DateEndUser < dateEndUser.MinDate ? stage.DateEndPlan : stage.DateEndUser; dateBeginProg.Value = stage.DateBeginProg< dateBeginProg.MinDate ? stage.DateBeginPlan : stage.DateBeginProg; dateEndProg.Value = stage.DateEndProg < dateEndProg.MinDate ? stage.DateEndPlan : stage.DateEndProg; textBoxAbout.Text = stage.CommentUser; comboBoxStatus.SelectedIndex = stage.StatusStage == 0 ? 0 : 1; } else { } } }
public StageProjectNode(string name, string comment, string dateBegin, string dateEnd, string dateBeginProg, string dateEndProg, string dateBeginUser, string dateEndUser, string user, string status, StageProject stage) : base() { this.stage = stage; NameStage = name; CommentUser = comment; DateBegin = dateBegin; DateEnd = dateEnd; DateBeginProg = dateBeginProg; DateEndProg = dateEndProg; DateBeginUser = (dateBeginUser.Equals("01.01.0001")) ? "" : dateBeginUser; DateEndUser = (dateEndUser.Equals("01.01.0001")) ? "" : dateEndUser; User = user; Status = (status.Equals("1") == true) ? "Факт" : "План" ; }
private void btnSave_Click(object sender, EventArgs e) { if (isValid()) { if (stageProject == null) { stageProject = new StageProject(); } stageProject.NameStage = textBoxNameStage.Text; UserDAO daoUser = new UserDAO(); stageProject.User = daoUser.getById(Convert.ToInt32(((KeyValuePair)comboBoxUser.SelectedItem).Key)); stageProject.DateBeginPlan = dateBegin.Value; stageProject.DateEndPlan = dateEnd.Value; if (dateBeginUser.Checked) { stageProject.DateBeginUser = dateBeginUser.Value; } else { stageProject.DateBeginUser = new DateTime(1,1,1); } if (dateEndUser.Checked) { stageProject.DateEndUser = dateEndUser.Value; } else { stageProject.DateEndUser = new DateTime(1, 1, 1); } stageProject.CommentUser = textBoxAbout.Text; stageProject.IdProject = idProject; stageProject.StatusStage = comboBoxStatus.SelectedIndex; if (paramInsert == AdvanceUtil.paramStagInsert.SUB) { stageProject.IdParentStage = stageProject.IdStage; } StageProjectDAO dao = new StageProjectDAO(); if (stageProject.IdStage != 0 && paramInsert != AdvanceUtil.paramStagInsert.SUB) { dao.update(stageProject); } else { dao.insert(stageProject); } this.Close(); } }
public void setStageProject(StageProject stage) { setStageProject(stage, AdvanceUtil.paramStagInsert.NOSUB); }