Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to online purchase system");
            Console.WriteLine("Please type below Product name exactly to initiate the purchase");
            Console.WriteLine(" 1. PhysicalProduct \n 2. Book \n 3. Membership \n 4. UpgradeMembership \n 5. Video");

            ConcretePurchaseFactory cFactory = new ConcretePurchaseFactory();

            do
            {
                Console.WriteLine("Enter the Purchase Type");

                string type = Console.ReadLine();
                try
                {
                    IPurchase Purchase = cFactory.GetPurchaseType(type);

                    var actions = Purchase.Actions();

                    actions.ForEach(a => { Console.WriteLine(a); });
                }
                catch (Exception ex)
                {
                    if (ex.Message.Contains("Purchase"))
                    {
                        Console.WriteLine("Invalid Purchase");
                    }
                }

                Console.WriteLine("Type Exit to complete the purchase or press Enter to continue");
            } while(Console.ReadLine().ToLower() != "exit");
        }
Example #2
0
        /// <summary>
        /// Удалить покупку из БД
        /// </summary>
        /// <param name="entity_"></param>
        public void Delete(IPurchase purchase_)
        {
            var purchase = _dbContext.Purchase.Where(p => p.Id == purchase_.Id).First();

            _dbContext.Purchase.Remove(purchase);
            _dbContext.SaveChanges();
        }
Example #3
0
 public virtual void ProcessPurchase(IPurchase compra)
 {
     if (nextHandler != null)
     {
         nextHandler.ProcessPurchase(compra);
     }
 }
        private void btnPrint_Click(object sender, EventArgs e)
        {
            ReportDocument objRptDoc            = new ReportDocument();
            DataSet        dsPrintPOItemsDetail = new DataSet();
            //IMasterList objStockLedger = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
            IPurchase objPOItem = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");

            dsPrintPOItemsDetail = objPOItem.GetPurchaseOrderDetailsByPoid(GblIQCare.PurchaseOrderID);
            dsPrintPOItemsDetail.WriteXmlSchema(GblIQCare.GetXMLPath() + "\\IntStorePO.xml");
            rptIntStorePOReport rep = new rptIntStorePOReport();

            rep.SetDataSource(dsPrintPOItemsDetail);
            //  rep.ParameterFields["FormDate","1"];
            rep.SetParameterValue("ModePurchaseOrder", GblIQCare.ModePurchaseOrder);
            rep.SetParameterValue("facilityname", GblIQCare.AppLocation);

            // , Convert.ToString(dtpFrom.Text)];

            frmReportViewer theRepViewer = new frmReportViewer();

            theRepViewer.MdiParent             = this.MdiParent;
            theRepViewer.Location              = new Point(0, 0);
            theRepViewer.crViewer.ReportSource = rep;
            theRepViewer.Show();
            this.Close();
        }
Example #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (Validation_Form() == true)
            {
                String    AdjustmentDate = string.Format("{0:dd-MMM-yyyy}", dtpEffectiveDate.Text);
                int       updateStock    = 1;
                DataTable theDT          = (DataTable)dgwStockLevelDetails.DataSource;
                DataView  dv             = theDT.DefaultView;
                dv.RowFilter = "AdjQty > 0 OR AdjQty < 0";
                DataTable dt = dv.ToTable();

                //IMasterList objStock = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
                IPurchase objStock = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");
                int       ret      = objStock.SaveUpdateStockAdjustment(
                    dt,
                    GblIQCare.AppLocationId,
                    Convert.ToInt32(ddlStoreName.SelectedValue),
                    AdjustmentDate,
                    Convert.ToInt32(ddlPreparedBy.SelectedValue),
                    Convert.ToInt32(ddlAuthoriseBy.SelectedValue),
                    updateStock,
                    GblIQCare.AppUserId);
                if (ret > 0)
                {
                    IQCareWindowMsgBox.ShowWindow("ProgramSave", this);
                    ResetField();
                    return;
                }
            }
        }
 public void Initialize(string gameId, bool testMode, bool enablePerPlacementLoad)
 {
     m_UnityAdsPurchase = new Purchase();
     m_UnityAdsPurchase?.Initialize(this);
     m_UnityAds?.CallStatic("addListener", this);
     m_UnityAds?.CallStatic("initialize", m_CurrentActivity, gameId, testMode, enablePerPlacementLoad);
 }
