/// <summary> /// Update Database Make data as Obsoluted /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void IsObsolete_CheckedChanged(Object sender, EventArgs e) { string message = string.Empty; try { CheckBox chk = (CheckBox)sender; GridViewRow gr = (GridViewRow)chk.Parent.Parent; string lineTypeID = ((Literal)gr.FindControl("litLineTypeID")).Text; TypeOfLineBLL objTypeOfLineBLL = new TypeOfLineBLL(); message = objTypeOfLineBLL.ObsoleteLineType(Convert.ToInt32(lineTypeID), Convert.ToString(chk.Checked), Convert.ToInt32(Session["USER_ID"])); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; } BindGrid(-1); if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Set Grid Data source /// </summary> /// <param name="addRow"></param> /// <param name="deleteRow"></param> private void BindGrid(int newPageIndx) { TypeOfLineBLLObj = new TypeOfLineBLL(); dv_Details.DataSource = TypeOfLineBLLObj.GetAllLineTypes(); if (newPageIndx >= 0) { dv_Details.PageIndex = newPageIndx; } dv_Details.DataBind(); }
//protected void BindBankBranchess(int bankID) //{ // ListItem firstListItem = new ListItem(ddlBranch.Items[0].Text, ddlBranch.Items[0].Value); // ddlBranch.Items.Clear(); // if (bankID > 0) // { // BranchBLL objBranchBLL = new BranchBLL(); // ddlBranch.DataSource = objBranchBLL.GetActiveBranches(bankID); // ddlBranch.DataTextField = "BRANCHNAME"; // ddlBranch.DataValueField = "BankBranchId"; // ddlBranch.DataBind(); // } // ddlBranch.Items.Insert(0, firstListItem); // ddlBranch.SelectedIndex = 0; //} #endregion #region Events /// <summary> /// To change values in dropdownlist based on index /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlTypeLine_SelectedIndexChanged(object sender, EventArgs e) { //Call the By Line ID TypeOfLineBO oTypeOfLine = new TypeOfLineBO(); TypeOfLineBLL oTypeOfLineBLL = new TypeOfLineBLL(); oTypeOfLine = oTypeOfLineBLL.GetLineTypebyID(Convert.ToInt32(ddlTypeLine.SelectedValue.ToString())); lblRightofWayMeasurement.Text = oTypeOfLine.Rightofwaymeasurement; lblWayLeaveMeasurement.Text = oTypeOfLine.Wayleavemeasurement; }
/// <summary> /// Save and Update Data into Database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string message = ""; if (Convert.ToInt32(ViewState["LineTypeId"]) > 0) { string uID = Session["USER_ID"].ToString(); int LineTypeID = Convert.ToInt32(ViewState["LineTypeId"]); TypeOfLineBOObj = new TypeOfLineBO(); TypeOfLineBOObj.TypeOfLine = txtLineType.Text.ToString(); TypeOfLineBOObj.Wayleavemeasurement = txtWayleave.Text.ToString(); TypeOfLineBOObj.Rightofwaymeasurement = txtRightOfWay.Text.ToString(); TypeOfLineBOObj.Createdby = Convert.ToInt32(uID); TypeOfLineBLLObj = new TypeOfLineBLL(); message = TypeOfLineBLLObj.Update(TypeOfLineBOObj, LineTypeID); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; } SetUpdateMode(false); } else { string uID = Session["USER_ID"].ToString(); TypeOfLineBOObj = new TypeOfLineBO(); TypeOfLineBOObj.Createdby = Convert.ToInt32(uID); TypeOfLineBOObj.Rightofwaymeasurement = txtRightOfWay.Text.ToString(); TypeOfLineBOObj.TypeOfLine = txtLineType.Text.ToString(); TypeOfLineBOObj.Wayleavemeasurement = txtWayleave.Text.ToString(); TypeOfLineBLLObj = new TypeOfLineBLL(); message = TypeOfLineBLLObj.insert(TypeOfLineBOObj); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; } } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } BindGrid(-1); clearfields(); }
public static TypeOfLineBO GetTypeOfLineDetails(int segmentID) { ProjectBLL objProjectBLL = new ProjectBLL(); SegmentBO objSegment = objProjectBLL.GetProjectSegmentByID(segmentID); TypeOfLineBO objTypeOfLine = null; if (objSegment != null) { TypeOfLineBLL objTypeOfLineBLL = new TypeOfLineBLL(); objTypeOfLine = objTypeOfLineBLL.GetLineTypebyID(objSegment.LineTypeID); } return(objTypeOfLine); }
/// <summary> /// To assign values to TypeLineDropdownList /// </summary> private void LoadTypeLine()//(object sender, EventArgs e) { TypeOfLineBLL oTypeOfLineBLL = new TypeOfLineBLL(); TypeOfLineLists TypeLineList = new TypeOfLineLists(); ddlTypeLine.Items.Clear(); TypeLineList = oTypeOfLineBLL.GetLineType(); ddlTypeLine.DataTextField = "TYPEOFLINE"; ddlTypeLine.DataValueField = "LINETYPEID"; ddlTypeLine.DataSource = TypeLineList; ddlTypeLine.DataBind(); ddlTypeLine.Items.Insert(0, new ListItem("--Select--", "0")); ddlTypeLine.SelectedIndex = 0; }
/// <summary> /// Get the line type details. /// </summary> private void GetLineTypeDetails() { TypeOfLineBLLObj = new TypeOfLineBLL(); int LineTypeID = 0; if (ViewState["LineTypeId"] != null) { LineTypeID = Convert.ToInt32(ViewState["LineTypeId"]); } TypeOfLineBOObj = new TypeOfLineBO(); TypeOfLineBOObj = TypeOfLineBLLObj.GetLineTypebyID(LineTypeID); txtLineType.Text = TypeOfLineBOObj.TypeOfLine; txtRightOfWay.Text = TypeOfLineBOObj.Rightofwaymeasurement; txtWayleave.Text = TypeOfLineBOObj.Wayleavemeasurement; ConcernIDTextBox.Text = TypeOfLineBOObj.LineTypeId.ToString(); }
/// <summary> /// Set edit mode for edit comand /// Delete data from the database for delete comand /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void dv_Details_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditRow") { ViewState["LineTypeId"] = e.CommandArgument; int LineTypeID = Convert.ToInt32(ViewState["LineTypeId"]); GetLineTypeDetails(); SetUpdateMode(true); } else if (e.CommandName == "DeleteRow") { TypeOfLineBLLObj = new TypeOfLineBLL(); TypeOfLineBLLObj.Delete(Convert.ToInt32(e.CommandArgument)); clearfields(); SetUpdateMode(false); BindGrid(-1); } }