public static bool SavePostingType(ATTPostingType ObjAtt) { try { return(DLLPostingType.SavePostingType(ObjAtt)); } catch (Exception ex) { throw ex; } }
public static ObjectValidation Validate(ATTPostingType ObjAtt) { ObjectValidation OV = new ObjectValidation(); if (ObjAtt.PostingTypeName == "") { OV.IsValid = false; OV.ErrorMessage = "**र्कपया नियुक्तिको किसिम भर्नुहोस्"; return(OV); } return(OV); }
public static bool SavePostingType(ATTPostingType ObjAtt) { GetConnection Conn = new GetConnection(); OracleConnection DBConn; OracleTransaction Tran; string InsertUpdatePostingType = ""; try { DBConn = Conn.GetDbConn(Module.PMS); Tran = DBConn.BeginTransaction(); if (ObjAtt.PostingTypeID == 0) { InsertUpdatePostingType = "SP_ADD_POSTING_TYPES"; } else { InsertUpdatePostingType = "SP_EDIT_POSTING_TYPES"; } OracleParameter[] ParamArray = new OracleParameter[3]; ParamArray[0] = Utilities.GetOraParam(":p_POSTING_TYPE_ID", ObjAtt.PostingTypeID, OracleDbType.Int64, ParameterDirection.InputOutput); ParamArray[1] = Utilities.GetOraParam(":p_POSTING_TYPE_NAME", ObjAtt.PostingTypeName, OracleDbType.Varchar2, ParameterDirection.Input); ParamArray[2] = Utilities.GetOraParam(":p_ACTIVE", ObjAtt.Active, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(Tran, CommandType.StoredProcedure, InsertUpdatePostingType, ParamArray); int PostingTypeID = int.Parse(ParamArray[0].Value.ToString()); ObjAtt.PostingTypeID = PostingTypeID; Tran.Commit(); return(true); } catch (Exception ex) { throw ex; } finally { Conn.CloseDbConn(); } }
public static List <ATTPostingType> GetPostingType(int?PostingTypeId, string active) { List <ATTPostingType> lstPostingType = new List <ATTPostingType>(); try { foreach (DataRow row in DLLPostingType.GetPostingType(PostingTypeId, active).Rows) { ATTPostingType ObjAtt = new ATTPostingType ( int.Parse(row["POSTING_TYPE_ID"].ToString()), row["POSTING_TYPE_NAME"].ToString(), (row["ACTIVE"] == System.DBNull.Value) ? "" : (string)row["ACTIVE"] ); lstPostingType.Add(ObjAtt); } return(lstPostingType); } catch (Exception ex) { throw ex; } }
protected void btnSave_Click(object sender, EventArgs e) { List <ATTPostingType> lstPostingTypes = (List <ATTPostingType>)Session["PostingType"]; int intPostingTypeID = 0; string strActive; if (this.lstPostingType.SelectedIndex > -1) { intPostingTypeID = lstPostingTypes[this.lstPostingType.SelectedIndex].PostingTypeID; } strActive = "Y"; ATTPostingType objPostingType; try { objPostingType = new ATTPostingType(intPostingTypeID, this.txtPostingType_Rqd.Text.Trim(), strActive); ObjectValidation OV = BLLPostingType.Validate(objPostingType); if (!OV.IsValid) { this.lblStatusMessage.Text = OV.ErrorMessage; this.programmaticModalPopup.Show(); return; } for (int i = 0; i < lstPostingType.Items.Count; i++) { if (lstPostingType.SelectedIndex != i) { if (lstPostingTypes[i].PostingTypeName.ToLower() == txtPostingType_Rqd.Text.Trim().ToLower()) { this.lblStatusMessage.Text = "Posting Type Already Exists"; this.programmaticModalPopup.Show(); return; } } } BLLPostingType.SavePostingType(objPostingType); if (this.lstPostingType.SelectedIndex == -1) { lstPostingTypes.Add(objPostingType); } else { lstPostingTypes[this.lstPostingType.SelectedIndex].PostingTypeName = this.txtPostingType_Rqd.Text.Trim(); lstPostingTypes[this.lstPostingType.SelectedIndex].Active = strActive; } this.lstPostingType.DataSource = lstPostingTypes; this.lstPostingType.DataBind(); this.txtPostingType_Rqd.Text = ""; this.lstPostingType.SelectedIndex = -1; this.lblStatusMessage.Text = "Posting Type Successfully Saved."; this.programmaticModalPopup.Show(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }