Exemple #1
0
        public ProductInformationModel GetProducts(string ProductID)
        {
            ProductInformationModel _Product = new ProductInformationModel();
            ProductInfo             _PInfo   = new ProductInfo();

            try
            {
                XDocument doc = XDocument.Load("D:\\Temp\\Reference\\ProductInfo.Xml");

                IEnumerable <XElement> pdocut = (
                    from result in doc.Root.Elements("ProductsInfo")
                    where result.Element("ID").Value == ProductID.ToString()
                    select result);

                _Product.id        = pdocut.ElementAt(0).Element("ID").Value;
                _Product.timestamp = pdocut.ElementAt(0).Element("TimeStamp").Value;
                _Product.PInfo     = new List <ProductInfo>();
                foreach (var item in pdocut)
                {
                    _PInfo._id         = Convert.ToInt64(item.Element("Product").Element("Pid").Value);
                    _PInfo.name        = item.Element("Product").Element("PName").Value;
                    _PInfo.quantity    = Convert.ToInt16(item.Element("Product").Element("quantity").Value);
                    _PInfo.Sale_Amount = Convert.ToDouble(item.Element("Product").Element("sale_amount").Value);
                    _Product.PInfo.Add(_PInfo);
                }
            }
            catch (Exception ex)
            {
            }
            return(_Product);
        }
Exemple #2
0
        public ProductInformationModel GetProductInformationByUid(string productUid)
        {
            ProductInformationModel model = new ProductInformationModel();

            model.Product = _productsDal.GetProductByUid(productUid);
            model.Pos     = _posDal.GetById(model.Product.PosId);

            return(model);
        }
 public ProductReleaseDateViewModel(UserInformation userInformation, System.Windows.Window window, ProductInformationModel productInformationModel,
                                    ProcessDesigner.Common.OperationMode operationMode, string title = "Document Release Date")
 {
     PRODUCT_INFORMATION_MODEL = (productInformationModel.IsNotNullOrEmpty() ? productInformationModel : new ProductInformationModel());
     if (!_productInformationModel.DOC_REL_DATE.IsNotNullOrEmpty())
     {
         FeasibleReportAndCostSheet bll = new FeasibleReportAndCostSheet(userInformation);
         _productInformationModel.DOC_REL_DATE = bll.ServerDateTime();
     }
     this.saveCommand = new DelegateCommand(this.SaveSubmitCommand);
 }
        // GET: /Gift/Get/UniqueGiftId
        public ActionResult Get(string id)
        {
            if (String.IsNullOrEmpty(id))
            {
                return(new RedirectResult(Url.Action("Index", "Home")));
            }

            var model = new ProductInformationModel();

            try
            {
                TransactionBdo transaction = null;

                // Could be old UID or new OrderNr
                if (id.Length < this.MySettings.LengthOfPosUid)
                {
                    Logger.Info("Trying to get coupon by its order nr: " + id);
                    transaction = Factory.TransactionsBll.GetTransactionByOrderNr(id);
                }
                else
                {
                    // Try to get using UID
                    Logger.Info("Trying to get coupon by payment system UID: " + id);
                    transaction = Factory.TransactionsBll.GetTransactionByPaySystemUid(id);
                }

                model.Product = Factory.GiftsBll.GetProductByPaySystemUid(transaction.PaySystemUid);
                model.Product.PosLatLng.LatLngString = Factory.HelperBll.GetLatLngString(model.Product.PosLatLng, MapTypes.YandexMap);
                model.Pos = Factory.PosBll.GetById(model.Product.PosId);

                model.PaymentStatus = transaction.PaymentStatus;
                model.IsPaidOk      = transaction.PaymentStatus == PaymentStatusIds.PaidOk;
                model.PaymentDate   = transaction.PaySystemResponseAt;
            }
            catch (InvalidOperationException ioex)
            {
                Logger.Error(ioex);
                return(NotFound());
            }
            catch (System.Data.Entity.Core.EntityException eex)
            {
                Logger.Fatal("Database exception, getting gift", eex);
                throw;
            }
            catch (Exception ex)
            {
                Logger.Error("Error getting gift coupon by payment system UID: " + id, ex);
                throw;
            }


            return(View("Get", GetLayoutForPos(model.Pos.Id), model));
        }
Exemple #5
0
        public void SendCouponAsGift(string friendEmail, byte[] pdf, ProductInformationModel product)
        {
            if (pdf == null)
            {
                throw new ArgumentNullException("pdf");
            }

            try
            {
                Logger.Info("Sending email with gift coupon to friend: " + friendEmail);

                var ms = _configurationBll.Get();

                MailMessage mailMessage = new MailMessage();
                mailMessage.From = new MailAddress("*****@*****.**", "DovanuKuponai");
                //mailMessage.To.Add(new MailAddress(ms.Mails.ManagerEmail, "DK manager"));
                mailMessage.To.Add(new MailAddress(friendEmail));
                mailMessage.Bcc.Add(new MailAddress("*****@*****.**"));
                mailMessage.Subject = String.Concat("Draugo dovana is ", ms.ProjectName);
                mailMessage.Body    = "Jusu draugas siuncia Jums dovanu kupona. " + ms.ProjectName;

                using (var s = new System.IO.MemoryStream(pdf))
                {
                    Attachment a = null;
                    a = new Attachment(s, "DovanuKuponas.pdf", "application/pdf");
                    mailMessage.Attachments.Add(a);
                    mailMessage.IsBodyHtml = false;

                    SendEmail(mailMessage);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Error sending coupon as gift to: " + friendEmail, ex);
                throw;
            }
        }
Exemple #6
0
        public bool PutProductInformation([FromBody] ProductInformationModel PInfo)
        {
            try
            {
                XDocument doc = XDocument.Load("D:\\temp\\Reference\\ProductInfo.Xml");

                var PID = doc.Root.Elements("ProductsInfo")
                          .Where(a => (string)a.Element("ID").Value == PInfo.id)
                          .Select(a => (string)a.Element("ID").Value).FirstOrDefault();

                if (!string.IsNullOrEmpty(PID))
                {
                    throw new Exception("Duplicate Product ID");
                }

                doc.Element("DocumentElement").Add(
                    new XElement("ProductsInfo",
                                 new XElement("ID", PInfo.id),
                                 new XElement("TimeStamp", PInfo.timestamp),
                                 from PdInfo in PInfo.PInfo
                                 select
                                 new XElement("Product",
                                              new XElement("Pid", PdInfo._id),
                                              new XElement("PName", PdInfo.name),
                                              new XElement("quantity", PdInfo.quantity),
                                              new XElement("sale_amount", PdInfo.Sale_Amount))
                                 ));

                doc.Save("D:\\temp\\Reference\\ProductInfo.Xml");
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public frmProductReleaseDate(UserInformation userInformation, System.Windows.Window window, ProductInformationModel productInformationModel,
                                     ProcessDesigner.Common.OperationMode operationMode, string title = "Document Release Date")
        {
            InitializeComponent();

            vm = new ProductReleaseDateViewModel(userInformation, window, productInformationModel, operationMode, title);
            this.DataContext = vm;
            if (vm.CloseAction == null && window.IsNotNullOrEmpty())
            {
                vm.CloseAction = new Action(() => window.Close());
            }
        }