Example #7
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         String AdjustmentDate = String.Format("{0:dd-MMM-yyyy}", dtpEffectiveDate.Text);
         //IMasterList objStock = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
         IPurchase objStock     = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");
         DataSet   dsStockLevel = objStock.GetStockforAdjustment(Convert.ToInt32(ddlStoreName.SelectedValue), AdjustmentDate);
         ShowGrid(dsStockLevel.Tables[0]);
         if (dsStockLevel.Tables[1].Rows.Count > 0)
         {
             ddlPreparedBy.SelectedValue  = dsStockLevel.Tables[1].Rows[0][4].ToString();
             ddlAuthoriseBy.SelectedValue = dsStockLevel.Tables[1].Rows[0][5].ToString();
             if (Convert.ToInt32(dsStockLevel.Tables[1].Rows[0][6]) == 1)
             {
                 chkUpdateStockFlag.Checked = true;
             }
         }
     }
     catch (Exception err)
     {
         MsgBuilder theBuilder = new MsgBuilder();
         theBuilder.DataElements["MessageText"] = err.Message.ToString();
         IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
     }
 }
Example #8
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         DataTable theDT = new DataTable();
         //IMasterList objItemOpeningStock = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
         IPurchase objItemOpeningStock = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");
         if (theDTStock.Rows.Count > 0)
         {
             DateTime  TransDate  = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy}", dtpTransdate.Text));
             DataRow[] theDRStock = theDTStock.Select("OpeningStock = 0");
             theDT = theDRStock.CopyToDataTable();
             int retrows = objItemOpeningStock.SaveUpdateOpeningStock(theDT, GblIQCare.AppUserId, TransDate);
             IQCareWindowMsgBox.ShowWindow("ProgramSave", this);
             Init_Form();
             theDTStock.Clear();
             Clear();
         }
         else
         {
             IQCareWindowMsgBox.ShowWindow("NoDatatoSave", this);
             //Init_Form();
             Clear();
         }
     }
     catch (Exception err)
     {
         MsgBuilder theBuilder = new MsgBuilder();
         theBuilder.DataElements["MessageText"] = err.Message.ToString();
         IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
     }
 }
Example #9
0
 public LotController(UserManager <User> userManager, IUser iUser, ILot iLot, IPurchase iPurchase)
 {
     _user        = iUser;
     _lot         = iLot;
     _userManager = userManager;
     _purchase    = iPurchase;
 }
Example #10
0
        private DataTable GetItems_OpeningStock()
        {
            //IMasterList objOpenStock = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
            IPurchase objOpenStock = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");

            dsOpenStock = objOpenStock.GetOpenStockWeb();

            DataView theDV = new DataView(dsOpenStock.Tables[0]);

            theDV.RowFilter = "StoreID='" + Convert.ToInt32(ddlSourceStore.SelectedValue.ToString()) + "'";
            //DataTable theDT = theDV.ToTable();

            //Session["ExistingBatches"] = dsOpenStock.Tables[1];

            DataTable batcheDT = dsOpenStock.Tables[1];

            if (batcheDT.Rows.Count > 0)
            {
                for (int i = 0; i < batcheDT.Rows.Count; i++)
                {
                    batches.Append(batcheDT.Rows[i]["Name"].ToString().ToLower());
                    batches.Append(",");
                }
                ViewState["batches"] = batches;
            }

            DataView theDVOS = new DataView(dsOpenStock.Tables[2]);

            theDVOS.RowFilter = "StoreID='" + Convert.ToInt32(ddlSourceStore.SelectedValue.ToString()) + "'";
            ViewState["ExistingOpeningStocks"] = theDVOS.ToTable();

            return(theDV.ToTable());
        }
Example #11
0
        public void TestMethod_ForBook()
        {
            Purchase = factory.GetPurchaseType("Book");
            var actions = Purchase.Actions();

            Assert.IsNotNull(actions);
            Assert.IsTrue(actions.Count == 3);
        }
Example #12
0
        /// <summary>
        /// Create a new purchase record in the database.
        /// </summary>
        /// <param name="purchase"></param>
        public void create(IPurchase purchase)
        {
            // ask the data access layer to do the processing
            this.dataAccessObject.addTransaction(purchase);

            // fire the event to retrieve all purchase records
            OnGetAllPurchases(new GetAllPurchasesEventArgs(this.dataAccessObject.getAllTransactions()));
        }
Example #13
0
        public void TestMethod_ForVideo()
        {
            Purchase = factory.GetPurchaseType("Video");
            var actions = Purchase.Actions();

            Assert.IsNotNull(actions);
            Assert.IsTrue(actions.Count == 2);
        }
