protected void BtnUpdate_Click(object sender, EventArgs e) { int UpdateRow = 0; try { string radio_btn_value = RadioButtonList1.SelectedValue; if (radio_btn_value == "1") { Entity_Unit.Action = 1; Entity_Unit.PONO = txtPono.Text.Trim(); Entity_Unit.UserId = Convert.ToInt32(Session["UserId"]); Entity_Unit.LoginDate = DateTime.Now; UpdateRow = Obj_Unit.UpdateRecord(ref Entity_Unit, out StrError); if (UpdateRow != 0) { obj_Comm.ShowPopUpMsg("Record Updated Successfully", this.Page); // MakeEmptyForm(); txtPono.Text = string.Empty; Entity_Unit = null; obj_Comm = null; } } else if (radio_btn_value == "2") { Entity_Unit.Action = 2; Entity_Unit.PONO = txtPono.Text.Trim(); Entity_Unit.UserId = Convert.ToInt32(Session["UserId"]); Entity_Unit.LoginDate = DateTime.Now; UpdateRow = Obj_Unit.UpdateRecord(ref Entity_Unit, out StrError); if (UpdateRow != 0) { obj_Comm.ShowPopUpMsg("Record Updated Successfully", this.Page); // MakeEmptyForm(); txtPono.Text = string.Empty; Entity_Unit = null; obj_Comm = null; } } } catch (Exception) { throw; } }
public int UpdateRecord(ref CHStatus Entity_Call, out String StrError) { int iInsert = 0; StrError = string.Empty; try { SqlParameter pAction = new SqlParameter(CHStatus._Action, SqlDbType.BigInt); SqlParameter pUnit = new SqlParameter(CHStatus._PONO, SqlDbType.NVarChar); SqlParameter pUpdatedBy = new SqlParameter(CHStatus._UserId, SqlDbType.BigInt); SqlParameter pUpdatedDate = new SqlParameter(CHStatus._LoginDate, SqlDbType.DateTime); pAction.Value = Entity_Call.Action; pUnit.Value = Entity_Call.PONO; pUpdatedBy.Value = Entity_Call.UserId; pUpdatedDate.Value = Entity_Call.LoginDate; SqlParameter[] param = new SqlParameter[] { pAction, pUnit, pUpdatedBy, pUpdatedDate }; Open(CONNECTION_STRING); BeginTransaction(); iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, CHStatus.SP_ChangePoIndStatus, param); if (iInsert > 0) { CommitTransaction(); } else { RollBackTransaction(); } } catch (Exception ex) { RollBackTransaction(); throw new Exception(ex.Message); } finally { Close(); } return(iInsert); }