Exemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (salesListView.SelectedItems.Count > 0)
     {
         Model.Sale s = ((Model.Sale)salesListView.SelectedItems[0].Tag);
         Program.theDatabase.removeSale(s);
         Program.theDatabase.saveToDisk();
         updateList();
     }
 }
Exemplo n.º 2
0
        private void deleteButton_Click(object sender, EventArgs e)
        {
            if (itemsListView.SelectedItems.Count > 0 && salesListView.SelectedItems.Count > 0)
            {
                Model.Sale s = ((Model.Sale)salesListView.SelectedItems[0].Tag);

                s.removeProductIndex(itemsListView.SelectedIndices[0]);
                selectedSale = s;
                updateItemList();
                updateList();
                selectedSale = null;
            }
        }
Exemplo n.º 3
0
        protected void SaleAgain()
        {
            Model.Sale ml_sale = bll_sale.GetModel(Convert.ToInt32(Request.QueryString["Sale_ID"]));
            ml_sale.GatheringWay  = this.DropDownList6.SelectedItem.Text;
            ml_sale.Account       = this.DropDownList4.SelectedItem.Text;
            ml_sale.Address       = this.TextBox1.Text;
            ml_sale.Customer      = Convert.ToInt32(DropDownList5.SelectedValue);
            ml_sale.StoreHouse_ID = Convert.ToInt32(DropDownList1.SelectedValue);
            ml_sale.Dept_ID       = Convert.ToInt32(DropDownList2.SelectedValue);
            bll_sale.Update(ml_sale);
            string Ids    = this.newId.Value.Replace(" ", "").Replace("\r\n", "");
            string Qtys   = this.newQty.Value.Replace(" ", "").Replace("\r\n", "");
            string Prices = this.newPrice.Value.Replace(" ", "").Replace("\r\n", "");

            string[] ArrIds = Ids.Split(new char[] { '|' });
            string[] ArrQty = Qtys.Split(new char[] { '|' });
            string[] ArrPri = Prices.Split(new char[] { '|' });
            for (int i = 0; i < ArrIds.Length - 1; i++)
            {
                Model.Sale_Detail ml_sa = new ZhangWei.Model.Sale_Detail();
                BLL.Sale_Detail   bl_sd = new ZhangWei.BLL.Sale_Detail();
                ml_sa.Sale_ID    = Convert.ToInt32(Request.QueryString["Sale_ID"]);
                ml_sa.Product_ID = Convert.ToInt32(ArrIds[i]);
                //ml_sa.SaleOrder_ID = 0;
                ml_sa.Quantity = Convert.ToDecimal(ArrQty[i]);
                ml_sa.Price    = Convert.ToDecimal(ArrPri[i]);
                Model.StockPile ml_sp = new BLL.StockPile().GetModelByProId(Convert.ToInt32(ArrIds[i]), Convert.ToInt32(DropDownList1.SelectedValue));
                BLL.StockPile   bl_sp = new ZhangWei.BLL.StockPile();
                if (ml_sp == null)
                {
                    Model.Product ml_pr = new BLL.Product().GetModel(Convert.ToInt32(ArrIds[i]));
                    ml_sp                = new ZhangWei.Model.StockPile();
                    ml_sp.Product_ID     = Convert.ToInt32(ArrIds[i]);
                    ml_sp.Dept_ID        = Convert.ToInt32(DropDownList2.SelectedValue);
                    ml_sp.FirstEnterDate = DateTime.Now;
                    ml_sp.LastLeaveDate  = DateTime.Now;
                    ml_sp.Price          = Convert.ToDecimal(ArrPri[i]);
                    ml_sp.Quantity       = 0;
                    ml_sp.StoreHouse_ID  = Convert.ToInt32(DropDownList1.SelectedValue);
                    ml_sp.Quantity      -= Convert.ToDecimal(ArrQty[i]);
                    bl_sp.Add(ml_sp);
                }
                else
                {
                    ml_sp.Quantity     -= Convert.ToDecimal(ArrQty[i]);
                    ml_sp.LastLeaveDate = DateTime.Now;
                    bl_sp.Update(ml_sp);
                }
                bl_sd.Add(ml_sa);
            }
        }
