public ActionResult Create(InvCancel invCancel, string LstCancelDetail)
        {
            ICompanyService comSrv      = IoC.Resolve <ICompanyService>();
            Company         _currentCom = comSrv.Getbykey(((EInvoiceContext)FXContext.Current).CurrentCompany.id);

            invCancel.ComID      = _currentCom.id;
            invCancel.ComName    = _currentCom.Name;
            invCancel.ComTaxCode = _currentCom.TaxCode;
            invCancel.ComAddress = _currentCom.Address;
            if (string.IsNullOrWhiteSpace(LstCancelDetail))
            {
                CreateInvCancelModel md = new CreateInvCancelModel();
                md.CancelTemp = invCancel;
                IInvCategoryService _icateSer = IoC.Resolve <IInvCategoryService>();
                IList <InvCategory> lst       = _icateSer.GetAll();
                md.lstInvCategory = new SelectList(lst, "id", "Name");
                Messages.AddErrorMessage("Chưa chọn dải hóa đơn.");
                return(View(md));
            }
            invCancel.InvCancels = (IList <InvCancelDetails>)LstCancelDetail.DeserializeJSON <InvCancelDetails>(typeof(IList <InvCancelDetails>));
            IInvCancelService _invCancelSrv = IoC.Resolve <IInvCancelService>();
            string            errMes;

            if (_invCancelSrv.CancelInv(invCancel, out errMes))
            {
                StringBuilder strInfo = new StringBuilder();
                try
                {
                    for (int i = 0; i < invCancel.InvCancels.Count; i++)
                    {
                        strInfo.Append("----- pattern: " + invCancel.InvCancels[i].InvPattern + "    Serial: " + invCancel.InvCancels[i].InvSerial + "   From: " + invCancel.InvCancels[i].FromNo + "   To: " + invCancel.InvCancels[i].ToNo + "-------");
                    }
                }
                catch (Exception ex)
                {
                    log.Error(" Create -" + ex.Message);
                }
                log.Info("Cancel Range Invoice  by: " + HttpContext.User.Identity.Name + " Info-- Ngay Huy: " + invCancel.CancelDate + " Thong tin dai so: " + strInfo.ToString());
                Messages.AddFlashMessage(Resources.Message.ReCancel_MesSuccess);
                return(RedirectToAction("Index"));
            }
            CreateInvCancelModel model    = new CreateInvCancelModel();
            IInvCategoryService  icateSer = IoC.Resolve <IInvCategoryService>();
            IList <InvCategory>  list     = icateSer.GetAll();

            model.CancelTemp     = invCancel;
            model.lstInvCategory = new SelectList(list, "id", "Name");
            Messages.AddErrorMessage(Resources.Message.ReCancel_MesCanceled);
            return(View(model));
        }
        public ActionResult Create()
        {
            InvCancel            invc   = new InvCancel();
            CreateInvCancelModel model  = new CreateInvCancelModel();
            ICompanyService      comSrv = IoC.Resolve <ICompanyService>();
            Company _currentCom         = comSrv.Getbykey(((EInvoiceContext)FXContext.Current).CurrentCompany.id);

            invc.ComID      = _currentCom.id;
            invc.ComName    = _currentCom.Name;
            invc.ComTaxCode = _currentCom.TaxCode;
            invc.ComAddress = _currentCom.Address;
            IInvCategoryService _icateSer = IoC.Resolve <IInvCategoryService>();
            IList <InvCategory> lst       = _icateSer.GetAll();

            model.lstInvCategory = new SelectList(lst, "id", "Name");
            model.CancelTemp     = invc;
            return(View(model));
        }