Example #1
0
        public ActionResult EditPrice(int priceListId)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"]      = cm.FaceBook;
            Session["Twitter"]       = cm.Twitter;
            Session["Youtube"]       = cm.Youtube;
            Session["Instagram"]     = cm.Instagram;
            Session["PhoneNumber"]   = cm.PhoneNumber;
            Session["Email"]         = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            PriceDataService dataService = new PriceDataService();
            PriceListModel   model       = new PriceListModel();

            try
            {
                model = dataService.GetPriceListById(priceListId);
                return(View(model));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dataService = null;
            }
        }
Example #2
0
        public IActionResult PriceList()
        {
            var prices = new List <PriceListModel>();

            var price1 = new PriceListModel
            {
                Service = "Oil Change",
                Info    = "Car Running Smooth",
                Price   = "3.50"
            };

            var price2 = new PriceListModel
            {
                Service = "Mow Lawn",
                Info    = "Grass so Short",
                Price   = "3.50"
            };

            var price3 = new PriceListModel
            {
                Service = "Workout Partner",
                Info    = "Body so Fit",
                Price   = "3.50"
            };

            prices.Add(price1);
            prices.Add(price2);
            prices.Add(price3);

            return(View(prices));
        }
Example #3
0
        public ActionResult AddPrice(PriceListModel pcm)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"]      = cm.FaceBook;
            Session["Twitter"]       = cm.Twitter;
            Session["Youtube"]       = cm.Youtube;
            Session["Instagram"]     = cm.Instagram;
            Session["PhoneNumber"]   = cm.PhoneNumber;
            Session["Email"]         = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            PriceDataService dataService = new PriceDataService();

            try
            {
                dataService.InsertPriceList(pcm);
                return(RedirectToAction("Edit", "Price"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dataService = null;
            }
        }
Example #4
0
        public List <PriceListModel> GetPriceListByProductCategoryId(int productCategoryId)
        {
            List <PriceListModel> modelList = new List <PriceListModel>();
            PriceListModel        model     = new PriceListModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var list = from p in vdc.PriceLists.ToList()
                               where p.ProductCategoryId == productCategoryId
                               orderby p.PriceListId ascending
                               select p;

                    foreach (var item in list)
                    {
                        model                    = new PriceListModel();
                        model.PriceListId        = item.PriceListId;
                        model.ProductCategoryId  = item.ProductCategoryId;
                        model.ProductName        = item.ProductName;
                        model.ProductDescription = item.ProductDescription;
                        model.Price              = item.Price;
                        modelList.Add(model);
                    }


                    return(modelList);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        public PriceListModel GetPriceListById(int priceListId)
        {
            PriceListModel model = new PriceListModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var list = from p in vdc.PriceLists.ToList()
                               where p.PriceListId == priceListId
                               select p;
                    if (list != null)
                    {
                        model.PriceListId        = list.FirstOrDefault().PriceListId;
                        model.ProductCategoryId  = list.FirstOrDefault().ProductCategoryId;
                        model.ProductName        = list.FirstOrDefault().ProductName;
                        model.ProductDescription = list.FirstOrDefault().ProductDescription;
                        model.Price = list.FirstOrDefault().Price;
                    }

                    return(model);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #6
0
         public PriceListViewModels()
         {
             this._view = new TViewType();
 
             this._modelPriceListModel = new PriceListModel();
             this.PriceListObservableCollection = new ObservableCollection<PriceList>(this._modelPriceListModel.GetService());
 
             this._modelPriceModel = new PriceModel();
             this.PriceObservableCollection = new ObservableCollection<Price>(this._modelPriceModel.GetPrice());
 
             this._modelNewServInPriceListModel = new NewServInPriceListModel();
             this.NewServObServableCollection = new ObservableCollection<NewServInPriceList>(this._modelNewServInPriceListModel.GetNewServ());
             this.CommandSave = new RelayCommand(o => this.OKRun());
 
 
             // присваиваем collview observable collection 
             collview = (CollectionView)CollectionViewSource.GetDefaultView(NewServObServableCollection);
 
             // задаем начальные значения для DateTimePicker
             _dateTimeBeginPriceList = DateTime.Today.AddDays(-1);
             _dateTimeEndPriceList =  new DateTime(2016, 05, 28);
 
             _displayRadioButton = true;
 
             _contentButtonDisplaySearch = "Найти";
                     
             this._view.SetDataContext(this);
             this._view.ShowIView();
         }
Example #7
0
        public ActionResult Index()
        {
            var data  = _priceListBLL.GetPriceList();
            var model = new PriceListModel();

            model.Details = Mapper.Map <List <PriceListItem> >(data);
            foreach (PriceListItem detail in model.Details)
            {
                detail.VendorName = _vendorBLL.GetByID(detail.Vendor) == null ? string.Empty : _vendorBLL.GetByID(detail.Vendor).VendorName;
            }
            model.MainMenu          = _mainMenu;
            model.CurrentLogin      = CurrentUser;
            model.CurrentPageAccess = CurrentPageAccess;
            if (CurrentUser.UserRole == Enums.UserRole.Viewer)
            {
                model.IsShowNewButton = false;
                model.IsNotViewer     = false;
            }
            else
            {
                model.IsShowNewButton = true;
                model.IsNotViewer     = true;
            }
            return(View(model));
        }
Example #8
0
        public PriceListModel Parse(UserInputMessage message)
        {
            using (var package = new ExcelPackage(new FileInfo(message.FileUrl)))
            {
                var result = new PriceListModel
                {
                    Items = new List <PriceListItemModel>()
                };

                var sheet = package.Workbook.Worksheets.FirstOrDefault();
                if (sheet == null)
                {
                    throw new FileNotFoundException($"file {message.FileUrl} not found or does not have any sheets");
                }
                var rowCnt = sheet?.Dimension?.End?.Row ?? 0;

                for (int rowNum = 1; rowNum < rowCnt + 1; rowNum++)
                {
                    var row = new FileRow
                    {
                        Id    = sheet.Cells[rowNum, message.TitleColumn].Value?.ToString(),
                        Price = sheet.Cells[rowNum, message.PriceColumn].Value?.ToString()
                    };

                    var rowModel = _parseInputRowService.ParsePriceFromRow(row);

                    if (rowModel != null)
                    {
                        result.Items.Add(rowModel);
                    }
                }

                return(result);
            }
        }
Example #9
0
 public frmEditProductPriceList(PriceListModel _pricelist)
 {
     InitializeComponent();
     if (_pricelist.Type == "MODIFIRE")
     {
         btnSave.Tag            = _pricelist;
         txtProductName.Text    = _pricelist.NameDesc;
         txtProductPrice.Text   = (_pricelist.CurrentPrice / 1000).ToString();
         txtProductSize.Text    = _pricelist.Portions;
         txtProductSize.Enabled = false;
         cbColor.Text           = _pricelist.Color;
         label1.Text            = "Modifire Name";
         label2.Text            = "Modifire Size";
         label3.Text            = "Modifire Price";
         label5.Text            = "Modifire Color";
     }
     else
     {
         btnSave.Tag            = _pricelist;
         txtProductName.Text    = _pricelist.NameDesc;
         txtProductPrice.Text   = (_pricelist.CurrentPrice / 1000).ToString();
         txtProductSize.Text    = _pricelist.Portions;
         cbColor.Text           = _pricelist.Color;
         txtProductSize.Enabled = false;
     }
 }
Example #10
0
        public ActionResult Upload()
        {
            var model = new PriceListModel();

            model.MainMenu     = _mainMenu;
            model.CurrentLogin = CurrentUser;
            return(View(model));
        }
        public async Task <ActionResult> Edit([Bind(Include = "Id,Title,Description,Price")] PriceListModel priceListModel)
        {
            if (ModelState.IsValid)
            {
                db.Entry(priceListModel).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(priceListModel));
        }
        public List <KeyValuePair <string, object> > GetPaymentModesListDefaultValue(PriceListModel model)
        {
            var unit = TouristUnitRepository.GetTouristUnit(model.SiteCode, model.OfferCode);
            var list = new List <KeyValuePair <string, object> >();

            list.Add(new KeyValuePair <string, object>("BookingFromDate", "12.09.2017"));
            list.Add(new KeyValuePair <string, object>("BookingToDate", unit.CloseDate));
            list.Add(new KeyValuePair <string, object>("CheckInFromDate", unit.OpenDate));
            list.Add(new KeyValuePair <string, object>("CheckInToDate", unit.CloseDate));

            return(list);
        }
Example #13
0
        public CompareResult CompareTables(PriceListModel oldPrice, PriceListModel newPrice)
        {
            var items = oldPrice.Items.FullOuterJoin(newPrice.Items, x => x.Product.Id, x => x.Product.Id,
                                                     (row, priceRow, id) => new CompareResultItem
            {
                OldPrice = row,
                NewPrice = priceRow
            },
                                                     null, null, StringComparer.InvariantCultureIgnoreCase);

            return(new CompareResult(items));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,Title,Description,Price")] PriceListModel priceListModel)
        {
            if (ModelState.IsValid)
            {
                db.PriceListModels.Add(priceListModel);
                await db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            return(View(priceListModel));
        }
        public List <KeyValuePair <string, object> > GetConditionsListDefaultValue(PriceListModel model)
        {
            var unit = TouristUnitRepository.GetTouristUnit(model.SiteCode, model.OfferCode);
            var list = new List <KeyValuePair <string, object> >();

            list.Add(new KeyValuePair <string, object>("FromDate", unit.OpenDate));
            list.Add(new KeyValuePair <string, object>("ToDate", unit.CloseDate));
            list.Add(new KeyValuePair <string, object>("MinStay", 7));
            list.Add(new KeyValuePair <string, object>("ReleaseDays", 7));
            list.Add(new KeyValuePair <string, object>("ArrivalActual", 5));
            list.Add(new KeyValuePair <string, object>("DepartureActual", 5));

            return(list);
        }
        public List <KeyValuePair <string, object> > GetActionsListDefaultValue(PriceListModel model)
        {
            var unit = TouristUnitRepository.GetTouristUnit(model.SiteCode, model.OfferCode);
            var list = new List <KeyValuePair <string, object> >();

            list.Add(new KeyValuePair <string, object>("ActionStart", "12.09.2017"));
            list.Add(new KeyValuePair <string, object>("ActionEnd", unit.CloseDate));
            list.Add(new KeyValuePair <string, object>("FromDate", unit.OpenDate));

            if (model.ServicesList.Count == 0)
            {
                list.Add(new KeyValuePair <string, object>("ActionType", "EarlyBooking"));
                list.Add(new KeyValuePair <string, object>("DiscountPercent", 10));
            }
            return(list);
        }
Example #17
0
        void ucPriceList_Click(object sender, EventArgs e)
        {
            UCPriceList    ucPriceList = (UCPriceList)sender;
            PriceListModel tag         = (PriceListModel)(ucPriceList.Tag);

            foreach (Control ctr in flpMenuList.Controls)
            {
                if (ctr.BackColor == Color.FromArgb(0, 153, 51))
                {
                    ctr.BackColor = Color.FromArgb(255, 255, 255);
                    ctr.ForeColor = Color.FromArgb(51, 51, 51);
                }
            }
            ucPriceList.BackColor = Color.FromArgb(0, 153, 51);
            ucPriceList.ForeColor = Color.FromArgb(255, 255, 255);
            pnDetail.Controls.Clear();
            addButtonPriceList(tag);
        }
Example #18
0
 public void UpdatePriceList(PriceListModel model)
 {
     try
     {
         PriceList table = new PriceList();
         using (VenturadaDataContext vdc = new VenturadaDataContext())
         {
             table = vdc.PriceLists.Single(a => a.PriceListId == model.PriceListId);
             table.ProductDescription = model.ProductDescription;
             table.ProductName        = model.ProductName;
             table.Price = model.Price;
             vdc.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public List <KeyValuePair <string, object> > GetSeasonAndPriceDefaultValue(PriceListModel model)
        {
            var unit = TouristUnitRepository.GetTouristUnit(model.SiteCode, model.OfferCode);
            var ret  = new List <KeyValuePair <string, object> >();

            ret.Add(new KeyValuePair <string, object>("FromPersons", 1));
            ret.Add(new KeyValuePair <string, object>("ToPersons", unit.MaxPersons));
            ret.Add(new KeyValuePair <string, object>("PriceType", PriceType.UnitPerNight));

            if (model.SeasonPriceList.Count > 0)
            {
                ret.Add(new KeyValuePair <string, object>("FromDate", model.SeasonPriceList.Max(r => r.ToDate).AddDays(1)));
            }
            else
            {
                ret.Add(new KeyValuePair <string, object>("FromDate", unit.OpenDate));
            }
            return(ret);
        }
Example #20
0
        public ActionResult EditPrice(PriceListModel plm)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"]      = cm.FaceBook;
            Session["Twitter"]       = cm.Twitter;
            Session["Youtube"]       = cm.Youtube;
            Session["Instagram"]     = cm.Instagram;
            Session["PhoneNumber"]   = cm.PhoneNumber;
            Session["Email"]         = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            PriceDataService dataService = new PriceDataService();
            PriceListModel   model       = new PriceListModel();

            try
            {
                if (ModelState.IsValid)
                {
                    model.PriceListId        = plm.PriceListId;
                    model.ProductName        = plm.ProductName;
                    model.ProductDescription = plm.ProductDescription;
                    model.Price = plm.Price;
                    dataService.UpdatePriceList(model);
                    return(RedirectToAction("Edit", "Price"));
                }
                else
                {
                    return(View(plm));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dataService = null;
            }
        }
        public List <KeyValuePair <string, object> > GetServicesListeDefaultValue(PriceListModel model)
        {
            var unit = TouristUnitRepository.GetTouristUnit(model.SiteCode, model.OfferCode);
            var ret  = new List <KeyValuePair <string, object> >();

            ret.Add(new KeyValuePair <string, object>("FromDate", unit.OpenDate));
            ret.Add(new KeyValuePair <string, object>("ToDate", unit.CloseDate));

            if (model.ServicesList.Count == 0)
            {
                ret.Add(new KeyValuePair <string, object>("ServiceType", ServiceType.RegistrationFee));
                ret.Add(new KeyValuePair <string, object>("ServiceInterval", ServiceInterval.PerStay));
                ret.Add(new KeyValuePair <string, object>("ServiceUnit", ServiceUnit.PerPerson));
                ret.Add(new KeyValuePair <string, object>("PaymentPlace", PaymentPlace.Arrival));
                ret.Add(new KeyValuePair <string, object>("Description", "Anmeldegebühr"));
                ret.Add(new KeyValuePair <string, object>("Eur", 1));
            }
            if (model.ServicesList.Count == 1 || model.ServicesList.Count == 2)
            {
                ret.Add(new KeyValuePair <string, object>("ServiceType", ServiceType.Tax));
                ret.Add(new KeyValuePair <string, object>("ServiceInterval", ServiceInterval.PerDay));
                ret.Add(new KeyValuePair <string, object>("ServiceUnit", ServiceUnit.PerPerson));
                ret.Add(new KeyValuePair <string, object>("PaymentPlace", PaymentPlace.Arrival));
                ret.Add(new KeyValuePair <string, object>("Description", "Kurtaxe"));


                if (model.ServicesList.Count == 1)
                {
                    ret.Add(new KeyValuePair <string, object>("Eur", "0,55"));
                    ret.Add(new KeyValuePair <string, object>("OfOld", 12));
                    ret.Add(new KeyValuePair <string, object>("ToOld", 18));
                }
                if (model.ServicesList.Count == 2)
                {
                    ret.Add(new KeyValuePair <string, object>("Eur", "1,10"));
                    ret.Add(new KeyValuePair <string, object>("OfOld", 18));
                    ret.Add(new KeyValuePair <string, object>("ToOld", 99));
                }
            }
            return(ret);
        }
Example #22
0
        public void InsertPriceList(PriceListModel model)
        {
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    PriceList table = new PriceList();
                    table.ProductCategoryId  = model.ProductCategoryId;
                    table.ProductName        = model.ProductName;
                    table.ProductDescription = model.ProductDescription;
                    table.Price = model.Price;

                    vdc.PriceLists.InsertOnSubmit(table);
                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #23
0
        void btnGoToProduct_Click(object sender, EventArgs e)
        {
            Button         btn  = (Button)sender;
            PriceListModel data = (PriceListModel)(btn.Tag);

            if (data.NameDesc == null)
            {
                string      title       = "Waring.";
                string      description = "Please choose product.";
                frmMessager frmMessager = new frmMessager(title, description);
                frmOpacity.ShowDialog(this, frmMessager);
            }
            else
            {
                frmEditProductPriceList frmEditProductPriceList = new frmEditProductPriceList(data);
                if (frmEditProductPriceList.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    addPriceList(5, this.CurrentPage);
                }
            }
        }
Example #24
0
        public PriceListModel Parse(UserInputMessage message)
        {
            FileStream stream = File.Open(message.FileUrl, FileMode.Open, FileAccess.Read);

            //Choose one of either 1 or 2
            //1. Reading from a binary Excel file ('97-2003 format; *.xls)
            using (IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream))
            {
                //Choose one of either 3, 4, or 5
                //3. DataSet - The result of each spreadsheet will be created in the result.Tables
                DataSet table = excelReader.AsDataSet();


                var rowCnt = table.Tables[0].Rows.Count;
                var result = new PriceListModel
                {
                    Items = new List <PriceListItemModel>()
                };

                for (int rowNum = 0; rowNum < rowCnt; rowNum++)
                {
                    var row = new FileRow
                    {
                        Id    = table.Tables[0].Rows[rowNum].ItemArray[message.TitleColumn - 1]?.ToString(),
                        Price = table.Tables[0].Rows[rowNum].ItemArray[message.PriceColumn - 1]?.ToString()
                    };

                    var rowModel = _parseInputRowService.ParsePriceFromRow(row);

                    if (rowModel != null)
                    {
                        result.Items.Add(rowModel);
                    }
                }


                return(result);
            }
        }
Example #25
0
        public void addPriceList(int i, int CurrentPage)
        {
            txtSearch.Visible = false;
            btnAdd.Enabled    = false;
            btBack.Tag        = i;
            btNext.Tag        = i;
            if (this.TotalPage == 0)
            {
                this.TotalPage = PriceListSerice.GetTotalProductAndModifire();
            }
            var data = PriceListSerice.GetDataProductAndModifire(CurrentPage);

            if (i == 5)
            {
                this.ResizeTopriceList();
                flpMenuList.Controls.Clear();
                // txtNameMenuList.Visible = false;
                ucPriceListTitle.Visible   = true;
                ucPriceListTitle.BackColor = Color.FromArgb(0, 102, 204);
                ucPriceListTitle.ForeColor = Color.FromArgb(255, 255, 255);
                ucPriceListTitle.Dock      = DockStyle.Fill;
                foreach (var strPriceList in data)
                {
                    UCPriceList ucPriceList = new UCPriceList();
                    ucPriceList.lblPriceNameProduct.Text = strPriceList.NameDesc;
                    ucPriceList.lblPriceSizeProduct.Text = strPriceList.Portions;
                    ucPriceList.lblPriceProduct.Text     = money.Format2(strPriceList.CurrentPrice.ToString());
                    ucPriceListTitle.Size = new System.Drawing.Size(NewWidthPn2, ucPriceList.Height);
                    //ucPriceList.Dock = DockStyle.Fill;
                    ucPriceList.Tag    = strPriceList;
                    ucPriceList.Width  = flpMenuList.Width;
                    ucPriceList.Click += ucPriceList_Click;
                    flpMenuList.Controls.Add(ucPriceList);
                }
                PriceListModel pricelistmodel = new PriceListModel();
                addButtonPriceList(pricelistmodel);
            }
        }
Example #26
0
        public ActionResult Upload(PriceListModel Model)
        {
            if (ModelState.IsValid)
            {
                foreach (PriceListItem data in Model.Details)
                {
                    try
                    {
                        data.CreatedDate  = DateTime.Now;
                        data.CreatedBy    = CurrentUser.USERNAME;
                        data.ModifiedDate = null;

                        if (data.ErrorMessage == "" | data.ErrorMessage == null)
                        {
                            var dto = Mapper.Map <PriceListDto>(data);

                            _priceListBLL.Save(dto);
                        }
                        else
                        {
                            throw new HttpException();
                        }

                        AddMessageInfo(Constans.SubmitMessage.Saved, Enums.MessageInfoType.Success);
                    }
                    catch (HttpException)
                    {
                        AddMessageInfo(data.ErrorMessage, Enums.MessageInfoType.Error);
                    }
                    catch (Exception exception)
                    {
                        AddMessageInfo(exception.Message, Enums.MessageInfoType.Error);
                        return(View(Model));
                    }
                }
            }
            return(RedirectToAction("Index", "MstPriceList"));
        }
Example #27
0
        private void addButtonPriceList(PriceListModel tag)
        {
            int             i = 1;
            FlowLayoutPanel flpButtonPriceList = new FlowLayoutPanel();

            flpButtonPriceList.Dock      = DockStyle.Fill;
            flpButtonPriceList.BackColor = Color.FromArgb(215, 214, 216);
            if (pnDetail.Controls.Count > 0)
            {
                flpButtonPriceList = (FlowLayoutPanel)pnDetail.Controls[0];
            }
            else
            {
                pnDetail.Controls.Add(flpButtonPriceList);
            }
            Button btnGoToProduct = new Button();

            if (flpButtonPriceList.Controls.Count > 0)
            {
                btnGoToProduct = (Button)flpButtonPriceList.Controls[0];
            }
            else
            {
                flpButtonPriceList.Controls.Add(btnGoToProduct);
            }
            btnGoToProduct.Width     = 115;
            btnGoToProduct.Height    = 67;
            btnGoToProduct.FlatStyle = FlatStyle.Flat;
            btnGoToProduct.FlatAppearance.BorderSize = 0;
            btnGoToProduct.Dock      = DockStyle.Top;
            btnGoToProduct.Text      = "Edit";
            btnGoToProduct.Tag       = tag;
            btnGoToProduct.BackColor = Color.FromArgb(51, 51, 51);
            btnGoToProduct.ForeColor = Color.FromArgb(255, 255, 255);
            btnGoToProduct.Font      = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            btnGoToProduct.Click    += btnGoToProduct_Click;
            i++;
        }
Example #28
0
        public async Task <IActionResult> List()
        {
            var model = new PriceListModel();

            var modelPriceList = await _priceListMasterService.GetAllPriceListAsync();

            if (modelPriceList == null)
            {
                return(View(model));
            }

            var priceModel = modelPriceList.Select(v => new PriceListDetailsModel
            {
                Id                     = v.Id,
                ModelCode              = v.ModelCode,
                ModelVarient           = v.ModelVarient,
                VarientType            = v.VarientType,
                ExShowroomPrice        = v.ExShowroomPrice,
                FastTag                = v.FastTag,
                Tcs                    = v.Tcs,
                Hainsurance            = v.Hainsurance,
                HanilDepWithKeyProtect = v.HanilDepWithKeyProtect,
                HartiwithEngineProtect = v.HartiwithEngineProtect,
                Rtoindividual          = v.Rtoindividual,
                AccessoryComboKit      = v.AccessoryComboKit,
                ExtendedWarranty       = v.ExtendedWarranty,
                Rsa                    = v.Rsa,
                ClayBar                = v.ClayBar,
                Antirust               = v.Antirust,
                CarpetLamination       = v.CarpetLamination,
                TotatPrice             = v.TotatPrice
            }).ToList();

            model.PriceList.AddRange(priceModel);
            return(View(model));
        }
        protected override async Task Handle(UserInputMessage message)
        {
            using (var package = new ExcelPackage(new FileInfo(message.FileUrl)))
            {
                var result = new PriceListModel
                {
                    Items     = new List <PriceListItemModel>(),
                    PriceType = message.CurrentPriceType
                };

                var sheet = package.Workbook.Worksheets.FirstOrDefault();
                if (sheet == null)
                {
                    throw new FileNotFoundException($"file {message.FileUrl} not found or does not have any sheets");
                }
                var rowCnt = sheet?.Dimension?.End?.Row ?? 0;

                for (int rowNum = 1; rowNum < rowCnt + 1; rowNum++)
                {
                    var row = new FileRow
                    {
                        Id    = sheet.Cells[message.TitleColumn + rowNum].Value?.ToString(),
                        Price = sheet.Cells[message.PriceColumn + rowNum].Value?.ToString()
                    };

                    var rowModel = await _rowParser.Ask(row) as PriceListItemModel;

                    if (rowModel != null)
                    {
                        result.Items.Add(rowModel);
                    }
                }

                _comparator.Tell(result);
            }
        }
Example #30
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Messenger", "Do you want edit info price of product ?");

            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                Button         btn           = (Button)sender;
                PriceListModel dataPriceList = (PriceListModel)(btn.Tag);
                var            txtPrice      = txtProductPrice.Text;
                var            txtName       = txtProductName.Text;
                var            comboColor    = cbColor.Text;
                string         message_error = "";

                if (txtPrice == "")
                {
                    message_error = "Price is not empty";
                }
                if (txtName == "")
                {
                    message_error = "Name is not empty";
                }

                if (message_error == "")
                {
                    dataPriceList.CurrentPrice = Convert.ToDouble(txtPrice) * 1000;
                    dataPriceList.NameDesc     = txtName;
                    if (comboColor == "")
                    {
                        dataPriceList.Color = dataPriceList.Color;
                    }
                    else
                    {
                        dataPriceList.Color = comboColor;
                    }
                    var result = 0;
                    if (dataPriceList.Type == "MODIFIRE")
                    {
                        ModifireModel modifire = new ModifireModel();
                        modifire.ModifireID   = dataPriceList.ID;
                        modifire.CurrentPrice = dataPriceList.CurrentPrice;
                        modifire.ModifireName = dataPriceList.NameDesc;
                        modifire.Color        = dataPriceList.Color;
                        result = ModifireService.Created(modifire);
                    }
                    else
                    {
                        ProductionModel product = new ProductionModel();
                        product.ProductID       = dataPriceList.ID;
                        product.CurrentPrice    = dataPriceList.CurrentPrice;
                        product.ProductNameDesc = dataPriceList.NameDesc;
                        product.ProductNameSort = dataPriceList.NameSort;
                        product.Color           = dataPriceList.Color;
                        result = ProductService.Created(product);
                    }
                    if (result == 1)
                    {
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        frmMessager frmMessager = new frmMessager("Edit Product Price", "Error");
                        frmOpacity.ShowDialog(this, frmMessager);
                        this.Close();
                    }
                }
                else
                {
                    frmMessager frmMessager = new frmMessager("Edit Product Price", message_error);
                    frmOpacity.ShowDialog(this, frmMessager);
                }
            }
        }