public static List <ATTAccountType> GetAccountType(int?AccountType, string active, int defaultFlag) { List <ATTAccountType> AccountTypeList = new List <ATTAccountType>(); try { foreach (DataRow row in DLLAccountType.GetAccountType(AccountType, active).Rows) { ATTAccountType Reglst = new ATTAccountType( int.Parse(row["ACCOUNT_TYPE_ID"].ToString()), row["ACCOUNT_TYPE_NAME"].ToString(), row["ACTIVE"].ToString()); AccountTypeList.Add(Reglst); } if (defaultFlag > 0) { AccountTypeList.Insert(0, new ATTAccountType(0, "छान्नुहोस", "")); } return(AccountTypeList); } catch (Exception ex) { throw ex; } }
public static bool SaveAccountType(ATTAccountType objAccountType) { try { return(DLLAccountType.SaveAccountType(objAccountType)); } catch (Exception ex) { throw ex; } }
public static bool SaveAccountType(ATTAccountType objAccountType) { string InsertUpdateSQL = ""; List <OracleParameter> paramArray = new List <OracleParameter>(); paramArray.Add(Utilities.GetOraParam(":P_ACCOUNT_TYPE_ID", objAccountType.AccountTypeID, OracleDbType.Int64, ParameterDirection.InputOutput)); paramArray.Add(Utilities.GetOraParam(":P_ACCOUNT_TYPE_NAME", objAccountType.AccountTypeName, OracleDbType.Varchar2, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam(":P_ACTIVE", objAccountType.Active, OracleDbType.Varchar2, ParameterDirection.Input)); paramArray.Add(Utilities.GetOraParam(":P_ENTRY_BY", objAccountType.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input)); if (objAccountType.Action == "A") { InsertUpdateSQL = "SP_ADD_ACCOUNT_TYPE"; } else if (objAccountType.Action == "E") { InsertUpdateSQL = "SP_EDIT_ACCOUNT_TYPE"; } GetConnection GetConn = new GetConnection(); OracleTransaction Tran = GetConn.GetDbConn(Module.CMS).BeginTransaction(); try { SqlHelper.ExecuteNonQuery(Tran, System.Data.CommandType.StoredProcedure, InsertUpdateSQL, paramArray.ToArray()); objAccountType.AccountTypeID = int.Parse(paramArray[0].Value.ToString()); Tran.Commit(); return(true); } catch (OracleException oex) { PCS.COREDL.OracleError oe = new PCS.COREDL.OracleError(); throw new ArgumentException(oe.GetOraError(oex.Number, oex.Message)); } catch (Exception ex) { Tran.Rollback(); throw ex; } finally { GetConn.CloseDbConn(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (txtAccountTypeName_RQD.Text == "") { lblStatusMessage.Text = "खाताको किसिम लेख्नुस"; programmaticModalPopup.Show(); return; } int accountType = 0; if (lstAccountType.SelectedIndex != -1) { accountType = int.Parse(lstAccountType.SelectedValue); } foreach (ListItem lst in lstAccountType.Items) { if (lst.Selected == true) { continue; } if (lst.Text.Trim().ToLower() == txtAccountTypeName_RQD.Text.Trim().ToLower()) { this.lblStatusMessage.Text = "Account Type Already Exists"; this.programmaticModalPopup.Show(); return; } } ATTAccountType objAccountType = new ATTAccountType(accountType, this.txtAccountTypeName_RQD.Text.Trim(), this.chkActive.Checked == true ? "Y" : "N"); objAccountType.EntryBy = strUser; if (this.lstAccountType.SelectedIndex > -1) { objAccountType.Action = "E"; } else { objAccountType.Action = "A"; } try { List <ATTAccountType> ListAccountTypeList = (List <ATTAccountType>)Session["AccountType"]; BLLAccountType.SaveAccountType(objAccountType); if (this.lstAccountType.SelectedIndex > -1) { ListAccountTypeList[this.lstAccountType.SelectedIndex].AccountTypeID = objAccountType.AccountTypeID; ListAccountTypeList[this.lstAccountType.SelectedIndex].AccountTypeName = objAccountType.AccountTypeName; ListAccountTypeList[this.lstAccountType.SelectedIndex].Active = objAccountType.Active; } else { ListAccountTypeList.Add(objAccountType); } ClearControls(); this.lstAccountType.DataSource = ListAccountTypeList; this.lstAccountType.DataBind(); this.lblStatusMessage.Text = "Account Type Successfully Saved."; this.programmaticModalPopup.Show(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }