public ActionResult Edit(int id, FormCollection form)
        {
            #region Added by shakir (Currency parameter)
            var selectCurrency = (dynamic)null;
            if (form["selectCurrency"] != null)
            {
                selectCurrency = Convert.ToInt32(form["selectCurrency"].ToString());
            }
            else
            {
                selectCurrency = Convert.ToInt32(Session["SelectedCurrency"].ToString());
            }

            UtilityClass.GetSelectedCurrecy(selectCurrency);
            #endregion

            ServiceRepository   serviceObj = new ServiceRepository();
            HttpResponseMessage response   = serviceObj.GetResponse("/api/BlotterOpenBal/GetBlotterOpenBalById?id=" + id.ToString());
            response.EnsureSuccessStatusCode();
            Models.SBP_BlotterOpeningBalance BlotterOpenBal = response.Content.ReadAsAsync <Models.SBP_BlotterOpeningBalance>().Result;
            UtilityClass.ActivityMonitor(Convert.ToInt32(Session["UserID"]), Session.SessionID, Request.UserHostAddress.ToString(), new Guid().ToString(), JsonConvert.SerializeObject(BlotterOpenBal), this.RouteData.Values["action"].ToString(), Request.RawUrl.ToString());
            var isDateChangable = Convert.ToBoolean(Session["CurrentPagesAccess"].ToString().Split('~')[2]);
            ViewData["isDateChangable"] = isDateChangable;
            return(PartialView("_Edit", BlotterOpenBal));
        }
        public JsonResult <Models.SBP_BlotterOpeningBalance> GetBlotterOpenBalById(int id)
        {
            EntityMapperBlotterOpenBal <DataAccessLayer.SBP_BlotterOpeningBalance, Models.SBP_BlotterOpeningBalance>
            mapObj = new EntityMapperBlotterOpenBal <DataAccessLayer.SBP_BlotterOpeningBalance, Models.SBP_BlotterOpeningBalance>();

            DataAccessLayer.SBP_BlotterOpeningBalance dalBlotterOpenBal = DAL.GetOpenBalItem(id);
            Models.SBP_BlotterOpeningBalance          products          = new Models.SBP_BlotterOpeningBalance();
            products = mapObj.Translate(dalBlotterOpenBal);
            return(Json <Models.SBP_BlotterOpeningBalance>(products));
        }
        public JsonResult <Models.SBP_BlotterOpeningBalance> GetLatestOpeningBalaceForToday(int BR, string Date)
        {
            EntityMapperBlotter <DataAccessLayer.SP_GetOpeningBalance_Result, Models.SBP_BlotterOpeningBalance> mapObj = new EntityMapperBlotter <DataAccessLayer.SP_GetOpeningBalance_Result, Models.SBP_BlotterOpeningBalance>();

            DataAccessLayer.SP_GetOpeningBalance_Result dalEmail    = DAL.GetOpeningBalance(BR, Convert.ToDateTime(Date));
            Models.SBP_BlotterOpeningBalance            SumForEmail = new Models.SBP_BlotterOpeningBalance();

            SumForEmail = mapObj.Translate(dalEmail);

            return(Json <Models.SBP_BlotterOpeningBalance>(SumForEmail));
        }
        public bool UpdateOpenBal(Models.SBP_BlotterOpeningBalance blotterOpenBal)
        {
            bool status = false;

            if (ModelState.IsValid)
            {
                EntityMapperBlotterOpenBal <Models.SBP_BlotterOpeningBalance, DataAccessLayer.SBP_BlotterOpeningBalance> mapObj = new EntityMapperBlotterOpenBal <Models.SBP_BlotterOpeningBalance, DataAccessLayer.SBP_BlotterOpeningBalance>();
                DataAccessLayer.SBP_BlotterOpeningBalance OpenBalObj = new DataAccessLayer.SBP_BlotterOpeningBalance();
                OpenBalObj = mapObj.Translate(blotterOpenBal);
                status     = DAL.UpdateOpenBal(OpenBalObj);
            }
            return(status);
        }
        public ActionResult Update(Models.SBP_BlotterOpeningBalance BlotterOpenBal)
        {
            if (Session["BR"].ToString() == "01")
            {
                BlotterOpenBal.DataType = "SBP";
            }
            BlotterOpenBal.UpdateDate = DateTime.Now;
            if (BlotterOpenBal.BalDate == null)
            {
                BlotterOpenBal.BalDate = DateTime.Now;
            }
            BlotterOpenBal.UserID = Convert.ToInt16(Session["UserID"].ToString());
            BlotterOpenBal.CurID  = Convert.ToInt16(Session["SelectedCurrency"].ToString());
            BlotterOpenBal.BID    = Convert.ToInt16(Session["BranchID"].ToString());
            BlotterOpenBal.BR     = Convert.ToInt16(Session["BR"].ToString());
            ServiceRepository   serviceObj = new ServiceRepository();
            HttpResponseMessage response   = serviceObj.PutResponse("api/BlotterOpenBal/UpdateOpenBal", BlotterOpenBal);

            response.EnsureSuccessStatusCode();
            UtilityClass.ActivityMonitor(Convert.ToInt32(Session["UserID"]), Session.SessionID, Request.UserHostAddress.ToString(), new Guid().ToString(), JsonConvert.SerializeObject(BlotterOpenBal), this.RouteData.Values["action"].ToString(), Request.RawUrl.ToString());
            return(RedirectToAction("OpeningBalance"));
        }
        //string BrCode = ConfigurationManager.AppSettings["BranchCode"].ToString();
        public ActionResult GetAllBlotter(FormCollection form)
        {
            try
            {
                #region Added by shakir (Currency parameter)

                var selectCurrency     = (dynamic)null;
                var BlotterCurrentDate = (dynamic)null;

                if (form["selectCurrency"] != null)
                {
                    selectCurrency = Convert.ToInt32(form["selectCurrency"].ToString());
                }
                else
                {
                    selectCurrency = Convert.ToInt32(Session["SelectedCurrency"].ToString());
                }

                if (form["SearchByDate"] != null)
                {
                    BlotterCurrentDate = form["SearchByDate"].ToString();
                    ViewBag.CurrentDt  = BlotterCurrentDate;
                }
                else
                {
                    ViewBag.CurrentDt  = DateTime.Now.ToString("yyyy-MM-dd");
                    BlotterCurrentDate = ViewBag.CurrentDt;
                }

                UtilityClass.GetSelectedCurrecy(selectCurrency);
                #endregion

                BlotterMultiModel        blotterMulit = new BlotterMultiModel();
                ServiceRepositoryBlotter serviceObj   = new ServiceRepositoryBlotter();
                HttpResponseMessage      response;
                if (Convert.ToInt32(selectCurrency) == 1)
                {
                    if (form["LoadData"] != null)
                    {
                        response = serviceObj.GetResponse("/api/Blotter/GetAllBlotterList?brcode=" + Session["BR"].ToString() + "&DataType=SBP" + "&CurrentDate=" + BlotterCurrentDate + "&LoadData=true");
                    }
                    else
                    {
                        response = serviceObj.GetResponse("/api/Blotter/GetAllBlotterList?brcode=" + Session["BR"].ToString() + "&DataType=SBP" + "&CurrentDate=" + BlotterCurrentDate + "&LoadData=false");
                    }
                    response.EnsureSuccessStatusCode();
                    List <Models.SP_SBPBlotter_Result> blotter = response.Content.ReadAsAsync <List <Models.SP_SBPBlotter_Result> >().Result;
                    // List<blotterMulit.GetAllBlotter01> blotter = response.Content.ReadAsAsync<List<Models.SP_SBPBlotter_Result>>().Result;
                    blotterMulit.GetAllBlotter01 = blotter;
                }
                else
                {
                    HttpResponseMessage response1 = serviceObj.GetResponse("/api/Blotter/GetAllBlotterFCYList?brcode=" + Session["BR"].ToString() + "&CurrId=" + selectCurrency + "&CurrentDate=" + BlotterCurrentDate);
                    response1.EnsureSuccessStatusCode();
                    List <Models.SP_SBPBlotter_FCY_Result> blotter = response1.Content.ReadAsAsync <List <Models.SP_SBPBlotter_FCY_Result> >().Result;
                    blotterMulit.GetAllBlotterFCY01 = blotter;
                }

                HttpResponseMessage response2 = serviceObj.GetResponse("/api/Blotter/GetLatestOpeningBalaceForToday?&BR=" + Session["BR"].ToString() + "&Date=" + BlotterCurrentDate);
                response2.EnsureSuccessStatusCode();
                Models.SBP_BlotterOpeningBalance BlotterOpeningBalaceForToday = response2.Content.ReadAsAsync <Models.SBP_BlotterOpeningBalance>().Result;

                ViewBag.SBP_BlotterOpeningBalaceForToday = BlotterOpeningBalaceForToday;
                ViewBag.Title            = "All Blotter";
                ViewData["SysCurrentDt"] = BlotterCurrentDate;
                return(PartialView("_GetAllBlotter", blotterMulit));
            }
            catch (Exception)
            {
                throw;
            }
        }