protected void btnUpdate_Click(object sender, EventArgs e) { clsEntPipelineDetails objEnt = new clsEntPipelineDetails(); if (projectMaster_ID == null) { //if (checkDate == true) //{ objEnt = this.readForEdit(0, txtPipeLineNumber.Text, Convert.ToInt32(ddlType.SelectedValue), Convert.ToInt32(ddlStatus.SelectedValue)); string projID = objEnt.iPipelineID.ToString(); this.updateProject(projID); lblMessage.Text = "Information Successfully Updated"; ObjUtility.ResetFormControl(pageDiv); //} } else { this.updateProject(projectMaster_ID); lblMessage.Text = "Information Successfully Updated"; ObjUtility.ResetFormControl(pageDiv); } }
//Fill All infor private void fillAllInfo(string projID, string projNo, int Type, int Status) { clsEntPipelineDetails objEnt = new clsEntPipelineDetails(); //Edit Function if (projID != null) { objEnt = this.readForEdit(Convert.ToInt32(projectMaster_ID), null, Type, Status); if (objEnt.iPipelineID != null) { //lblMessage.Text = "Information Available in Database"; //start Date if (objEnt.dtClosingDate.ToString() == "") { txtClosingDate.Text = ""; } else { DateTime dtStartDate = DateTime.Parse(objEnt.dtClosingDate.ToString()); txtClosingDate.Text = dtStartDate.ToString("dd MMM yyyy"); } //End Date if (objEnt.dtRevisedClosingDate.ToString() == "" || objEnt.dtRevisedClosingDate == null) { txtReviseClosingDate.Text = ""; } else { DateTime dtEndDate = DateTime.Parse(objEnt.dtRevisedClosingDate.ToString()); txtReviseClosingDate.Text = dtEndDate.ToString("dd MMM yyyy"); } txtPipeLineNumber.Text = objEnt.vsPipelineNumber; txtPipeLineName.Text = objEnt.vsPipelineName; int agencyId = objEnt.iFundingAgencyID; if (agencyId == 0) { ddlWBAgency.SelectedIndex = 0; } else { ddlWBAgency.SelectedValue = agencyId.ToString(); } string docId = objEnt.iDocCatFAID; if (docId == "") { ddlWSSector.SelectedIndex = 0; } else { ddlWSSector.SelectedValue = docId; } txtPipeLineAmount.Text = objEnt.cAmount; txtPipeLineFileNo.Text = objEnt.vsDEAFileNo; ddlSector.SelectedValue = objEnt.iDocCatID; ddlStatus.SelectedValue = objEnt.iStatusID; ddlType.SelectedValue = objEnt.iTypeID; if (objEnt.SignindDate.ToString() == "" || objEnt.SignindDate == null) { txtSigningDate.Text = ""; } else { DateTime dtSigningDate = DateTime.Parse(objEnt.SignindDate.ToString()); txtSigningDate.Text = dtSigningDate.ToString("dd MMM yyyy"); } if (objEnt.ApprovalDate.ToString() == "" || objEnt.ApprovalDate == null) { txtApprovalDate.Text = ""; } else { DateTime dtApprovalDate = DateTime.Parse(objEnt.ApprovalDate.ToString()); txtApprovalDate.Text = dtApprovalDate.ToString("dd MMM yyyy"); } if (objEnt.NegotiationDate.ToString() == "" || objEnt.NegotiationDate == null) { txtNegotiationDate.Text = ""; } else { DateTime dtNegotiationDate = DateTime.Parse(objEnt.NegotiationDate.ToString()); txtNegotiationDate.Text = dtNegotiationDate.ToString("dd MMM yyyy"); } int iTeamLeader = objEnt.iTeamLeader; if (iTeamLeader == 0) { ddlTeamMember.SelectedIndex = 0; } else { ddlTeamMember.SelectedValue = iTeamLeader.ToString(); } } else { lblMessage.Text = string.Empty; btnSubmit.Visible = true; btnUpdate.Visible = false; txtPipeLineAmount.Text = string.Empty; txtPipeLineFileNo.Text = string.Empty; txtReviseClosingDate.Text = string.Empty; txtPipeLineName.Text = string.Empty; txtClosingDate.Text = string.Empty; txtSigningDate.Text = string.Empty; txtApprovalDate.Text = string.Empty; txtNegotiationDate.Text = string.Empty; ddlWSSector.ClearSelection(); ddlSector.ClearSelection(); ddlStatus.ClearSelection(); ddlWBAgency.ClearSelection(); ddlTeamMember.ClearSelection(); } } //Update Function //if (projNo != null) //{ // objEnt = this.readForEdit(0, txtPipeLineNumber.Text, Type, Status); // //start Date // if (objEnt.vsPipelineNumber != null) // { // //lblMessage.Text = "Information Available in Database"; // if (objEnt.dtClosingDate.ToString() == "") // { // txtClosingDate.Text = ""; // } // else // { // DateTime dtStartDate = DateTime.Parse(objEnt.dtClosingDate.ToString()); // txtClosingDate.Text = dtStartDate.ToString("dd MMM yyyy"); // } // //End Date // if (objEnt.dtRevisedClosingDate.ToString() == "") // { // txtReviseClosingDate.Text = ""; // } // else // { // DateTime dtEndDate = DateTime.Parse(objEnt.dtRevisedClosingDate.ToString()); // txtReviseClosingDate.Text = dtEndDate.ToString("dd MMM yyyy"); // } // txtPipeLineNumber.Text = objEnt.vsPipelineNumber; // txtPipeLineName.Text = objEnt.vsPipelineName; // //Agency ID // int agencyId = objEnt.iFundingAgencyID; // if (agencyId == 0) // { // ddlWBAgency.SelectedIndex = 0; // } // else // { // ddlWBAgency.SelectedValue = agencyId.ToString(); // } // //Category Details // string docId = objEnt.iDocCatFAID.ToString(); // if (docId == "") // { // ddlWSSector.SelectedIndex = 0; // } // else // { // ddlWSSector.SelectedValue = docId; // } // txtPipeLineAmount.Text = objEnt.cAmount; // txtPipeLineFileNo.Text = objEnt.vsDEAFileNo; // ddlSector.SelectedValue = objEnt.iDocCatID; // ddlStatus.SelectedValue = objEnt.iStatusID; // ddlType.SelectedValue = objEnt.iTypeID; // if (objEnt.SignindDate.ToString() == "" || objEnt.SignindDate == null) // { // txtSigningDate.Text = ""; // } // else // { // DateTime dtSigningDate = DateTime.Parse(objEnt.SignindDate.ToString()); // txtSigningDate.Text = dtSigningDate.ToString("dd MMM yyyy"); // } // if (objEnt.ApprovalDate.ToString() == "" || objEnt.ApprovalDate == null) // { // txtApprovalDate.Text = ""; // } // else // { // DateTime dtApprovalDate = DateTime.Parse(objEnt.ApprovalDate.ToString()); // txtApprovalDate.Text = dtApprovalDate.ToString("dd MMM yyyy"); // } // if (objEnt.NegotiationDate.ToString() == "" || objEnt.NegotiationDate == null) // { // txtNegotiationDate.Text = ""; // } // else // { // DateTime dtNegotiationDate = DateTime.Parse(objEnt.NegotiationDate.ToString()); // txtNegotiationDate.Text = dtNegotiationDate.ToString("dd MMM yyyy"); // } // int iTeamLeader = objEnt.iTeamLeader; // if (iTeamLeader == 0) // { // ddlWBAgency.SelectedIndex = 0; // } // else // { // ddlWBAgency.SelectedValue = iTeamLeader.ToString(); // } // btnSubmit.Visible = false; // btnUpdate.Visible = true; // } // else // { // lblMessage.Text = ""; // btnSubmit.Visible = true; // btnUpdate.Visible = false; // txtPipeLineAmount.Text = string.Empty; // txtPipeLineFileNo.Text = string.Empty; // txtReviseClosingDate.Text = string.Empty; // txtPipeLineName.Text = string.Empty; // txtClosingDate.Text = string.Empty; // txtSigningDate.Text = string.Empty; // txtApprovalDate.Text = string.Empty; // txtNegotiationDate.Text = string.Empty; // ddlWSSector.ClearSelection(); // ddlSector.ClearSelection(); // ddlStatus.ClearSelection(); // ddlWBAgency.ClearSelection(); // ddlTeamMember.ClearSelection(); // } //} }
public clsEntPipelineDetails readInfo(int ID, string PipelineNo, int Type, int Status) { objEnt = new clsEntPipelineDetails(); SqlDataReader objRead; objConnection = new SqlDataAccess(clsConstant.DBCONSTRING); try { if (objConnection.Connection.State == ConnectionState.Closed) { objConnection.Connection.Open(); } if (ID != 0) { SqlParameter[] pram = new SqlParameter[] { new SqlParameter("@PipelineID", ID), new SqlParameter("@iTypeID", Type), new SqlParameter("@iStatusID", Status) }; objRead = objConnection.ExecuteReaderQuery(clsConstant.SP_SELECT_PIPELINE_MASTER_DETAIL, CommandType.StoredProcedure, pram); } else//sp_selectPipelineMasterDetails { SqlParameter[] pram = new SqlParameter[] { new SqlParameter("@PipelineNumber", PipelineNo) }; objRead = objConnection.ExecuteReaderQuery(clsConstant.SP_SELECT_PIPELINE_MASTER_DETAIL, CommandType.StoredProcedure, pram); } while (objRead.Read()) { objEnt.iPipelineID = objRead.GetValue(0).ToString(); objEnt.vsPipelineNumber = objRead.GetValue(1).ToString(); objEnt.vsPipelineName = objRead.GetValue(2).ToString(); object objObj = objRead.GetValue(13); if (DBNull.Value == objObj) { objEnt.iFundingAgencyID = 0; } else { objEnt.iFundingAgencyID = int.Parse(objObj.ToString()); } object objDocCat = objRead.GetValue(14); if (DBNull.Value == objDocCat) { objEnt.iDocCatFAID = ""; } else { objEnt.iDocCatFAID = objDocCat.ToString(); } objEnt.vsDEAFileNo = objRead.GetValue(6).ToString(); string strDate = objRead.GetValue(11).ToString(); if (strDate == "" || strDate == "01-01-0001") { objEnt.dtClosingDate = ""; } else { objEnt.dtClosingDate = strDate; } string endDate = objRead.GetValue(12).ToString(); if (endDate == "" || endDate == "01-01-0001") { objEnt.dtRevisedClosingDate = ""; } else { objEnt.dtRevisedClosingDate = endDate; } objEnt.cAmount = objRead.GetValue(7).ToString(); objEnt.iDocCatID = objRead.GetValue(15).ToString(); objEnt.iStatusID = objRead.GetValue(16).ToString(); objEnt.iTypeID = objRead.GetValue(17).ToString(); objEnt.SignindDate = objRead.GetValue(8).ToString(); objEnt.ApprovalDate = objRead.GetValue(9).ToString(); objEnt.NegotiationDate = objRead.GetValue(10).ToString(); object objTeamLead = objRead.GetValue(20); if (DBNull.Value == objTeamLead) { objEnt.iTeamLeader = 0; } else { objEnt.iTeamLeader = int.Parse(objTeamLead.ToString()); } //// objEnt.iTeamLeader = Convert.ToInt32(objRead.GetValues(20).ToString()); } objRead.Close(); return(objEnt); } catch (Exception exMessage) { throw exMessage; } }