Exemplo n.º 4
0
        protected void BindData()
        {
            Model.Sale       ml_sa = bll_sale.GetModel(Convert.ToInt32(Request.QueryString["Sale_ID"]));
            Model.StoreHouse ml_sh = new BLL.StoreHouse().GetModel(Convert.ToInt32(ml_sa.StoreHouse_ID));
            Model.Customer   ml_cu = new BLL.Customer().GetModel(Convert.ToInt32(ml_sa.Customer));
            DataSet          ds    = new BLL.Sale_Detail().GetDetailAll(Convert.ToInt32(Request.QueryString["Sale_ID"]));

            this.GridView1.DataSource = ds;
            this.GridView1.DataBind();
            decimal AllTot = 0;

            foreach (GridViewRow gvr in GridView1.Rows)
            {
                decimal price  = Convert.ToDecimal(gvr.Cells[5].Text);
                decimal qty    = Convert.ToDecimal(gvr.Cells[4].Text);
                decimal RowTot = price * qty;
                gvr.Cells[6].Text = Math.Round(RowTot, 3).ToString();
                AllTot           += RowTot;
            }
            this.Label1.Text = Math.Round(AllTot, 3).ToString();
            this.Label2.Text = Maticsoft.Common.Rmb.CmycurD(AllTot);
            string OldId    = "";
            string OldPrice = "";
            string OldQty   = "";

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                OldId    += ds.Tables[0].Rows[i]["Product_ID"] + "|";
                OldPrice += ds.Tables[0].Rows[i]["Price"] + "|";
                OldQty   += ds.Tables[0].Rows[i]["Quantity"] + "|";
            }
            this.oldId.Value    = OldId.ToString();
            this.oldPrice.Value = OldPrice.ToString();
            this.oldQty.Value   = OldQty.ToString();
            this.newId.Value    = OldId.ToString();
            this.newPrice.Value = OldPrice.ToString();
            this.newQty.Value   = OldQty.ToString();

            this.DropDownList1.SelectedValue = ml_sa.StoreHouse_ID.ToString();
            this.DropDownList2.SelectedValue = ml_sa.Dept_ID.ToString();
            this.DropDownList5.SelectedValue = ml_sa.Customer.ToString();
            this.DropDownList4.Text          = ml_sa.Account;
            this.DropDownList6.Text          = ml_sa.GatheringWay;
            this.TextBox1.Text = ml_sa.Address;
        }
Exemplo n.º 5
0
        public SalesViewModel()
        {
            Log.Info("Before: Salesviewmodel ");

            Sale = new Model.Sale();
            Log.Info("Before:In Salesviewmodel, get all data of sales ");
            Sales = new ObservableCollection <Model.Sale>(DatabaseAndQueries.Queries.GetAllByConditionWithOrder <Sale, DateTime>(x => x.Type == true, x => x.SaleDate, true));
            Log.Info("After:In Salesviewmodel, get all data of sales,Successfully ");
            Log.Info("Before:In Salesviewmodel, get all data of purchase");
            Purchase = new ObservableCollection <Model.Sale>(DatabaseAndQueries.Queries.GetAllByConditionWithOrder <Sale, DateTime>(x => x.Type == false, x => x.SaleDate, true));
            Log.Info("After:In Salesviewmodel, get all data of purchase, Successfully");
            Log.Info("Before:In Salesviewmodel, get all data of Customer and Product");

            Customerlist = new AsyncObservableCollection <Model.Customer>(DatabaseAndQueries.Queries.GetAllDataWithOrder <Customer, int>(x => x.Cid, true));
            Products     = new ObservableCollection <Model.Products>(DatabaseAndQueries.Queries.GetAllData <Products>());
            Log.Info("After:In Salesviewmodel, get all data of Customer and Product, Successfully");
            Log.Info("After: Salesviewmodel");
            Sales.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Sales_CollectionChanged);
        }
Exemplo n.º 6
0
        void updateItemList()
        {
            itemsListView.BeginUpdate();
            itemsListView.Items.Clear();

            if (salesListView.SelectedItems.Count > 0)
            {
                Model.Sale s = (Model.Sale)salesListView.SelectedItems[0].Tag;

                for (int i = 0; i < s.productNames.Length; i++)
                {
                    ListViewItem z = new ListViewItem(s.productNames[i]);
                    z.SubItems.Add(s.productCosts[i].ToString("c"));
                    z.Tag = Program.theDatabase.getProduct(s.productIDs[i]);
                    itemsListView.Items.Add(z);
                }
            }


            itemsListView.EndUpdate();
        }
Exemplo n.º 7
0
 private void btnKredi_Click(object sender, EventArgs e)
 {
     if (dataGridView1.RowCount > 0)
     {
         Model.Sale satis = new Model.Sale();
         satis.SaleDate          = DateTime.Now.Date;
         satis.PaymentMethodSale = 2;
         satis.TotalPrice        = totalPrice;
         satis.TotalDiscount     = Convert.ToDecimal(totalDiscount);
         data.Sale.InsertOnSubmit(satis);
         data.SubmitChanges();
         foreach (DataGridViewRow row in dataGridView1.Rows)
         {//TODO:Ürün Stokta Varmı Yokmu Kontrol Edilecek++
             Model.BarcodeSystemDataContext pdata          = new Model.BarcodeSystemDataContext();
             Model.OpeationProduct          satilanurunler = new Model.OpeationProduct();
             satilanurunler.SaleProduct = (from q in data.Sale
                                           orderby q.SaleID descending
                                           select q).First().SaleID;
             satilanurunler.ProductID       = (int)(row.Cells["ProductID"].Value);
             satilanurunler.ProductDiscount = Convert.ToDecimal(row.Cells["ProductDiscount"].Value);
             satilanurunler.ProductPrice    = Convert.ToDecimal((row.Cells["ProductSalePrice"].Value.ToString().Split(' ')[0]));
             pdata.OpeationProduct.InsertOnSubmit(satilanurunler);
             pdata.SubmitChanges();
             totalDiscount   = 0;
             totalPrice      = 0;
             productDiscount = 0;
             lblName.Text    = "Ürün Adı : null";
             lblPrice.Text   = "Ürün Fiyat : null";
             lblTotal.Text   = "Toplam Fiyat : null";
         }
         datagridviewID = 1;
         dataGridView1.Rows.Clear();
         MessageDöndür.Message("Satış İşlemi başarıyla Gerçekleştirildi.", "İşlem Onaylandı", MessageDöndür.MessageIcon.OK, MessageDöndür.MessageButton.OK);
     }
     else
     {
         MessageDöndür.Message("Listede Ürün Yok Satış İşlemi Gerçekleştirilemiyor.", "Satış işlemi İptal Edildi", MessageDöndür.MessageIcon.Eror, MessageDöndür.MessageButton.OK);
     }
 }
Exemplo n.º 8
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            bool   blConfirm = Convert.ToBoolean(this.chkConfirm.Checked);     //是否被确认
            bool   blSend    = Convert.ToBoolean(this.chkConsignment.Checked); //是否已发货
            bool   blEnd     = Convert.ToBoolean(this.chkPigeonhole.Checked);  //是否已归档
            string state     = "";

            if (blConfirm)
            {
                state = "1";
            }
            else if (blSend)
            {
                state = "2";
            }
            else if (blEnd)
            {
                state = "2";
            }
            string AdminID = Session["AID"].ToString(); //根单员ID代号
            //修改订单表中订单状态
            string str = "'" + Session["OrderID"].ToString() + "'";

            Model.OrderSheet or = ordersh.GetModel("orderNo=" + str);
            //or.employeeNo = AdminID;
            ordersh.Update(or);

            Model.Sale s  = new Model.Sale();
            DataTable  dt = sale.GetList("orderNo=" + str).Tables[0];

            s.orderNo   = dt.Rows[0]["orderNo"].ToString();
            s.ISBN      = dt.Rows[0]["ISBN"].ToString();
            s.quantity  = int.Parse(dt.Rows[0]["quantity"].ToString());
            s.bookState = state;
            sale.Update(s);
            Response.Write(ccObj.MessageBox("修改成功!", "main.aspx"));
        }
Exemplo n.º 9
0
        private void registeredCustomer_Click(object sender, EventArgs e)
        {
            if (!(dataGridView1.Rows.Count <= 0))
            {
                int customerID = SelectCustomer.Show();

                if (!(customerID == -1))
                {
                    var query = (from q in data.Customer
                                 where q.CustomerID == customerID
                                 select q).First();
                    MessageDöndür.MessageResult messageResult = MessageDöndür.Message("Müsteri :" + query.CustomerName + " " + query.CustomerSurname + "\nAdlı Müşteriye " + totalPrice + " TL Tutarında işlem Yapmayı Onaylıyormusunuz", "Satış Onayı", MessageDöndür.MessageIcon.Information, MessageDöndür.MessageButton.YesNoCancel);
                    if (MessageDöndür.MessageResult.Yes == messageResult)
                    {
                        Model.Sale satis = new Model.Sale();
                        satis.SaleDate          = DateTime.Now.Date;
                        satis.PaymentMethodSale = 3;
                        satis.TotalPrice        = totalPrice;
                        satis.CustomerID        = query.CustomerID;
                        satis.TotalDiscount     = Convert.ToDecimal(totalDiscount);
                        data.Sale.InsertOnSubmit(satis);
                        data.SubmitChanges();
                        foreach (DataGridViewRow row in dataGridView1.Rows)
                        {//TODO:Ürün Stokta Varmı Yokmu Kontrol Edilecek++
                            Model.BarcodeSystemDataContext pdata          = new Model.BarcodeSystemDataContext();
                            Model.OpeationProduct          satilanurunler = new Model.OpeationProduct();

                            satilanurunler.SaleProduct = (from q in data.Sale
                                                          orderby q.SaleID descending
                                                          select q).First().SaleID;
                            satilanurunler.ProductID       = (int)(row.Cells["ProductID"].Value);
                            satilanurunler.ProductDiscount = Convert.ToDecimal(row.Cells["ProductDiscount"].Value);
                            satilanurunler.ProductPrice    = Convert.ToDecimal((row.Cells["ProductSalePrice"].Value.ToString().Split(' ')[0]));
                            pdata.OpeationProduct.InsertOnSubmit(satilanurunler);
                            pdata.SubmitChanges();
                        }
                        Model.CustomerProcces satisislemi = new Model.CustomerProcces();
                        satisislemi.CustomerID   = query.CustomerID;
                        satisislemi.ProccesDate  = DateTime.Now;
                        satisislemi.ProccesType  = 1;
                        satisislemi.ProccesPrice = totalPrice;
                        query.CustomerAccount   += totalPrice;
                        data.CustomerProcces.InsertOnSubmit(satisislemi);
                        data.SubmitChanges();
                        totalDiscount   = 0;
                        totalPrice      = 0;
                        productDiscount = 0;
                        lblName.Text    = "Ürün Adı : null";
                        lblPrice.Text   = "Ürün Fiyat : null";
                        lblTotal.Text   = "Toplam Fiyat : null";
                        datagridviewID  = 1;
                        dataGridView1.Rows.Clear();
                        MessageDöndür.Message("Satış İşlemi başarıyla Gerçekleştirildi.", "İşlem Onaylandı", MessageDöndür.MessageIcon.OK, MessageDöndür.MessageButton.OK);
                    }
                }
                else
                {
                    MessageDöndür.Message("Müşteri Seçimi Başarısız Oldu !", "Müşteri Seçim Başarısız .", MessageDöndür.MessageIcon.Eror, MessageDöndür.MessageButton.OK);
                }
            }
            else
            {
                MessageDöndür.Message("Ürün Listesi Boş Olduğu İçin Çıkış yapılamıyor", "DataGridView Boş", MessageDöndür.MessageIcon.Eror, MessageDöndür.MessageButton.OK);
            }
        }