public JObject Edit(JObject pagerParas) { ProjectBLL ProjectBLL = new ProjectBLL(); ProjectBLL.Add(pagerParas); return(new JObject()); }
public BaseResultEntity Post(ProjectEntity Project) { Logger.LogDebug("AddProject Request:" + JsonHelper.SerializeObject(Project), "AddProjectController", "Post"); BaseResultEntity ret = new BaseResultEntity(); try { var _existProject = _projectBLL.GetModels(x => x.Number == Project.Number || x.Name == Project.Name).ToList(); if (_existProject == null || _existProject.Count() == 0) { var _area = _areaBLL.GetModels(x => x.Name == Project.ProjectArea).FirstOrDefault(); if (_area != null && _area.ID != 0) { if (!string.IsNullOrWhiteSpace(Project.Number) && !string.IsNullOrWhiteSpace(Project.Name)) { var _newProject = new Project() { Number = Project.Number, Name = Project.Name, //Address = Project.Address, Address = "", AreaID = _area.ID, DevelopCompany = Project.DevelopCompany, IdentityNumber = Project.IdentityNumber, CreateTime = DateTime.Now, LastUpdate = DateTime.Now, IsEnd = false, EndReason = null }; _projectBLL.Add(_newProject); ret.Code = 0; ret.ErrMsg = ""; } else { ret.Code = 102; ret.ErrMsg = "创建项目的编号/名称不允许为空!"; } } else { ret.Code = 103; ret.ErrMsg = "项目所属区域不存在!"; } } else { ret.Code = 101; ret.ErrMsg = "创建项目的编号/名称已经存在!"; } } catch (Exception ex) { Logger.LogException("创建项目发生异常!", "AddProjectController", "Post", ex); ret.Code = 999; ret.ErrMsg = ex.Message; } return ret; }
public string Add(JObject pagerParas) { var id = HttpContext.Current.Request.QueryString["id"]; //var form = HttpContext.Current.Request.Form; ProjectBLL ProjectBLL = new ProjectBLL(); if (id != null && Int32.Parse(id) > 0) { ProjectBLL.Updata(pagerParas, Int32.Parse(id)); } else { try { pagerParas.Remove("ID"); } catch (Exception ex) { } ProjectBLL.Add(pagerParas); } return("1"); }
private void btnProjectCreate_Click(object sender, EventArgs e) { if (_updateProject == null) { if (lViewAddEmployeeList.Items.Count == 5) { project.ProjectName = txtProjectName.Text; project.ProjectDetail = txtProjectDetail.Text; project.ManagerID = MainForm._employee.ID; project.CustomerID = (int)cmbCompanyName.SelectedValue; project.PlannedStartDate = dtpPlannedStart.Value; project.PlannedEndDate = dtpPlannedFinish.Value; int projectID; if (_projectBLL.Add(project, out projectID)) { MessageBox.Show("Proje Başarıyla Eklendi."); if (projectID > 0) { foreach (ListViewItem item in lViewAddEmployeeList.Items) { ProjectEmployee pe = new ProjectEmployee(); pe.EmployeeID = ((Employee)item.Tag).ID; pe.ProjectID = projectID; _peBLL.Add(pe); } } } else { MessageBox.Show("Proje Ekleme Başarısız."); } } else { MessageBox.Show("Proje için 5 çalışan seçmeniz gerekiyor"); } } else { _updateProject.ProjectName = txtProjectName.Text; _updateProject.ProjectDetail = txtProjectDetail.Text; _updateProject.ManagerID = MainForm._employee.ID; _updateProject.CustomerID = (int)cmbCompanyName.SelectedValue; _updateProject.PlannedStartDate = dtpPlannedStart.Value; _updateProject.PlannedEndDate = dtpPlannedFinish.Value; if (_projectBLL.Update(_updateProject)) { MessageBox.Show("Güncelleme Başarılı"); } else { MessageBox.Show("Güncelleme Başarısız"); } } bool control = true; foreach (var item in MdiParent.MdiChildren) { if (item is ProjectListForm) { ((ProjectListForm)item).ProjectList(); item.BringToFront(); control = false; } } if (control) { ProjectListForm projectList = new ProjectListForm(); projectList.MdiParent = MdiParent; projectList.Show(); } }
private void btnProjectCreate_Click(object sender, EventArgs e) { int Type1 = 0, Type2 = 0, Type3 = 0, Type4 = 0, Type5 = 0; try { Project project = new Project(); if (string.IsNullOrWhiteSpace(txtProjectName.Text)) { errorProvider.SetError(txtProjectName, "Proje İsmi Boş Geçilemez"); return; } else { project.Name = txtProjectName.Text; errorProvider.SetError(txtProjectName, ""); } if (string.IsNullOrWhiteSpace(txtDescription.Text)) { errorProvider.SetError(txtDescription, "Proje Açıklaması Boş Geçilemez"); return; } else { project.Description = txtDescription.Text; errorProvider.SetError(txtDescription, ""); } project.EmployeeID = employee.EmployeeID; project.CustomerID = (int)cmbCustomer.SelectedValue; project.RequiredStartDate = dateRequedStart.Value; project.RequiredEndDate = dateRequedEnd.Value; project.isActive = true; project.isDelected = false; foreach (Employee item in employeList) { if (item.EmployeeType.EmployeeTypeID == 1) { Type1++; } else if (item.EmployeeType.EmployeeTypeID == 2) { Type2++; } else if (item.EmployeeType.EmployeeTypeID == 3) { Type3++; } else if (item.EmployeeType.EmployeeTypeID == 4) { Type4++; } else if (item.EmployeeType.EmployeeTypeID == 5) { Type5++; } } if (Type1 == 0) { MessageBox.Show("Proje Yöneticisi Eklenmemiştir, Lütfen Ekleyiniz!", "Çalışan Ekleme Uyarısı", MessageBoxButtons.OK); return; } if (Type2 == 0) { MessageBox.Show("Takım Lideri Eklenmemiştir, Lütfen Ekleyiniz!", "Çalışan Ekleme Uyarısı", MessageBoxButtons.OK); return; } if (Type3 == 0) { MessageBox.Show("İş Analisti Eklenmemiştir, Lütfen Ekleyiniz!", "Çalışan Ekleme Uyarısı", MessageBoxButtons.OK); return; } if (Type4 == 0) { MessageBox.Show("Test Uzmanı Eklenmemiştir, Lütfen Ekleyiniz!", "Çalışan Ekleme Uyarısı", MessageBoxButtons.OK); return; } if (Type5 == 0) { MessageBox.Show("Yazılım Geliştirici Eklenmemiştir, Lütfen Ekleyiniz!", "Çalışan Ekleme Uyarısı", MessageBoxButtons.OK); return; } _projectBLL.Add(project); foreach (Employee item in employeList) { ProjectEmployees proEmp = new ProjectEmployees(); proEmp.EmployeeID = item.EmployeeID; proEmp.ProjectID = project.ProjectID; proEmp.isEmployeeActive = true; _projectEmployeesBLL.Add(proEmp); } MessageBox.Show("Proje Oluşturuldu", "Proje Oluşturma", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception) { MessageBox.Show("Proje Oluşturulamadı", "Proje Oluşturma", MessageBoxButtons.OK, MessageBoxIcon.Error); } }