Example #14
0
        public void TestMethod_ForUpgradeMembership()
        {
            Purchase = factory.GetPurchaseType("UpgradeMembership");
            var actions = Purchase.Actions();

            Assert.IsNotNull(actions);
            Assert.IsTrue(actions.Count == 2);
        }
Example #15
0
        public void TestMethod_ForPhysicalProduct()
        {
            Purchase = factory.GetPurchaseType("PhysicalProduct");
            var actions = Purchase.Actions();

            Assert.IsNotNull(actions);
            Assert.IsTrue(actions.Count == 2);
        }
Example #16
0
 public void Build()
 {
     _context = new Context();
     _context.BuidContext();
     _dialogService = new DialogService();
     _purchase      = new Purchase();
     //_purchase = new PurchaseMock();
 }
Example #17
0
 private Boolean Validation_Form()
 {
     try
     {
         if (Convert.ToInt32(ddlStore.SelectedValue) == 0)
         {
             MsgBuilder theBuilder = new MsgBuilder();
             theBuilder.DataElements["Control"] = "Store";
             IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
             return(false);
         }
         else if (txtBatchName.Text == "")
         {
             MsgBuilder theBuilder = new MsgBuilder();
             theBuilder.DataElements["Control"] = "Batch No";
             IQCareWindowMsgBox.ShowWindow("BlankTextBox", theBuilder, this);
             return(false);
         }
         else if (txtItemName.Text == "")
         {
             MsgBuilder theBuilder = new MsgBuilder();
             theBuilder.DataElements["Control"] = "Item Name";
             IQCareWindowMsgBox.ShowWindow("BlankTextBox", theBuilder, this);
             return(false);
         }
         else if (Convert.ToDateTime(dtpExpiryDate.Text) <= Convert.ToDateTime(GblIQCare.CurrentDate))
         {
             IQCareWindowMsgBox.ShowWindow("ExpiryDate", this);
             return(false);
         }
         else if (Convert.ToDateTime(dtpTransdate.Text) > Convert.ToDateTime(GblIQCare.CurrentDate))
         {
             IQCareWindowMsgBox.ShowWindow("AsofDate", this);
             return(false);
         }
         else if (txtOpeningQty.Text == "")
         {
             MsgBuilder theBuilder = new MsgBuilder();
             theBuilder.DataElements["Control"] = "Opening Quantity";
             IQCareWindowMsgBox.ShowWindow("BlankTextBox", theBuilder, this);
             return(false);
         }
         IPurchase objItemOpeningStock = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");
         DataTable dtduplbatch         = objItemOpeningStock.GetDuplicateBatchOpenStock(txtBatchName.Text, Convert.ToDateTime(dtpExpiryDate.Text));
         if (dtduplbatch.Rows.Count > 0)
         {
             IQCareWindowMsgBox.ShowWindow("BatchDuplicateExists", this);
             return(false);
         }
     }
     catch (Exception err)
     {
         MsgBuilder theBuilder = new MsgBuilder();
         theBuilder.DataElements["MessageText"] = err.Message.ToString();
         IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
     }
     return(true);
 }
Example #18
0
        private void btn_Submit_Click(object sender, EventArgs e)
        {
            BindFunctions theBindManager = new BindFunctions();
            //IMasterList objOpenStock = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
            IPurchase objOpenStock      = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");
            DataSet   theDSDisposeStock = objOpenStock.GetDisposeStock(Convert.ToInt32(ddlStore.SelectedValue), Convert.ToDateTime(dtpAsofDate.Text));

            ShowGrid(theDSDisposeStock.Tables[0]);
        }
Example #19
0
 public MPurchase(IPurchase purch_)
 {
     Id      = purch_.Id;
     Shop_Id = purch_.Shop_Id;
     Item_Id = purch_.Item_Id;
     Price   = purch_.Price;
     Count   = purch_.Count;
     Date    = purch_.Date;
 }
Example #20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="p"></param>
        private void ProcessCompletedPurchase(IPurchase p)
        {
            // Even if it's a non consumable, we'll add it to the non consumed purchases list
            // which is the list of active IAPs to return upon calling GetPurchasedProducts
            _nonConsumedPurchases.Add(p);

            _purchases.Add(p);

            Save();
        }
        public DonateViewModel(IPurchase purchase)
        {
            _purchase = purchase;

            _donate1Command = new RelayCommand <FrameworkElement>(Donate1);
            _donate2Command = new RelayCommand <FrameworkElement>(Donate2);
            _donate3Command = new RelayCommand <FrameworkElement>(Donate3);

            IsLoaded = false;
        }
