/// <summary> /// to update data /// </summary> /// <param name="oFloorType"></param> /// <returns></returns> public string UpdateFloorType(FloorTypeBO oFloorType) { string returnResult; cnn = new OracleConnection(con); proc = "USP_MST_UPD_FLOOR"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection.Open(); cmd.Parameters.Add("floorid_", oFloorType.FloorTypeID); cmd.Parameters.Add("floortype_", oFloorType.FloorTypeName); cmd.Parameters.Add("updatedby_", oFloorType.CreatedBy); cmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); if (cmd.Parameters["errorMessage_"].Value != null) { returnResult = cmd.Parameters["errorMessage_"].Value.ToString(); } else { returnResult = string.Empty; } return(returnResult); }
/// <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; }
/// <summary> /// To fetch details /// </summary> /// <returns></returns> public FloorTypeList GetAllFloorType()//(FloorType oFloorType) { proc = "USP_MST_GET_ALLFLOOR"; cnn = new OracleConnection(con); FloorTypeBO objFloorType = null; FloorTypeList lstFloorTypeList = new FloorTypeList(); cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; try { cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (dr.Read()) { objFloorType = new FloorTypeBO(); if (ColumnExists(dr, "floorid") && !dr.IsDBNull(dr.GetOrdinal("floorid"))) { objFloorType.FloorTypeID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("floorid"))); } if (ColumnExists(dr, "floortype") && !dr.IsDBNull(dr.GetOrdinal("floortype"))) { objFloorType.FloorTypeName = dr.GetString(dr.GetOrdinal("floortype")); } if (ColumnExists(dr, "IsDeleted") && !dr.IsDBNull(dr.GetOrdinal("IsDeleted"))) { objFloorType.IsDeleted = dr.GetString(dr.GetOrdinal("IsDeleted")); } lstFloorTypeList.Add(objFloorType); } dr.Close(); } catch (Exception ex) { throw ex; } return(lstFloorTypeList); }
/// <summary> /// To fetch details by ID /// </summary> /// <param name="FloorTypeID"></param> /// <returns></returns> public FloorTypeBO GetFloorTypeById(int FloorTypeID) { cnn = new OracleConnection(con); proc = "USP_MST_GET_FLOOR_BYID"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("floorid_", FloorTypeID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); FloorTypeBO objFloorType = null; while (dr.Read()) { objFloorType = new FloorTypeBO(); if (ColumnExists(dr, "floorid") && !dr.IsDBNull(dr.GetOrdinal("floorid"))) { objFloorType.FloorTypeID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("floorid"))); } if (ColumnExists(dr, "floortype") && !dr.IsDBNull(dr.GetOrdinal("floortype"))) { objFloorType.FloorTypeName = dr.GetString(dr.GetOrdinal("floortype")); } if (ColumnExists(dr, "IsDeleted") && !dr.IsDBNull(dr.GetOrdinal("IsDeleted"))) { objFloorType.IsDeleted = dr.GetString(dr.GetOrdinal("IsDeleted")); } } dr.Close(); return(objFloorType); }
/// <summary> /// To Update Floor Type /// </summary> /// <param name="oFloorType"></param> /// <returns></returns> public string UpdateFloorType(FloorTypeBO oFloorType) { objFloorTypeDAL = new FloorTypeDAL(); return(objFloorTypeDAL.UpdateFloorType(oFloorType)); }
/// <summary> /// To Add Floor Type /// </summary> /// <param name="oFloorType"></param> /// <returns></returns> public string AddFloorType(FloorTypeBO oFloorType) { objFloorTypeDAL = new FloorTypeDAL(); return(objFloorTypeDAL.SaveFloorType(oFloorType)); }