Example #1
0
        public ActionResult DeleteDecision(int id)
        {
            if (id <= 0)
            {
                throw new HttpRequestValidationException();
            }
            IDecisionService decSrc = IoC.Resolve <IDecisionService>();
            Decision         model  = decSrc.Getbykey(id);

            try
            {
                if (model.Status == 0)
                {
                    decSrc.Delete(model);
                    decSrc.CommitChanges();
                    Messages.AddFlashMessage(Resources.Message.Dec_DMesSuccess);
                    log.Info("Delete Decision by: " + HttpContext.User.Identity.Name);
                }
                else
                {
                    Messages.AddFlashMessage(Resources.Message.Dec_DMesCantDel);
                }
            }
            catch (Exception ex)
            {
                Messages.AddErrorFlashMessage(Resources.Message.Dec_DMesUnsuccess);
                log.Error("DeleteDecision -" + ex);
            }
            return(RedirectToAction("ListDecision"));
        }
Example #2
0
        public ActionResult EditStatus(int id)
        {
            if (id <= 0)
            {
                throw new HttpRequestValidationException();
            }
            IDecisionService decSrc = IoC.Resolve <IDecisionService>();
            Decision         dec    = decSrc.Getbykey(id);

            try
            {
                string ErrMessage = "";
                if (dec.Status == 0)
                {
                    if (decSrc.SendDecision(dec, out ErrMessage) == true)
                    {
                        Messages.AddFlashMessage("Quyết định đã được gửi");
                    }
                    else
                    {
                        Messages.AddErrorFlashMessage(ErrMessage);
                    }
                }
                else if (dec.Status == 1)
                {
                    if (decSrc.ApproveDecision(dec, out ErrMessage))
                    {
                        Messages.AddFlashMessage("Quyết định đã được cơ quan thuế chấp nhận!");
                    }
                    else
                    {
                        Messages.AddErrorFlashMessage(ErrMessage);
                    }
                }
            }
            catch (Exception ex)
            {
                Messages.AddFlashException(ex);
                log.Error("EditStatus-" + ex.Message);
            }
            return(RedirectToAction("DetailsDecision/" + id + ""));
        }
Example #3
0
        public ActionResult DetailsDecision(int id)
        {
            if (id <= 0)
            {
                throw new HttpRequestValidationException();
            }
            IDecisionService     decSrc          = IoC.Resolve <IDecisionService>();
            ICompanyService      _comSrv         = IoC.Resolve <ICompanyService>();
            Company              _currentcompany = _comSrv.Getbykey(((EInvoiceContext)FXContext.Current).CurrentCompany.id);
            IRegisterTempService regisSrc        = IoC.Resolve <IRegisterTempService>();
            Decision             model           = decSrc.Getbykey(id);

            //lấy thông tin ve mẫu phát hành
            string   arr  = model.Purpose;
            XElement elem = XElement.Parse(arr);
            IEnumerable <XElement> list = (from c in elem.Elements("Purpose") select c).ToList <XElement>();
            IList <Pupor>          lstp = new List <Pupor>();
            string pt = model.ListInvPattern;

            string[]            str = pt.Split(',');
            List <RegisterTemp> qr  = (from r in regisSrc.Query where str.Contains(r.InvPattern) && r.ComId == _currentcompany.id select r).ToList();
            int i = 0;

            if (i < list.Count())
            {
                foreach (XElement xe in list)
                {
                    Pupor p = new Pupor();
                    p.Mucdich     = xe.Value;
                    p.InvPattern  = qr[i].InvPattern;
                    p.InvCateName = qr[i].InvoiceTemp.InvCateName;
                    lstp.Add(p);
                    i++;
                }
            }
            ViewData["Data"] = lstp;
            //end
            //string mmddyy = model.EffectiveDate.Day.ToString() + "/" + model.EffectiveDate.Month.ToString() + "/" + model.EffectiveDate.Year.ToString();
            //ViewData["mmddyy"] = mmddyy;
            return(View(model));
        }
Example #4
0
        public ActionResult EditDecision(int id)
        {
            IDecisionService     decSrc          = IoC.Resolve <IDecisionService>();
            Company              _currentcompany = IoC.Resolve <ICompanyService>().Getbykey(((EInvoiceContext)FXContext.Current).CurrentCompany.id);
            IRegisterTempService regisSrc        = IoC.Resolve <IRegisterTempService>();

            Decision oDec = decSrc.Getbykey(id);
            //khoi tao mot decision models
            DecisionModels model = new DecisionModels();

            model.City            = oDec.City;
            model.ComAddress      = oDec.ComAddress;
            model.ComID           = oDec.ComID;
            model.ComName         = oDec.ComName;
            model.DecisionNo      = oDec.DecisionNo;
            model.Director        = oDec.Director;
            model.EffectiveDate   = oDec.EffectiveDate;
            model.EffectDate      = oDec.EffectDate;
            model.id              = oDec.id;
            model.ParentCompany   = oDec.ParentCompany;
            model.Requester       = oDec.Requester;
            model.SystemName      = oDec.SystemName;
            model.SoftApplication = oDec.SoftApplication;
            model.TechDepartment  = oDec.TechDepartment;
            model.Workflow        = oDec.Workflow;
            model.Responsibility  = oDec.Responsibility;
            model.Destination     = oDec.Destination;
            model.RegTempList     = new SelectList(from re in regisSrc.Query where re.ComId == _currentcompany.id select re, "InvPattern", "InvPattern");
            //lấy thông tin về mẫu hóa đơn
            string   arr  = oDec.Purpose;
            XElement elem = XElement.Parse(arr);
            IEnumerable <XElement> list = (from c in elem.Elements("Purpose") select c).ToList <XElement>();
            IList <Pupor>          lstp = new List <Pupor>();
            string pt = oDec.ListInvPattern;

            string[]            str = pt.Split(',');
            List <RegisterTemp> qr  = (from r in regisSrc.Query where str.Contains(r.InvPattern) && r.ComId == _currentcompany.id select r).ToList();
            int i = 0;

            if (i < list.Count())
            {
                foreach (XElement xe in list)
                {
                    Pupor p = new Pupor();
                    p.Mucdich     = xe.Value;
                    p.InvPattern  = qr[i].InvPattern;
                    p.InvCateName = qr[i].InvoiceTemp.InvCateName;
                    lstp.Add(p);
                    i++;
                }
            }
            model.DecDatasource = lstp.SerializeJSON <Pupor>();
            //end
            if (oDec.Status != 2)
            {
                model.TaxCode = _currentcompany.TaxCode;
                return(View(model));
            }
            else
            {
                return(RedirectToAction("ListDecision"));
            }
        }