/// <summary> /// To delete details /// </summary private void DeleteFloorType(string floorTypeID) { objFloorTypeBLL = new FloorTypeBLL(); string message = string.Empty; try { int UserID_ = Convert.ToInt32(Session["USER_ID"].ToString()); message = objFloorTypeBLL.DeleteFloorType(Convert.ToInt32(floorTypeID), UserID_); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data deleted successfully"; } ClearDetails(); BindGrid(false, true); if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } } catch (Exception ex) { throw ex; } }
/// <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 floorTypeID = ((Literal)gr.FindControl("litFloorTypeID")).Text; objFloorTypeBLL = new FloorTypeBLL(); message = objFloorTypeBLL.ObsoleteFloorType(Convert.ToInt32(floorTypeID), Convert.ToString(chk.Checked)); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; } ClearDetails(); BindGrid(false, true); if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } } catch (Exception ex) { throw ex; } }
/// <summary> /// to bind the data from the database to the dropdown ddlFloor /// </summary> private void bindDDLFloor() { objFloorTypeBLL = new FloorTypeBLL(); objFloorTypeList = objFloorTypeBLL.GetFloorType(); ddlFloor.DataSource = objFloorTypeList; ddlFloor.DataTextField = "FloorTypeName"; ddlFloor.DataValueField = "FloorTypeID"; ddlFloor.DataBind(); }
/// <summary> /// To get the floor material /// </summary> private void GetFloorMaterial() { FloorTypeBLL BLLobj = new FloorTypeBLL(); ddlFloorMaterial.DataSource = BLLobj.GetFloorType(); ddlFloorMaterial.DataTextField = "FloorTypeName"; ddlFloorMaterial.DataValueField = "FloorTypeID"; ddlFloorMaterial.DataBind(); }
/// <summary> /// To save details to database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string message = string.Empty; string AlertMessage = string.Empty; objFloorType = new FloorTypeBO(); objFloorTypeBLL = new FloorTypeBLL(); //Assignement objFloorType.FloorTypeName = txtFloorType.Text.Trim(); if (ViewState["FloorTypeID"] != null) { objFloorType.FloorTypeID = Convert.ToInt32(ViewState["FloorTypeID"].ToString()); } objFloorType.IsDeleted = "False"; //if (Session["USER_ID"] != null) objFloorType.CreatedBy = Convert.ToInt32(Session["USER_ID"].ToString()); if (objFloorType.FloorTypeID < 1) { //If FloorTypeID does Not exists then SaveFloorType objFloorType.FloorTypeID = -1;//For New FloorType message = objFloorTypeBLL.AddFloorType(objFloorType); AlertMessage = "alert('" + message + "');"; if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; ClearDetails(); BindGrid(true, false); } } else { //If FloorTypeID exists then UpdateFloorType message = objFloorTypeBLL.UpdateFloorType(objFloorType); //For Updating FloorType AlertMessage = "alert('" + message + "');"; if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; ClearDetails(); BindGrid(true, false); } } //ClearDetails(); AlertMessage = "alert('" + message + "');"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true); SetUpdateMode(false); }
/// <summary> /// Set Grid Data source /// </summary> /// <param name="addRow"></param> /// <param name="deleteRow"></param>e private void BindGrid(bool addRow, bool deleteRow) { objFloorTypeBLL = new FloorTypeBLL(); objFloorType = new FloorTypeBO(); objFloorType.FloorTypeName = string.Empty; objFloorType.FloorTypeID = 0; grdFloorType.DataSource = objFloorTypeBLL.GetAllFloorType();//(objFloorType); grdFloorType.DataBind(); }
/// <summary> /// To edit details /// </summary> private void GetFloorTypeDetails() { objFloorTypeBLL = new FloorTypeBLL(); int FloorTypeID = 0; if (ViewState["FloorTypeID"] != null) { FloorTypeID = Convert.ToInt32(ViewState["FloorTypeID"].ToString()); } objFloorType = new FloorTypeBO(); objFloorType = objFloorTypeBLL.GetFloorTypeById(FloorTypeID); txtFloorType.Text = objFloorType.FloorTypeName; }