private void AddProject() { string strSQL = ""; clsGeneral General = new clsGeneral(); clsSchedule Schedule = new clsSchedule(); Project Project = new Project(); System.Globalization.CultureInfo dateFormat = new System.Globalization.CultureInfo("en-US", true); DateTime estStartDate = new DateTime(); DateTime estCompletionDate = new DateTime(); decimal feeAmount = default(decimal); int pic = 0; string picCode = string.Empty; int pm = 0; string pmCode = string.Empty; if (!string.IsNullOrEmpty(txtEstStartOfConstruction.Text)) { estStartDate = DateTime.Parse(txtEstStartOfConstruction.Text); } if (!string.IsNullOrEmpty(txtEstCompletionOfConstruction.Text)) { estCompletionDate = DateTime.Parse(txtEstCompletionOfConstruction.Text); } if (!string.IsNullOrEmpty(txtFeeAmount.Text)) { decimal.TryParse(txtFeeAmount.Text.Replace("$", "").Replace(",", ""), out feeAmount); } pic = Convert.ToInt32(cboPIC.SelectedValue); if (!(pic == 0)) { picCode = Schedule.GetEmployeeCode(Convert.ToInt32(cboPIC.SelectedValue)); } pm = Convert.ToInt32(cboPM.SelectedValue); if (!(pm == 0)) { pmCode = Schedule.GetEmployeeCode(Convert.ToInt32(cboPM.SelectedValue)); //strSQL += Zz(cboPM.SelectedValue, 0) & ", " //strSQL += "'" & Schedule.GetEmployeeCode(Zz(cboPM.SelectedValue, 0)) & "')" //Else //strSQL += "NULL, NULL)" } Project.CreateNewProject(Convert.ToDecimal(txtProjectNo.Text), txtProjectName.Text, Convert.ToInt32(cboClientName.SelectedValue), txtProjectLocation.Text, txtConstructionType.Text, txtProjectType.Text, Convert.ToInt32(cboPhase.SelectedValue), estStartDate, estCompletionDate, feeAmount, cboFeeStructure.SelectedValue, txtRemarks.Text, pic, picCode, pm, pmCode, EmployeeID); //General.FillDataset(strSQL) }
private void UpdateProject(int intProjectID) { string strSQL = ""; clsGeneral General = new clsGeneral(); clsSchedule Schedule = new clsSchedule(); if (intProjectID == 0) return; Project Project = new Project(); System.Globalization.CultureInfo dateFormat = new System.Globalization.CultureInfo("en-US", true); DateTime estStartDate = new DateTime(); DateTime estCompletionDate = new DateTime(); decimal feeAmount = default(decimal); int pic = 0; string picCode = string.Empty; int pm = 0; string pmCode = string.Empty; if (!string.IsNullOrEmpty(txtEstStartOfConstruction.Text)) { estStartDate = DateTime.Parse(txtEstStartOfConstruction.Text); } if (!string.IsNullOrEmpty(txtEstCompletionOfConstruction.Text)) { estCompletionDate = DateTime.Parse(txtEstCompletionOfConstruction.Text); } if (!string.IsNullOrEmpty(txtFeeAmount.Text)) { decimal.TryParse(txtFeeAmount.Text.Replace("$", "").Replace(",", ""), out feeAmount); } int.TryParse(cboPIC.SelectedValue, out pic); if (pic != 0) { picCode = Schedule.GetEmployeeCode(pic); } int.TryParse(cboPM.SelectedValue, out pm); if (pm != 0) { pmCode = Schedule.GetEmployeeCode(pm); } Project.UpdateProject(intProjectID, Convert.ToDecimal(txtProjectNo.Text), txtProjectName.Text, Convert.ToInt32(cboClientName.SelectedValue), txtProjectLocation.Text, txtConstructionType.Text, txtProjectType.Text, Convert.ToInt32(cboPhase.SelectedValue), estStartDate, estCompletionDate, feeAmount, cboFeeStructure.SelectedValue, txtRemarks.Text, pic, picCode, pm, pmCode, EmployeeID); }
private void UpdateProject(int intProjectID) { string strSQL = ""; clsGeneral General = new clsGeneral(); clsSchedule Schedule = new clsSchedule(); if (intProjectID == 0) return; strSQL = "UPDATE tblProjects "; strSQL += "SET ProjectName = '" + txtProjectName.Text + "', "; strSQL += "ProjectNo = '" + txtProjectNo.Text + "', "; strSQL += "ClientID = " + Convert.ToInt32(cboClientName.SelectedValue) + ", "; strSQL += "ProjectLocation = '" + txtProjectLocation.Text + "', "; strSQL += "ConstructionType = '" + txtConstructionType.Text + "', "; strSQL += "ProjectType = '" + txtProjectType.Text + "', "; strSQL += "PhaseID = " + Convert.ToInt32(cboPhase.SelectedValue) + ", "; if (!string.IsNullOrEmpty(txtEstStartOfConstruction.Text)) { strSQL += "EstimatedStartDate = '" + txtEstStartOfConstruction.Text + "', "; } else { strSQL += "EstimatedStartDate = NULL, "; } if (!string.IsNullOrEmpty(txtEstCompletionOfConstruction.Text)) { strSQL += "EstimatedCompletionDate = '" + txtEstCompletionOfConstruction.Text + "', "; } else { strSQL += "EstimatedCompletionDate = NULL, "; } if (!string.IsNullOrEmpty(txtFeeAmount.Text)) { decimal feeAmount = 0; decimal.TryParse(txtFeeAmount.Text.Replace("$", "").Replace(",", ""), out feeAmount); strSQL += "FeeAmount = " + feeAmount.ToString() + ", "; } else { strSQL += "FeeAmount = NULL, "; } strSQL += "FeeStructure = '" + cboFeeStructure.SelectedValue + "', "; if (Convert.ToInt32(cboPIC.SelectedValue) != 0) { strSQL += "PIC = " + cboPIC.SelectedValue + ", "; strSQL += "PICCode = '" + Schedule.GetEmployeeCode(Convert.ToInt32(cboPIC.SelectedValue)) + "', "; } else { strSQL += "PIC = NULL, "; strSQL += "PICCode = NULL, "; } if (Convert.ToInt32(cboPM.SelectedValue) != 0) { strSQL += "PM1 = " + cboPM.SelectedValue + ", "; strSQL += "PM1Code = '" + Schedule.GetEmployeeCode(Convert.ToInt32(cboPM.SelectedValue)) + "', "; } else { strSQL += "PM1 = NULL, "; strSQL += "PM1Code = NULL, "; } strSQL += "Comments = '" + txtRemarks.Text + "' "; strSQL += "WHERE ID = " + intProjectID; General.FillDataset(strSQL); }