コード例 #1
0
        public ActionResult AddCompanyNewCurrency(int?id)
        {
            string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
            string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            string pagename       = @"/" + controllerName + @"/" + actionName;
            var    page           = (List <LP_Pages_Property>)Session["PageList"];

            if (Session["LoggedIn"] != null && Helper.CheckPageAccess(pagename, page) && Session["ISADMIN"] != null && Convert.ToBoolean(Session["ISADMIN"].ToString()) == true)
            {
                objcompanyCurrencyproperty = new companyCurrency_Property();
                objcompanyCurrencybll      = new CompanyCurrency_BLL(objcompanyCurrencyproperty);
                // objcompanyCurrencybll.SelectAllCurrency()
                objcompanyCurrencyproperty.CurrencyLST = Helper.ConvertDataTable <currency_Property>(objcompanyCurrencybll.SelectAllCurrency());
                try
                {
                    if (id > 0)
                    {
                        int     currecyId;
                        decimal exchangeRate;
                        objcompanyCurrencyproperty.idx = Convert.ToInt32(id);
                        objcompanyCurrencybll          = new CompanyCurrency_BLL(objcompanyCurrencyproperty);
                        DataTable dt = new DataTable();
                        dt = objcompanyCurrencybll.SelectOne();
                        int.TryParse(dt.Rows[0]["currencyIdx"].ToString(), out currecyId);
                        objcompanyCurrencyproperty.currencyIdx = currecyId;
                        decimal.TryParse(dt.Rows[0]["exhangeRate"].ToString(), out exchangeRate);
                        objcompanyCurrencyproperty.exhangeRate = exchangeRate;
                    }
                    else
                    {
                    }
                }
                catch (Exception ex)
                {
                }
                return(PartialView("_AddCompanyNewCurrency", objcompanyCurrencyproperty));
            }
            else
            {
                if (Session["LoggedIn"] == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }
                else
                {
                    return(RedirectToAction("NotAuthorized", "Account"));
                }
            }
        }
コード例 #2
0
 public ActionResult AddCompanyNewCurrency(int?id)
 {
     if (Session["LOGGEDIN"] != null)
     {
         objcompanyCurrencyproperty = new companyCurrency_Property();
         objcompanyCurrencybll      = new CompanyCurrency_BLL(objcompanyCurrencyproperty);
         // objcompanyCurrencybll.SelectAllCurrency()
         objcompanyCurrencyproperty.CurrencyLST = Helper.ConvertDataTable <currency_Property>(objcompanyCurrencybll.SelectAllCurrency());
         try
         {
             if (id > 0)
             {
                 int     currecyId;
                 decimal exchangeRate;
                 objcompanyCurrencyproperty.idx = Convert.ToInt32(id);
                 objcompanyCurrencybll          = new CompanyCurrency_BLL(objcompanyCurrencyproperty);
                 DataTable dt = new DataTable();
                 dt = objcompanyCurrencybll.SelectOne();
                 int.TryParse(dt.Rows[0]["currencyIdx"].ToString(), out currecyId);
                 objcompanyCurrencyproperty.currencyIdx = currecyId;
                 decimal.TryParse(dt.Rows[0]["exhangeRate"].ToString(), out exchangeRate);
                 objcompanyCurrencyproperty.exhangeRate = exchangeRate;
             }
             else
             {
             }
         }
         catch (Exception ex)
         {
         }
         return(PartialView("_AddCompanyNewCurrency", objcompanyCurrencyproperty));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }