Esempio n. 1
0
        public Object EditRecord(Int64 CurrencyID)
        {
            CurrencyMaster _currency = new CurrencyMaster();
            try
            {
                Currency currency = DAL.DALCurrency.EditCurrency(Convert.ToInt32(CurrencyID));
                _currency.ID = currency.ID;

                if (!String.IsNullOrEmpty(currency.Name))
                {
                    _currency.CurrencyName = currency.Name;
                }

                if (!String.IsNullOrEmpty(currency.Symbol))
                {
                    _currency.Symbol = currency.Symbol;
                }

            }
            catch (Exception ex)
            {
                throw;
            }
            return _currency;
        }
Esempio n. 2
0
        public ActionResult Create(CurrencyMaster model)
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];
                ViewBag.CompanyLogo = loginsession.CompanyLogo;
                ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
                String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
                String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
                ViewBag.RoleName = loginsession.RoleName;

                if (String.IsNullOrEmpty(model.CurrencyName.ToString()))
                {
                    ModelState.AddModelError("Currency", "Please Enter CurrencyName");
                }

                if (ModelState.IsValid)
                {
                    try
                    {

                        model.CreateBy = Convert.ToInt64(loginsession.UserID);
                        if (CurrencyModel.CreateCurrency(model))
                        {
                            return Json(new { result = 1, message = "Record was successfully Saved!" });
                        }
                        else
                        {
                            return Json(new { result = 0, message = "Duplicate Currency Name " });
                        }
                    }
                    catch (Exception ex)
                    {
                        return Json(new { result = 0, message = "ErrorMessage" + ":" + ex.StackTrace.ToString() });
                    }
                }
                else
                {
                    String errorMessage = String.Empty;
                    String exception = String.Empty;
                    foreach (var modelStateVal in ViewData.ModelState.Values)
                    {
                        foreach (var error in modelStateVal.Errors)
                        {
                            errorMessage = error.ErrorMessage;
                            exception = error.Exception.ToString();
                        }
                    }

                    return Json(new { result = 0, message = "ErrorMessage" + ":" + exception });
                }
            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
Esempio n. 3
0
        public static bool UpdateCurrency(CurrencyMaster currency)
        {
            Boolean flag = false;
            try
            {
                Icontext objinter = new BALCurrency();
                flag = objinter.UpdateRecord(currency);
            }
            catch (Exception ex)
            {
                throw;
            }

            return flag;
        }
Esempio n. 4
0
        public Object ViewRecord(Int64 currencyId)
        {
            CurrencyMaster vwCurrency = new CurrencyMaster();
            try
            {
                Currency Currency = DALCurrency.ViewCurrencyRecord(Convert.ToInt32(currencyId));

                vwCurrency.ID = Currency.ID;

                if (!String.IsNullOrEmpty(Currency.Name))
                {
                    vwCurrency.CurrencyName = Currency.Name;
                }

                if (!String.IsNullOrEmpty(Currency.Symbol))
                {
                    vwCurrency.Symbol = Currency.Symbol;
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return vwCurrency;
        }
Esempio n. 5
0
 public ActionResult CUView(String Currency_ID)
 {
     if (Session["Login"] != null)
     {
         LoginSession loginsession = (LoginSession)Session["Login"];
         ViewBag.CompanyLogo = loginsession.CompanyLogo;
         ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
         String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
         String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
         ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
         ViewBag.RoleName = loginsession.RoleName;
         if (Currency_ID != null)
         {
             String Dec_Currency_ID = BAL.Security.URLDecrypt(Currency_ID);
             CurrencyMaster currency = new CurrencyMaster();
             if ((Dec_Currency_ID != "0") && (Dec_Currency_ID != null))
             {
                 currency = BAL.CurrencyModel.ViewCurrency(Dec_Currency_ID);
             }
             return View(currency);
         }
         else
         { return RedirectToAction("Index", "Currency"); }
     }
     else
     { return RedirectToAction("Index", "Home"); }
 }