Пример #1
0
        public static List <ATTAinType> GetAinType(int?ainType, string active, int defaultFlag)
        {
            List <ATTAinType> AinTypeList = new List <ATTAinType>();

            try
            {
                foreach (DataRow row in DLLAinType.GetAinType(ainType, active).Rows)
                {
                    ATTAinType Reglst = new ATTAinType(
                        int.Parse(row["AIN_TYPE_ID"].ToString()),
                        row["AIN_TYPE_NAME"].ToString(),
                        row["ACTIVE"].ToString());
                    AinTypeList.Add(Reglst);
                }

                if (defaultFlag > 0)
                {
                    AinTypeList.Insert(0, new ATTAinType(0, "छान्नुहोस", ""));
                }
                return(AinTypeList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
 public static bool SaveAinType(ATTAinType objAinType)
 {
     try
     {
         return(DLLAinType.SaveAinType(objAinType));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public static bool SaveAinType(ATTAinType objAinType)
        {
            string InsertUpdateSQL            = "";
            List <OracleParameter> paramArray = new List <OracleParameter>();

            paramArray.Add(Utilities.GetOraParam(":P_AIN_TYPE_ID", objAinType.AinTypeID, OracleDbType.Int64, ParameterDirection.InputOutput));
            paramArray.Add(Utilities.GetOraParam(":P_AIN_TYPE_NAME", objAinType.AinTypeName, OracleDbType.Varchar2, ParameterDirection.Input));
            paramArray.Add(Utilities.GetOraParam(":P_ACTIVE", objAinType.Active, OracleDbType.Varchar2, ParameterDirection.Input));
            paramArray.Add(Utilities.GetOraParam(":P_ENTRY_BY", objAinType.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input));
            if (objAinType.Action == "A")
            {
                InsertUpdateSQL = "SP_ADD_AIN_TYPE";
            }
            else if (objAinType.Action == "E")
            {
                InsertUpdateSQL = "SP_EDIT_AIN_TYPE";
            }
            GetConnection     GetConn = new GetConnection();
            OracleTransaction Tran    = GetConn.GetDbConn(Module.CMS).BeginTransaction();

            try
            {
                SqlHelper.ExecuteNonQuery(Tran, System.Data.CommandType.StoredProcedure, InsertUpdateSQL, paramArray.ToArray());
                objAinType.AinTypeID = 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 (txtAinTypeName_RQD.Text == "")
        {
            lblStatusMessage.Text = "ऐनको किसिम लेख्नुस";
            programmaticModalPopup.Show();
            return;
        }

        int ainType = 0;

        if (lstAinType.SelectedIndex != -1)
        {
            ainType = int.Parse(lstAinType.SelectedValue);
        }

        foreach (ListItem lst in lstAinType.Items)
        {
            if (lst.Selected == true)
            {
                continue;
            }
            if (lst.Text.Trim().ToLower() == txtAinTypeName_RQD.Text.Trim().ToLower())
            {
                this.lblStatusMessage.Text = "Ain Type Already Exists";
                this.programmaticModalPopup.Show();
                return;
            }
        }

        ATTAinType objAinType = new ATTAinType(ainType, this.txtAinTypeName_RQD.Text.Trim(), this.chkActive.Checked == true ? "Y" : "N");

        objAinType.EntryBy = strUser;
        if (this.lstAinType.SelectedIndex > -1)
        {
            objAinType.Action = "E";
        }
        else
        {
            objAinType.Action = "A";
        }

        try
        {
            List <ATTAinType> ListAinTypeList = (List <ATTAinType>)Session["AinType"];
            BLLAinType.SaveAinType(objAinType);
            if (this.lstAinType.SelectedIndex > -1)
            {
                ListAinTypeList[this.lstAinType.SelectedIndex].AinTypeID   = objAinType.AinTypeID;
                ListAinTypeList[this.lstAinType.SelectedIndex].AinTypeName = objAinType.AinTypeName;
                ListAinTypeList[this.lstAinType.SelectedIndex].Active      = objAinType.Active;
            }
            else
            {
                ListAinTypeList.Add(objAinType);
            }
            ClearControls();
            this.lstAinType.DataSource = ListAinTypeList;
            this.lstAinType.DataBind();
            this.lblStatusMessage.Text = "Ain Type Successfully Saved.";
            this.programmaticModalPopup.Show();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }