示例#1
0
        public ActionResult Update(string counterPartyGroup, long counterPartyId, string cifCounterParty, int isInau)
        {
            TheSession.Remove(_strSectionProduct); //xóa section list product
            CPProductGetDetailViewModel input = new CPProductGetDetailViewModel();

            input.cifCounterParty   = cifCounterParty;
            input.counterPartyGroup = counterPartyGroup;
            input.counterPartyId    = counterPartyId;
            input.isInau            = isInau;
            input.userId            = RDAuthorize.UserId;
            var result = _cPProductService.getDetailCpProdCommis(input);

            #region
            CPProductViewModel model = new CPProductViewModel();
            List <CPProductImportProductModel>       productList   = new List <CPProductImportProductModel>();
            List <CPProductImportCommisionListModel> commisionList = new List <CPProductImportCommisionListModel>();
            List <AttachmentViewModel> fileList = new List <AttachmentViewModel>();

            if (result != null)
            {
                Library.TransferData(result, ref model);//main
            }

            if (result.fileList != null && result.fileList.Any())
            {
                Library.TransferData(result.fileList, ref fileList);
            }

            if (result.productList != null && result.productList.Any())
            {
                Library.TransferData(result.productList, ref productList);
                foreach (var item in result.productList)
                {
                    if (item.commisionList != null && item.commisionList.Any())
                    {
                        foreach (var item1 in item.commisionList)
                        {
                            CPProductImportCommisionListModel tempModel = new CPProductImportCommisionListModel();
                            Library.TransferData(item1, ref tempModel);
                            tempModel.SelectList  = productList;
                            tempModel.productCode = productList.SingleOrDefault(x => x.productId == tempModel.productId).productCode;
                            commisionList.Add(tempModel);
                        }
                    }
                }
            }
            model.commisionList = commisionList;
            model.productList   = productList;
            model.viewMode      = ViewModeCons.UPDATE;
            ViewBag.viewMode    = ViewModeCons.UPDATE;
            ViewBag.fileList    = fileList;
            #endregion
            return(View("Create", model));
        }
示例#2
0
        public ActionResult Create(string counterPartyGroup, long counterPartyId, string cifCounterParty)
        {
            CounterPartyGetDetailModel input = new CounterPartyGetDetailModel();

            input.counterPartyId  = counterPartyId;
            input.cifCounterParty = cifCounterParty;
            input.userId          = RDAuthorize.UserId;
            var result = _counterPartyService.getDetailCounterParty(input);
            CPProductViewModel model = new CPProductViewModel();

            Library.TransferData(result, ref model);
            TheSession.Remove(_strSectionProduct); //xóa section truoc
            return(View(model));
        }