Exemplo n.º 1
0
 public ActionResult Insert(GstViewModel objViewModel)
 {
     ModelState.Remove("Id");
     if (objViewModel.EditID == 0)
     {
         if (InsertData(objViewModel))
         {
             return(Json(1, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(3, JsonRequestBehavior.AllowGet));
         }
     }
     else
     {
         if (InsertData(objViewModel))
         {
             return(Json(2, JsonRequestBehavior.AllowGet));
         }
     }
     ViewBag.GSTAccountList  = new SelectList(_gstService.GSTAccountList(), "AccountID", "Name");
     ViewBag.IGSTAccountList = new SelectList(_gstService.GSTAccountList(), "AccountID", "Name");
     return(View("Index", objViewModel));
 }
Exemplo n.º 2
0
        public JsonResult CreateEdit(GstViewModel gst)
        {
            gst.CreatedBy = Convert.ToInt32(Session["UserLoginId"]);
            gst.UpdatedBy = Convert.ToInt32(Session["UserLoginId"]);
            Mst_GstMaster tblGst = new Mst_GstMaster();

            try
            {
                gst.ID = dd._context.Mst_GstMaster.Any() ? dd._context.Mst_GstMaster.Max(m => m.Gst_RefId) + 1 : 1;
                if (gst.EditID <= 0)
                {
                    tblGst.Gst_RefId           = gst.ID;
                    tblGst.Gst_RecordCreated   = DateTime.Now;
                    tblGst.Gst_RecordCreatedBy = gst.CreatedBy;
                    dd._context.Mst_GstMaster.Add(tblGst);
                }
                else
                {
                    tblGst = dd._context.Mst_GstMaster.Where(x => x.Gst_RefId == gst.ID).FirstOrDefault();
                }
                tblGst.Gst_EffectiveFrom   = gst.EffectiveFrom;
                tblGst.Gst_CGST            = gst.CGST;
                tblGst.Gst_SGST            = gst.SGST;
                tblGst.Gst_IGST            = gst.IGST;
                tblGst.Gst_RecordUpdated   = DateTime.Now;
                tblGst.Gst_RecordUpdatedBy = gst.UpdatedBy;
                dd._context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(Json(gst));
        }
Exemplo n.º 3
0
        public ActionResult Insert(GstViewModel objViewModel)
        {
            ModelState.Remove("Id");
            if (objViewModel.ID == 0)
            {
                //_employeeService.AddEmployee(objViewModel);

                if (InsertData(objViewModel))
                {
                    return(Json(1, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(3, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                if (InsertData(objViewModel))
                {
                    return(Json(2, JsonRequestBehavior.AllowGet));
                }
            }
            return(View("Index", objViewModel));
        }
Exemplo n.º 4
0
        public void SaveUpdateRecord(GstViewModel gstvm)
        {
            Mst_GstMaster tblGst = new Mst_GstMaster();

            if (gstvm.EditID <= 0)
            {
                gstvm.ID                   = _context.Mst_GstMaster.Any() ? _context.Mst_GstMaster.Max(m => m.Gst_RefId) + 1 : 1;
                tblGst.Gst_RefId           = gstvm.ID;
                tblGst.Gst_RecordCreated   = DateTime.Now;
                tblGst.Gst_RecordCreatedBy = gstvm.CreatedBy;
                _context.Mst_GstMaster.Add(tblGst);
            }
            else
            {
                tblGst = _context.Mst_GstMaster.Where(x => x.Gst_RefId == gstvm.ID).FirstOrDefault();
            }
            tblGst.Gst_EffectiveFrom   = Convert.ToDateTime(gstvm.EffectiveFrom);
            tblGst.Gst_CGST            = gstvm.CGST;
            tblGst.Gst_SGST            = gstvm.SGST;
            tblGst.Gst_IGST            = gstvm.IGST;
            tblGst.Gst_CgstAccountId   = gstvm.CGSTAccountNo;
            tblGst.Gst_SgstAccountId   = gstvm.SGSTAccountNo ?? 0;
            tblGst.Gst_RecordUpdated   = DateTime.Now;
            tblGst.Gst_RecordUpdatedBy = gstvm.UpdatedBy;
            _context.SaveChanges();
        }
Exemplo n.º 5
0
        public ActionResult GST()
        {
            ButtonVisiblity("Index");
            var model = new GstViewModel();

            model.EffectiveFrom = DateTime.Now;
            model.ID            = dd._context.Mst_GstMaster.Any() ? dd._context.Mst_GstMaster.Max(m => m.Gst_RefId) + 1 : 1;
            return(View(model));
        }
Exemplo n.º 6
0
        public ActionResult GST()
        {
            ButtonVisiblity("Index");
            var model = new GstViewModel();

            model.ID = _gstService.GetMaxId();
            ViewBag.GSTAccountList = new SelectList(_gstService.GSTAccountList(), "AccountID", "Name");
            return(View(model));
        }
Exemplo n.º 7
0
        public GstViewModel SetRecordinEdit(Mst_GstMaster tblGst)
        {
            GstViewModel gstvm = new GstViewModel();

            gstvm.ID            = tblGst.Gst_RefId;
            gstvm.EditID        = tblGst.Gst_RefId;
            gstvm.EffectiveFrom = tblGst.Gst_EffectiveFrom.ToShortDateString();
            gstvm.CGST          = tblGst.Gst_CGST;
            gstvm.SGST          = tblGst.Gst_SGST;
            gstvm.IGST          = tblGst.Gst_IGST;
            gstvm.CGSTAccountNo = tblGst.Gst_CgstAccountId;
            gstvm.SGSTAccountNo = tblGst.Gst_SgstAccountId;
            return(gstvm);
        }
Exemplo n.º 8
0
        public ActionResult GetGSTById(int ID)
        {
            string operation = Session["Operation"].ToString();

            ButtonVisiblity(operation);
            Mst_GstMaster tblGst = dd._context.Mst_GstMaster.Where(x => x.Gst_RefId == ID).FirstOrDefault();
            GstViewModel  gstvm  = new GstViewModel();

            gstvm.ID            = tblGst.Gst_RefId;
            gstvm.EditID        = tblGst.Gst_RefId;
            gstvm.EffectiveFrom = tblGst.Gst_EffectiveFrom;
            gstvm.CGST          = tblGst.Gst_CGST;
            gstvm.SGST          = tblGst.Gst_SGST;
            gstvm.IGST          = tblGst.Gst_IGST;
            gstvm.operation     = operation;
            return(View("GST", gstvm));
        }
Exemplo n.º 9
0
        public ActionResult GetGSTById(int ID)
        {
            string operation = Session["Operation"].ToString();

            ButtonVisiblity(operation);
            var tblgst = _gstService.GetGSTById(ID);
            var gstvm  = new GstViewModel();

            if (tblgst != null)
            {
                gstvm = _gstService.SetDataOnEdit(tblgst);
            }
            gstvm.operation         = operation;
            ViewBag.GSTAccountList  = new SelectList(_gstService.GSTAccountList(), "AccountID", "Name");
            ViewBag.IGSTAccountList = new SelectList(_gstService.GSTAccountList(), "AccountID", "Name");
            return(View("GST", gstvm));
        }
Exemplo n.º 10
0
        public bool InsertData(GstViewModel gstvm)
        {
            bool retVal = false;

            gstvm.CreatedBy = Convert.ToInt32(Session["UserLoginId"]);
            gstvm.UpdatedBy = Convert.ToInt32(Session["UserLoginId"]);
            try
            {
                _gstService.SaveUpdateRecord(gstvm);
                retVal = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(retVal);
        }
Exemplo n.º 11
0
        public List <GstViewModel> GetAllGSTMasters()
        {
            List <GstViewModel> list = new List <GstViewModel>();
            var tbllist = _context.Mst_GstMaster.ToList();

            foreach (var item in tbllist)
            {
                GstViewModel gstvm = new GstViewModel();
                gstvm.ID              = item.Gst_RefId;
                gstvm.EditID          = item.Gst_RefId;
                gstvm.EffectiveFrom   = item.Gst_EffectiveFrom.ToShortDateString();
                gstvm.CGST            = item.Gst_CGST;
                gstvm.SGST            = item.Gst_SGST;
                gstvm.IGST            = item.Gst_IGST;
                gstvm.CGSTAccountNo   = item.Gst_CgstAccountId;
                gstvm.SGSTAccountNo   = item.Gst_SgstAccountId;
                gstvm.CGSTAccountName = _context.tblaccountmasters.Where(x => x.AccountID == item.Gst_CgstAccountId).Select(x => x.Name).FirstOrDefault();
                gstvm.SGSTAccountName = _context.tblaccountmasters.Where(x => x.AccountID == item.Gst_SgstAccountId).Select(x => x.Name).FirstOrDefault();
                list.Add(gstvm);
            }
            return(list);
        }
Exemplo n.º 12
0
        public bool InsertData(GstViewModel gstvm)
        {
            bool retVal = false;

            gstvm.CreatedBy = Convert.ToInt32(Session["UserLoginId"]);
            gstvm.UpdatedBy = Convert.ToInt32(Session["UserLoginId"]);
            Mst_GstMaster tblGst = new Mst_GstMaster();

            try
            {
                gstvm.ID = dd._context.Mst_GstMaster.Any() ? dd._context.Mst_GstMaster.Max(m => m.Gst_RefId) + 1 : 1;
                if (gstvm.EditID <= 0)
                {
                    tblGst.Gst_RefId           = gstvm.ID;
                    tblGst.Gst_RecordCreated   = DateTime.Now;
                    tblGst.Gst_RecordCreatedBy = gstvm.CreatedBy;
                    dd._context.Mst_GstMaster.Add(tblGst);
                }
                else
                {
                    tblGst = dd._context.Mst_GstMaster.Where(x => x.Gst_RefId == gstvm.ID).FirstOrDefault();
                }
                tblGst.Gst_EffectiveFrom   = gstvm.EffectiveFrom;
                tblGst.Gst_CGST            = gstvm.CGST;
                tblGst.Gst_SGST            = gstvm.SGST;
                tblGst.Gst_IGST            = gstvm.IGST;
                tblGst.Gst_RecordUpdated   = DateTime.Now;
                tblGst.Gst_RecordUpdatedBy = gstvm.UpdatedBy;
                dd._context.SaveChanges();
                retVal = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(retVal);
        }
Exemplo n.º 13
0
 public void SaveUpdateRecord(GstViewModel model)
 {
     _gstRepository.SaveUpdateRecord(model);
 }