Example #22
0
 //string code = "";
 public SalesController(IBuyer buyer, ISalesInvoice sales, IProduct product, IPurchase purchase, PermessDbContext context, IStock stock, IPermess permess)
 {
     _buyer    = buyer;
     _sales    = sales;
     _product  = product;
     _purchase = purchase;
     _context  = context;
     _stock    = stock;
     _permess  = permess;
 }
        private string GetProductDisplayName(IPurchase purchase, string productId)
        {
            var product = purchase.GetProductInfo(productId);

            if (product == null)
            {
                return(string.Empty);
            }

            return($"{product.Name} ({product.FormattedPrice})");
        }
 public override void ProcessPurchase(IPurchase compra)
 {
     if (compra.dAmount <= 5000)
     {
         Console.WriteLine(string.Format("{0} \"AUTORIZADA\" por el Coordinador.", compra.cConcept));
     }
     else
     {
         base.ProcessPurchase(compra);
     }
 }
Example #25
0
 public override void ProcessPurchase(IPurchase compra)
 {
     if (compra.dAmount > 15000 && compra.dAmount <= 50000)
     {
         Console.WriteLine(string.Format("{0} \"AUTORIZADA\" por el Director.", compra.cConcept));
     }
     else
     {
         Console.WriteLine(string.Format("{0} \"DENEGADA\".", compra.cConcept));
     }
 }
Example #26
0
        /// <summary>
        /// Добавить покупку в БД
        /// </summary>
        /// <param name="purchase_"></param>
        public Purchase Create(IPurchase purchase_)
        {
            var purchase = EntitiesFactory.Get().CreatePurchase(
                purchase_.Id, purchase_.Shop_Id, purchase_.Item_Id, purchase_.Price, purchase_.Count, purchase_.Date
                );
            var purch = _dbContext.Purchase.Add(purchase);

            _dbContext.SaveChanges();

            return(purch);
        }
Example #27
0
        /// <summary>
        /// Обновить покупку в БД
        /// </summary>
        /// <param name="purchase_"></param>
        public void Update(IPurchase purchase_)
        {
            var purchase = _dbContext.Purchase.Where(p => p.Id == purchase_.Id).First();

            purchase.Item_Id = purchase_.Item_Id;
            purchase.Price   = purchase_.Price;
            purchase.Shop_Id = purchase_.Shop_Id;
            purchase.Count   = purchase_.Count;
            purchase.Date    = purchase_.Date;

            _dbContext.SaveChanges();
        }
Example #28
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DataTable theDT = new DataTable();

            theDT = (DataTable)dgwDisposeItem.DataSource;
            //IMasterList objOpenStock = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
            IPurchase objOpenStock = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");
            int       SaveRecord   = objOpenStock.SaveDisposeItems(Convert.ToInt32(ddlStore.SelectedValue), GblIQCare.AppLocationId, Convert.ToDateTime(dtpAsofDate.Text), GblIQCare.AppUserId, theDT);

            if (SaveRecord == 1)
            {
                IQCareWindowMsgBox.ShowWindow("ProgramSave", this);
            }
        }
Example #29
0
        private void ResetField()
        {
            dtpEffectiveDate.Text = GblIQCare.CurrentDate;
            //IMasterList objStock = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
            IPurchase objStock     = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");
            DataSet   dsStockLevel = objStock.GetStockforAdjustment(0, GblIQCare.CurrentDate);

            ShowGrid(dsStockLevel.Tables[0]);
            ddlPreparedBy.SelectedValue       = 0;
            ddlAuthoriseBy.SelectedValue      = 0;
            chkUpdateStockFlag.Checked        = false;
            ddlAdjustmentReason.SelectedValue = 0;
            ddlStoreName.SelectedValue        = 0;
        }
 public NavigationPanelViewModel(Func <IDataSource> getDataSource, IConnectionListener connectionListener, IPurchase purchase)
 {
     _getDataSource      = getDataSource;
     _connectionListener = connectionListener;
     _purchase           = purchase;
     _loginCommand       = new Common.RelayCommand(Login);
     _logoutCommand      = new Common.RelayCommand(Logout);
     _homeCommand        = new Common.RelayCommand(Home);
     _settingsCommand    = new Common.RelayCommand(Settings, CanSettings);
     _searchCommand      = new Common.RelayCommand(Search);
     _channelCommand     = new RelayCommand <string>(LoadChannel);
     _donateCommand      = new Common.RelayCommand(ViewDonate);
     Title = AppResources.ApplicationTitle;
 }
Example #31
0
 public BLPurchase()
 {
     repo = new RepoPurchase();
 }