private void btnUpdate_Click(object sender, EventArgs e) { ProjectBll proBll = new ProjectBll(); dataGridView1.DataSource = null; dataGridView1.DataSource = proBll.QueryAll(); }
public void Load() { CfgVersion ver = CfgVersionBll.GetFirstCfg(); if (ver != null) { _verInDb = ver.Version.Value; } lstOrgsByDb = OrgBll.GetAllOrgInfo(); lstGroupsByDb = GroupBll.GetAllGroupInfo(); lstProjectsByDb = ProjectBll.GetAllProject(); lstCardsByDb = CardWithCommDevBll.GetAllDevList(); MakeMemCard(_loadFlag); MakeMemProject(_loadFlag); MakeMemGroup(_loadFlag); MakeMemOrg(_loadFlag); MakeMemCommByClientSn(_loadFlag); MakeCardRef(); MakeProjectRef(); MakeGroupRef(); MakeOrgRef(); lstOrgsByDb.Clear(); lstGroupsByDb.Clear(); lstProjectsByDb.Clear(); lstCardsByDb.Clear(); }
private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex < 2 && e.RowIndex > -1) { ProjectBll proBll = new ProjectBll(); //点击删除 if (e.ColumnIndex == 0) { if (MessageBox.Show(DELETED_AND_NO_RECOVERY, "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { int row = e.RowIndex; string id = dataGridView1.Rows[row].Cells["Id"].Value.ToString(); proBll.DeletePro(id); dataGridView1.DataSource = null; dataGridView1.DataSource = proBll.QueryAll(); } } //点击更新 if (e.ColumnIndex == 1) { Project pro = new Project(); int row = e.RowIndex; pro.Id = (int)dataGridView1.Rows[row].Cells["Id"].Value; pro.PName = dataGridView1.Rows[row].Cells["PName"].Value.ToString(); pro.PLId = dataGridView1.Rows[row].Cells["PLId"].Value.ToString(); pro.PMId = dataGridView1.Rows[row].Cells["PMId"].Value.ToString(); pro.Status = dataGridView1.Rows[row].Cells["Status"].Value.ToString(); FrmProAddOrUpdate frmUpdate = new FrmProAddOrUpdate(pro); frmUpdate.ShowDialog(); dataGridView1.DataSource = null; dataGridView1.DataSource = proBll.QueryAll(); return; } } }
private void InsertProject(DataTable dtProject) { foreach (DataRow row in dtProject.Rows) { string strId = row["Index"].ToString(); string strName = row["Name"].ToString(); string strManager = row["ManagerName"].ToString(); string strManagerTel = row["ManagerTel"].ToString(); string strAddress = row["Address"].ToString(); string strRefGroupName = row["RefGroupName"].ToString(); if (GroupBll.IsNameExist(strName)) { continue; } GlareSysEfDbAndModels.ProjectInfo project = new GlareSysEfDbAndModels.ProjectInfo() { Address = strAddress, CreateDt = DateTime.Now, Id = 0, IsDel = 0, UpdateDt = DateTime.Now, GroupId = DataLoader.GetProjectIDByProjectName(strRefGroupName), ManagerName = strManager, ManagerTel = strManagerTel, OrgId = DataLoader.GetOrgIDByProjectName(strRefGroupName), ProjectName = strName }; string strError; ProjectBll.AddAProject(ref project, out strError); } }
public RemarkController() { rb = new RemarkBll(); pb = new ProjectBll(); sb = new StudentBll(); cb = new ClassBll(); }
private void FrmRelation_Load(object sender, EventArgs e) { ProjectBll proBll = new ProjectBll(); var proData = proBll.QueryAll(); foreach (var item in proData) { listBoxPro.Items.Add(item.PName); } }
public ProjectController(ProjectBll projectBll, FileBll fileBll, IssueBll issueBll, UserBll userBll, LinkBll linkBll, ScheduleBll scheduleBll, UserModule.Bll.UserBll userModuleUserBll, LogBll logBll) { _projectBll = projectBll; _fileBll = fileBll; _issueBll = issueBll; _userBll = userBll; _linkBll = linkBll; _scheduleBll = scheduleBll; _userModuleUserBll = userModuleUserBll; _logBll = logBll; }
private void FrmProject_Load(object sender, EventArgs e) { cmboxIdorName.SelectedIndex = 0; ProjectBll proBll = new ProjectBll(); var all = proBll.QueryAll(); if (all != null) { dataGridView1.DataSource = all; } cmboxIdorName.Visible = false; }
//listboxshow 单击选择 private void listBoxShow_Click(object sender, EventArgs e) { if (listBoxShow.SelectedItem != null) { var item = listBoxShow.SelectedItem.ToString(); myTxtProName.SetText(item); EmployeeBll empBll = new EmployeeBll(); ProjectBll proBll = new ProjectBll(); string choose = myTxtProName.GetText(); //现在textbox中的字符串 string pl = proBll.QueryByName(choose)[0].PLId; //项目PL的id string plName = empBll.QueryById(pl).Name; //项目的PL的名字 myTxtProPLName.Clear(); myTxtProPLName.SetText(plName); //加载项目Pl listBoxShow.Visible = false; //选择后隐藏 } }
private void btnSaveData_Click(object sender, EventArgs e) { if (MessageBox.Show(MyMessage.ConfirmInsertData, MyMessage.TitleMessageQuestion, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes) { return; } if (_copynomreList != null && _copynomreList.Any()) { var recordstudents = new ProjectBll().GetaAllDataTable("Student_Tbl"); _sortcopynomreList = _copynomreList.OrderByDescending(o => o).ToList(); MessageBox.Show(InsertData(_sortcopynomreList, recordstudents) ? MyMessage.OperationSuccessful : MyMessage.ErrorInsertData); } else { MessageBox.Show(MyMessage.ListEmpty); } }
private void txtName_Leave(object sender, EventArgs e) { ProjectBll proBll = new ProjectBll(); if (Tool.isNull(txtName.Text.Trim())) { lblNameShow.Text = LBLSHOW_NAME_IS_NULL; txtName.Text = ""; //txtName.Focus(); return; } bool b = proBll.IsNameExist(txtName.Text.Trim()); if (b) { lblNameShow.Text = LBLSHOW_PRONAME_IS_EXIST; txtName.Text = ""; // txtName.Focus(); return; } lblNameShow.Text = ""; }
private void buttonOk_Click(object sender, EventArgs e) { ProjectInfo mod = new ProjectInfo() { CreateDt = DateTime.Now, Address = "", GroupId = (int)comboBoxGroup.SelectedValue, ManagerName = textBoxManagerName.Text, ManagerTel = textBoxTel.Text, Id = 0, IsDel = 0, OrgId = (int)comboBoxOrg.SelectedValue, UpdateDt = DateTime.Now, ProjectName = textBoxName.Text }; string strMsg; if (!ProjectBll.AddAProject(ref mod, out strMsg)) { DialogResult = DialogResult.None; MessageBox.Show(strMsg); } }
public string AddProject(string strParams) { string strError; RequestModelString reqinfo = ServerHlper.GetRequestModelString(System.Reflection.MethodBase.GetCurrentMethod().Name, strParams, out strError); if (reqinfo == null) { return(strError); } ProjectInfo mod = JsonStrObjConver.JsonStr2Obj(reqinfo.Info, typeof(ProjectInfo)) as ProjectInfo; if (mod == null) { return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.HttpParamError)); } bool bResult = ProjectBll.AddAProject(ref mod, out strError); if (!bResult) { return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.LoginNameOrPassword)); } // 成功返回成功标志及新增加的ID JsonResutlModelString result = new JsonResutlModelString() { ErrorDesc = "success", Info = mod.Id.ToString(), Status = true, StatusInt = 1 }; return(JsonStrObjConver.Obj2JsonStr(result, typeof(JsonResutlModelString))); }
public ClaRevProController() { pb = new ProjectBll(); crpb = new ClaRevProBll(); }
private void FrmOvertimeAddOrUpdate_Load(object sender, EventArgs e) { EmployeeBll empBll = new EmployeeBll(); ProjectBll proBll = new ProjectBll(); myTxtEmpId.SetText(this.Tag.ToString());//加载员工Id string name = empBll.QueryById(this.Tag.ToString()).Name; myTxtEmpName.SetText(name); //加载员工姓名 myTxtReason.SetText("工作需要"); //默认原因 TimePickerFrom.Value = DateTime.Parse("19:00"); //默认开始时间 TimePickerTo.Value = DateTime.Parse("21:00"); //默认结束时间 if (this.Text == "添加信息") { #region 加载该员工项目.显示到listbox中 string empId = myTxtEmpId.GetText().ToUpper().Trim(); if (empId == string.Empty) { return; } listBoxShow.Items.Clear(); ProjectBll pBll = new ProjectBll(); EPRelationBll eBll = new EPRelationBll(); List <string> need = new List <string>(); List <string> have = new List <string>(); need.Clear(); //一个员工id,他可能的项目 包括他负责的项目和他从属的项目 //从项目表中查询.负责的项目.因为关系表中每个项目没有包涵PM pl var pros = pBll.QueryWhenEmpIdLike(empId); if (pros.Count != 0) { foreach (var item in pros) { need.Add(item); } } //从关系表中查询.从属的项目 var epr = eBll.QueryLikeThis(empId); if (epr.Count != 0) { foreach (var item in epr) { have.Add(item); } } need = need.Union(have).ToList(); if (need.Count != 0) { if (need.Count == 1) { myTxtProName.SetText(need[0]); myTxtProName.Enabled = false; EmployeeBll emBll = new EmployeeBll(); ProjectBll prBll = new ProjectBll(); string pl = prBll.QueryByName(myTxtProName.GetText())[0].PLId; string plName = emBll.QueryById(pl).Name; myTxtProPLName.SetText(plName);//加载项目Pl return; } listBoxShow.Visible = true; foreach (var item in need) { listBoxShow.Items.Add(item); } } #endregion } else if (this.Text == "更新信息") { myTxtProName.SetText(thisProName); ProjectBll pb = new ProjectBll(); EmployeeBll eb = new EmployeeBll(); string plid = pb.QueryByName(thisProName)[0].PLId; string plname = eb.QueryById(plid).Name; myTxtProPLName.SetText(plname); dateTime.Value = DateTime.Parse(thisDate); } //使时间选择器值显示时间不显示日期 TimePickerFrom.Format = DateTimePickerFormat.Custom; TimePickerFrom.CustomFormat = "HH':'mm"; TimePickerTo.Format = DateTimePickerFormat.Custom; TimePickerTo.CustomFormat = "HH':'mm"; }
public ProjectController() { pb = new ProjectBll(); }
public ProjectItemController() { pb = new ProjectBll(); pib = new ProjectItemBll(); }
//点击确定按扭 private void btnSure_Click(object sender, EventArgs e) { if (listBoxShow.Items.Count == 0 && myTxtProName.GetText() == string.Empty)//如果员工没有项目 { MessageBox.Show("您没有项目"); return; } if (listBoxShow.Visible == true)//如果可见,表示未点击选择 { MessageBox.Show("请选择项目!"); return; } var timeFrom = TimePickerFrom.Value.ToShortTimeString(); //开始时间 时分表示 var timeTo = TimePickerTo.Value.ToShortTimeString(); //结束时间 时分表示 int hourFrom = Convert.ToInt16(timeFrom.Split(':')[0]); //开始时间:小时 int minteFrom = Convert.ToInt16(timeFrom.Split(':')[1]); //开始时间 : 分钟 int hourTo = Convert.ToInt16(timeTo.Split(':')[0]); //结束时间 小时 int minteTo = Convert.ToInt16(timeTo.Split(':')[1]); //结束时间 分钟 bool b = (hourTo * 60 + minteTo) > (hourFrom * 60 + minteFrom); if (!b && !cBoxNextDay.Checked)//开始时间不能晚于结束时间 { MessageBox.Show("您输入的时间不合法"); return; } if (myTxtReason.GetText() == string.Empty) { MessageBox.Show("请填写原因"); return; } #region 用来计算 时长 float duration; if (cBoxNextDay.Checked)//如果选择了,结束时间要加上24小时 { int to = (hourTo * 60 + minteTo + 1440); int from = (hourFrom * 60 + minteFrom); duration = (float)Math.Round(((to - from) / 60.0), 1); }//没有不用加 else { int to = (hourTo * 60 + minteTo); int from = (hourFrom * 60 + minteFrom); duration = (float)Math.Round(((to - from) / 60.0), 1); } #endregion #region 获取要添加或更新的类的内容 Overtime ot = new Overtime(); var proBll = new ProjectBll(); ot.EmployeeId = myTxtEmpId.GetText(); ot.ProjectId = proBll.QueryByName(myTxtProName.GetText())[0].Id;//虽然项目名不可能相同,但是QueryByName()返回值我还是写成了集合,集合里只有一个元素,取索引0即可 ot.DateTimeStart = DateTime.Parse(string.Format("{0} {1}", dateTime.Value.ToShortDateString(), timeFrom)); if (cBoxNextDay.Checked) { ot.DateTimeEnd = DateTime.Parse(string.Format("{0} {1}", dateTime.Value.AddDays(1).ToShortDateString(), timeTo)); } else { ot.DateTimeEnd = DateTime.Parse(string.Format("{0} {1}", dateTime.Value.ToShortDateString(), timeTo)); } ot.Duration = duration; ot.Reason = myTxtReason.GetText(); ot.Status = "已批"; #endregion bool a = false; if (this.Text == "添加信息")//添加执行的代码 { OvertimeBll oBll = new OvertimeBll(); a = oBll.Add(ot); } else //更新执行的代码 { OvertimeBll ob = new OvertimeBll(); ot.Id = thisId; a = ob.Update(ot); } if (a) { MessageBox.Show("成功"); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { MessageBox.Show("您这段时间已有加班记录"); return; } }
private void txtQueryCondition_TextChanged(object sender, EventArgs e) { var a = new ProjectBll().QueryLikeThis(txtQueryCondition.Text); dataGridView1.DataSource = a; }
//点击确定按钮 private void btnSure_Click(object sender, EventArgs e) { //添加项目 if (this.Text == TITLE_ADD_PRO) { ProjectBll proBll = new ProjectBll(); Project pro = new Project(); if (!Tool.isNull(txtName.Text) && !Tool.isNull(txtPLId.Text) && !Tool.isNull(txtPMId.Text)) { if (txtPLId.Tag == null) //|| txtPMId.Tag == null) { MessageBox.Show(SHOW_INPUT_TIPS_MESSAGE); txtPLId.Focus(); return; } if (txtPMId.Tag == null) { MessageBox.Show(SHOW_INPUT_TIPS_MESSAGE); txtPMId.Focus(); return; } pro.PName = txtName.Text.Trim(); pro.PLId = txtPLId.Tag.ToString().ToUpper(); pro.PMId = txtPMId.Tag.ToString().ToUpper(); pro.Status = cmboxStatus.SelectedIndex == 1 ? "未激活" : "已激活"; bool a = proBll.IsNameExist(pro.PName); if (a) { lblNameShow.Text = LBLSHOW_PRONAME_IS_EXIST; return; } bool b = proBll.ProAdd(pro); if (b) { MessageBox.Show(SHOW_ADD_SUCESS); this.Close(); } } else { MessageBox.Show(SHOW_PLEASE_CHECK); if (txtName.Text == string.Empty) { txtName.Focus(); return; } if (txtPLId.Text == string.Empty) { txtPLId.Focus(); return; } if (txtPMId.Text == string.Empty) { txtPMId.Focus(); return; } } } //更新项目 else { ProjectBll proBll = new ProjectBll(); Project pro = new Project(); if (!Tool.isNull(txtName.Text) && !Tool.isNull(txtPLId.Text) && !Tool.isNull(txtPMId.Text)) { if (txtPLId.Tag == null)//|| txtPMId.Tag == null) { MessageBox.Show(SHOW_INPUT_TIPS_MESSAGE); txtPLId.Focus(); return; } if (txtPMId.Tag == null) { MessageBox.Show(SHOW_INPUT_TIPS_MESSAGE); txtPMId.Focus(); return; } pro.PName = txtName.Text.Trim(); pro.PLId = txtPLId.Tag.ToString().ToUpper(); pro.PMId = txtPMId.Tag.ToString().ToUpper(); pro.Status = cmboxStatus.SelectedIndex == 1 ? "未激活" : "已激活"; bool b = proBll.UpdatePro(pro); if (b) { MessageBox.Show(SHOW_UPDATE_SUCESS); this.Close(); } } else { MessageBox.Show(SHOW_PLEASE_CHECK); if (txtName.Text == string.Empty) { txtName.Focus(); return; } if (txtPLId.Text == string.Empty) { txtPLId.Focus(); return; } if (txtPMId.Text == string.Empty) { txtPMId.Focus(); return; } } } }
public ActionResult Delete(string ProjectIds) { ResultHelper objResult = null; try { using (LedDb db = new LedDb()) { if (ModelState.IsValid) { string[] Id = ProjectIds.Split(','); string strMsg = string.Empty; for (int i = 0; i < Id.Length; i++) { ProjectBll.DeleteAProject(int.Parse(Id[i]), out strMsg); } objResult = new ResultHelper() { Status = true, Ret = 0, Obj = ProjectIds, Msg = strMsg, Desc = strMsg }; //StringBuilder strSql = new StringBuilder(); //strSql.AppendFormat(@"UPDATE ProjectInfo SET IsDel = 1 WHERE Id IN ({0})", ProjectIds); //if (db.Database.ExecuteSqlCommand(strSql.ToString()) > 0) //{ // objResult = new ResultHelper() // { // Status = true, // Ret = 0, // Obj = ProjectIds, // Msg = "Delete Success!", // Desc = "Delete Success!" // }; //} //else //{ // objResult = new ResultHelper() // { // Desc = "Delete Faile,please try again.", // Msg = "Delete Faile,please try again.", // Obj = null, // Ret = -1, // Status = false // }; //} } else { objResult = new ResultHelper() { Desc = " Faile,please try again", Msg = " Faile,please try again", Obj = null, Ret = -1, Status = false }; } } } catch (Exception ex) { objResult = new ResultHelper() { Desc = ex.Message, Msg = ex.Message, Obj = null, Ret = -1, Status = false }; } return(Json(objResult)); }
public ActionResult Modify(GlareSysEfDbAndModels.ProjectInfo subject) { ResultHelper objResult = null; try { using (LedDb db = new LedDb()) { if (ModelState.IsValid) { ProjectInfo aSubject = db.ProjectInfo.Where(p => p.Id == subject.Id).FirstOrDefault(); aSubject.ProjectName = subject.ProjectName; aSubject.ManagerName = subject.ManagerName; aSubject.Address = subject.Address; aSubject.ManagerTel = subject.ManagerTel; aSubject.OrgId = subject.OrgId; aSubject.GroupId = subject.GroupId; aSubject.UpdateDt = DateTime.Now; string strMsg = string.Empty; bool b = ProjectBll.UpdateProejct(ref subject, out strMsg); if (b) { objResult = new ResultHelper() { Status = true, Ret = 0, Obj = subject, Msg = strMsg, Desc = strMsg }; } else { objResult = new ResultHelper() { Desc = strMsg, Msg = strMsg, Obj = null, Ret = -1, Status = false }; } //if (db.SaveChanges() > 0) //{ // objResult = new ResultHelper() // { // Status = true, // Ret = 0, // Obj = subject, // Msg = "Edit Success!", // Desc = "Edit Success!" // }; //} //else //{ // objResult = new ResultHelper() // { // Desc = "Edit Faile,please try again.", // Msg = "Edit Faile,please try again.", // Obj = null, // Ret = -1, // Status = false // }; //} } else { objResult = new ResultHelper() { Desc = " Faile,please try again", Msg = " Faile,please try again", Obj = null, Ret = -1, Status = false }; } } } catch (Exception ex) { objResult = new ResultHelper() { Desc = ex.Message, Msg = ex.Message, Obj = null, Ret = -1, Status = false }; } return(Json(objResult)); }
public ActionResult Add(GlareSysEfDbAndModels.ProjectInfo subject) { ResultHelper objResult = null; try { using (LedDb db = new LedDb()) { if (ModelState.IsValid) { subject.UpdateDt = DateTime.Now; subject.CreateDt = DateTime.Now; subject.IsDel = 0; subject.UpdateDt = DateTime.Now; subject.CreateDt = DateTime.Now; subject.IsDel = 0; string strMsg = string.Empty; bool b = ProjectBll.AddAProject(ref subject, out strMsg); if (b) { objResult = new ResultHelper() { Status = true, Ret = 0, Obj = subject, Msg = strMsg, Desc = strMsg }; } else { objResult = new ResultHelper() { Desc = strMsg, Msg = strMsg, Obj = null, Ret = -1, Status = false }; } //db.ProjectInfo.Add(subject); //if (db.SaveChanges() > 0) //{ // objResult = new ResultHelper() // { // Status = true, // Ret = 0, // Obj = subject, // Msg = "Add Success!", // Desc = "Add Success!" // }; //} //else //{ // objResult = new ResultHelper() // { // Desc = "Add Faile,please try again.", // Msg = "Add Faile,please try again.", // Obj = null, // Ret = -1, // Status = false // }; //} } else { objResult = new ResultHelper() { Desc = " Faile,please try again", Msg = " Faile,please try again", Obj = null, Ret = -1, Status = false }; } } } catch (Exception ex) { objResult = new ResultHelper() { Desc = ex.Message, Msg = ex.Message, Obj = null, Ret = -1, Status = false }; } return(Json(objResult)); }
//点击用户控件文本框时发生,文本框显示项目名 private void myTxtProName_Enter(object sender, EventArgs e) { myTxtProPLName.Clear(); #region 加载该员工项目.显示到listbox中 string empId = myTxtEmpId.GetText().ToUpper().Trim(); if (empId == string.Empty) { return; } listBoxShow.Items.Clear(); ProjectBll pBll = new ProjectBll(); EPRelationBll eBll = new EPRelationBll(); List <string> need = new List <string>(); List <string> have = new List <string>(); need.Clear(); //一个员工id,他可能的项目 包括他负责的项目和他从属的项目 //从项目表中查询.负责的项目.因为关系表中每个项目没有包涵PM pl var pros = pBll.QueryWhenEmpIdLike(empId); if (pros != null) { foreach (var item in pros) { need.Add(item); } } //从关系表中查询.从属的项目 var epr = eBll.QueryLikeThis(empId); if (epr != null) { foreach (var item in epr) { have.Add(item); } } need = need.Union(have).ToList(); if (need != null) { if (need.Count == 1)//如果只有一个项目 { myTxtProName.SetText(need[0]); myTxtProName.Enabled = false; EmployeeBll emBll = new EmployeeBll(); ProjectBll prBll = new ProjectBll(); string pl = prBll.QueryByName(myTxtProName.GetText())[0].PLId; string plName = emBll.QueryById(pl).Name; myTxtProPLName.SetText(plName);//加载项目Pl return; } listBoxShow.Visible = true; foreach (var item in need) { listBoxShow.Items.Add(item); } } else { MessageBox.Show("您未参与任何项目"); return; } #endregion }