示例#1
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));
        }
示例#2
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"));
            }
        }