public static bool EditCurrency(ATTCurrency obj, Previlege pobj)
        {
            string EditSP;

            EditSP = "SP_EDIT_CURRENCY";

            OracleParameter[] paramArray = new OracleParameter[2];
            paramArray[0] = Utilities.GetOraParam(":p_CURRENCY_ID", obj.CurrencyID, OracleDbType.Int64, ParameterDirection.InputOutput);
            paramArray[1] = Utilities.GetOraParam(":p_CURRENCY_NAME", obj.CurrencyName, OracleDbType.Varchar2, ParameterDirection.Input);

            GetConnection getConn = new GetConnection();

            try
            {
                OracleConnection DBConn = getConn.GetDbConn(Module.LIS);

                if (Previlege.HasPrevilege(pobj, DBConn) == false)
                {
                    throw new ArgumentException(Utilities.PreviledgeMsg + " update Currency.");
                }

                SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, EditSP, paramArray);

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                getConn.CloseDbConn();
            }
        }
Ejemplo n.º 2
0
        //public static bool AddAuthor(ATTAuthor obj, Previlege pobj)
        //{
        //    try
        //    {
        //        return DLLAuthor.AddAuthor(obj, pobj);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //}



        //public static bool EditCurrency(ATTCurrency obj, string username, string menuname)
        public static bool EditCurrency(ATTCurrency obj, Previlege pobj)
        {
            try
            {
                return(DLLCurrency.EditCurrency(obj, pobj));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        public static ObjectValidation Validate(ATTCurrency obj)
        {
            ObjectValidation OV = new ObjectValidation();

            if (obj.CurrencyName == "")
            {
                OV.IsValid      = false;
                OV.ErrorMessage = "Currency name cannot be empty.";
                return(OV);
            }

            return(OV);
        }
    protected void lstCurrency_SelectedIndexChanged(object sender, EventArgs e)
    {
        List <ATTCurrency> lst = (List <ATTCurrency>)Session["Currency_CurrencyList"];

        ATTCurrency currency = lst.Find
                               (
            delegate(ATTCurrency cu)
        {
            return(cu.CurrencyID == int.Parse(this.lstCurrency.SelectedValue));
        }
                               );

        this.txtCurrencyName_Rqd.Text = currency.CurrencyName;
    }
Ejemplo n.º 5
0
        public static List <ATTCurrency> GetCurrencyList(int?currencyID)
        {
            List <ATTCurrency> lstCurrency = new List <ATTCurrency>();

            try
            {
                foreach (DataRow row in DLLCurrency.GetCurrencyTable(currencyID).Rows)
                {
                    ATTCurrency obj = new ATTCurrency
                                      (
                        int.Parse(row["Currency_ID"].ToString()),
                        row["Currency_Name"].ToString()
                                      );

                    lstCurrency.Add(obj);
                }
                return(lstCurrency);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ATTCurrency currencyObj = new ATTCurrency
                                  (
            0,
            this.txtCurrencyName_Rqd.Text,
            ((ATTUserLogin)Session["Login_User_Detail"]).UserName,
            DateTime.Now
                                  );

        ObjectValidation OV = BLLCurrency.Validate(currencyObj);

        if (OV.IsValid == false)
        {
            this.lblStatus.Text = OV.ErrorMessage;
            return;
        }

        List <ATTCurrency> lstCurr = (List <ATTCurrency>)Session["Currency_CurrencyList"];
        ATTUserLogin       user    = ((ATTUserLogin)Session["Login_User_Detail"]);

        try
        {
            if (this.lstCurrency.SelectedIndex < 0)
            {
                if (user.MenuList["4,6,1"] == null || user.MenuList["4,6,1"].PAdd == "N")
                {
                    this.lblStatus.Text = Utilities.PreviledgeMsg + " add Currency.";
                    return;
                }
                Previlege pobj = new Previlege(user.UserName, "4,6,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD);
                BLLCurrency.AddCurrency(currencyObj, pobj);
                lstCurr.Add(currencyObj);
            }
            else
            {
                if (user.MenuList["4,6,1"] == null || user.MenuList["4,6,1"].PEdit == "N")
                {
                    this.lblStatus.Text = Utilities.PreviledgeMsg + " update Currency.";
                    return;
                }
                Previlege pobj = new Previlege(user.UserName, "4,6,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_EDIT);

                currencyObj.CurrencyID = int.Parse(this.lstCurrency.SelectedValue);
                BLLCurrency.EditCurrency(currencyObj, pobj);
                lstCurr[this.lstCurrency.SelectedIndex] = currencyObj;
            }


            this.lstCurrency.DataSource     = lstCurr;
            this.lstCurrency.DataTextField  = "CurrencyName";
            this.lstCurrency.DataValueField = "CurrencyID";

            this.lstCurrency.DataBind();

            this.ClearCurrencyControl();
        }
        catch (Exception ex)
        {
            this.lblStatus.Text = ex.Message;
        }
    }