예제 #1
0
 public void UpdateDataTable(System.Data.DataTable dt)
 {
     try
     {
         V.BeginTransaction();
         accessor.UpdateDataTable(dt);
         foreach (DataRow item in dt.Rows)
         {
             Model.Stock stock = stockAccessor.GetStockByProductIdAndDepotPositionId(item["ProductId"].ToString(), item["DepotPositionId"].ToString());
             if (stock != null)
             {
                 stock.StockQuantity1 = double.Parse(item["StockCheckQuantity"].ToString());
                 stockAccessor.Update(stock);
             }
             Model.Product product = productAccessor.Get(item["ProductId"].ToString());
             Model.Depot   depot   = depotAccessor.Get(item["DepotId"].ToString());
             if (product != null)
             {
                 product.StocksQuantity = stockAccessor.GetTheCount1OfProductByProductId(product, depot);
                 productAccessor.Update(product);
             }
         }
         V.CommitTransaction();
     }
     catch (Exception)
     {
         V.RollbackTransaction();
         throw;
     }
 }
예제 #2
0
 protected override void AddNew()
 {
     this.depot                     = new Model.Depot();
     this.depot.DepotId             = Guid.NewGuid().ToString();
     this.depot.Details             = new List <Model.DepotPosition>();
     this.depot.IsFinalProductDepot = false;
 }
예제 #3
0
        public bool existsInsertName(string DepotPositionid, Model.Depot depot)
        {
            Hashtable ht = new Hashtable();

            ht.Add("DepotPositionid", DepotPositionid);
            ht.Add("depotid", depot == null ? null : depot.DepotId);
            return(sqlmapper.QueryForObject <bool>("DepotPosition.existsInsertName", ht));
        }
예제 #4
0
        public bool ExistsExcept(Model.Depot e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.DepotId) == null?null:Get(e.DepotId).Id);
            return(sqlmapper.QueryForObject <bool>("Depot.existsexcept", paras));
        }
예제 #5
0
        public double GetTheCount0OfProductByProductId(Model.Product product, Model.Depot depot)
        {
            Hashtable ht = new Hashtable();

            ht.Add("productId", product == null ? null : product.ProductId);
            ht.Add("depotId", depot.DepotId);
            return(sqlmapper.QueryForObject <double>("Stock.GetTheCount0OfProductByProductId", ht));
        }
예제 #6
0
 private void buttonEditDepot_EditValueChanged(object sender, EventArgs e)
 {
     if (this.buttonEditDepot.EditValue != null)
     {
         Model.Depot depot = this.buttonEditDepot.EditValue as Model.Depot;
         this.bindingSourceDepotPosition.DataSource = new BL.DepotPositionManager().Select(depot);
     }
 }
예제 #7
0
        protected override void MovePrev()
        {
            Model.Depot dt = this.depotManager.GetPrev(this.depot);
            if (dt == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.depot = dt;
        }
예제 #8
0
        public void MyClick(ref ChooseItem item)
        {
            ChooseDepotForm f = new ChooseDepotForm();

            if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Model.Depot depot = f.SelectedItem as Model.Depot;
                item = new ChooseItem(depot, depot.Id, depot.DepotName);
            }
        }
예제 #9
0
        /// <summary>
        /// Update a Depot.
        /// </summary>
        public void Update(Model.Depot depot)
        {
            //
            // todo: add other logic here.
            //
            Validate(depot);
            if (this.ExistsExcept(depot))
            {
                throw new Helper.InvalidValueException(Model.Depot.PRO_Id);
            }
            foreach (Model.DepotPosition dp in depot.Details)
            {
                if (string.IsNullOrEmpty(dp.Id))
                {
                    throw new Helper.RequireValueException(Model.DepotPosition.PROPERTY_ID + "aa");
                }

                //if (DepotPositionAccessor.existsInsertName(dp.DepotPositionId, depot))
                //{
                //    if (DepotPositionAccessor.ExistsExcept(dp))
                //    {
                //        throw new Helper.InvalidValueException(Model.DepotPosition.PROPERTY_ID + "aa");
                //    }
                //}
            }
            depot.UpdateTime = DateTime.Now;
            accessor.Update(depot);
            if (depot.Details != null)
            {
                List <string> str = new List <string>();
                foreach (Model.DepotPosition dp in depot.Details)
                {
                    if (DepotPositionAccessor.existsInsertName(dp.DepotPositionId, depot))
                    {
                        dp.DepotId = depot.DepotId;
                        DepotPositionAccessor.Update(dp);
                    }
                    else
                    {
                        dp.DepotId = depot.DepotId;
                        DepotPositionAccessor.Insert(dp);
                    }
                    str.Add(dp.DepotPositionId);
                }
                foreach (Model.DepotPosition DepotPosition in DepotPositionAccessor.Select(depot))
                {
                    if (!str.Contains(DepotPosition.DepotPositionId))
                    {
                        DepotPositionAccessor.Delete(DepotPosition.DepotPositionId);
                    }
                }
            }
        }
예제 #10
0
        private void Validate(Model.Depot depot)
        {
            if (string.IsNullOrEmpty(depot.Id))
            {
                throw new Helper.RequireValueException(Model.Depot.PRO_Id);
            }


            //if (string.IsNullOrEmpty(depot.))
            //{
            //    throw new Helper.RequireValueException(Model.Depot.PROPERTY_DEPOTNAME);
            //}
        }
예제 #11
0
 private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
 {
     if (flag == 0)
     {
         if (e.Node.Tag != null)
         {
             this.action = "view";
             depot       = this.depotManager.SelectByDepot(e.Node.Tag.ToString());
             //this.bindingSource1.DataSource = this.depotPositionManager.Select(depot.DepotId);
             this.Refresh();
         }
     }
 }
예제 #12
0
 private void newChooseContorlDepot_EditValueChanged(object sender, EventArgs e)
 {
     Model.Depot depot = this.newChooseContorlDepot.EditValue as Model.Depot;
     if (depot != null)
     {
         this.newChooseContorlDepotPosition.Choose    = new Book.UI.Invoices.ChooseDepotPosition(depot);
         this.newChooseContorlDepotPosition.EditValue = null;
     }
     else
     {
         this.newChooseContorlDepotPosition.Choose    = null;
         this.newChooseContorlDepotPosition.EditValue = null;
     }
 }
예제 #13
0
 public void MyLeave(ref ChooseItem item)
 {
     BL.DepotManager manager = new Book.BL.DepotManager();
     Model.Depot     depot   = manager.GetById(item.ButtonText);
     if (depot != null)
     {
         item.EditValue  = depot;
         item.LabelText  = depot.DepotName;
         item.ButtonText = depot.Id;
     }
     else
     {
         item.ErrorMessage = Properties.Resources.ChooseDepotError;
     }
 }
        private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            IList <Model.ProduceOtherMaterial> list = this.bindingSourceProduceOtherMaterial.DataSource as IList <Model.ProduceOtherMaterial>;

            if (list == null || list.Count == 0)
            {
                return;
            }
            Model.Employee  employee0 = list[e.ListSourceRowIndex].Employee0;
            Model.Employee  employee1 = list[e.ListSourceRowIndex].Employee1;
            Model.WorkHouse workHouse = list[e.ListSourceRowIndex].WorkHouse;
            Model.Depot     depot     = list[e.ListSourceRowIndex].Depot;
            switch (e.Column.Name)
            {
            case "gridColumnDepot":
                if (depot != null)
                {
                    e.DisplayText = string.IsNullOrEmpty(depot.DepotId) ? "" : depot.ToString();
                }
                break;

            case "gridColumnEmployee0Id":
                if (employee0 != null)
                {
                    e.DisplayText = string.IsNullOrEmpty(employee0.EmployeeId) ? "" : employee0.ToString();
                }
                break;

            case "gridColumnWorkHouseId":
                if (workHouse != null)
                {
                    e.DisplayText = string.IsNullOrEmpty(workHouse.WorkHouseId) ? "" : workHouse.ToString();
                }
                break;

            case "gridColumnEmployee1Id":
                if (employee1 != null)
                {
                    e.DisplayText = string.IsNullOrEmpty(employee1.EmployeeId) ? "" : employee1.ToString();
                }
                break;
            }
        }
예제 #15
0
 private void buttonEditDepot_EditValueChanged(object sender, EventArgs e)
 {
     Model.Depot depot = this.buttonEditDepot.EditValue as Model.Depot;
     if (depot != null)
     {
         this.bindingSourceDepotPosition.DataSource = this.depotPositionManager.Select(depot);
     }
     else
     {
         this.bindingSourceDepotPosition.Clear();
         foreach (Model.InvoiceXTDetail detail in this.invoice.Details)
         {
             detail.DepotPosition   = null;
             detail.DepotPositionId = null;
         }
     }
 }
예제 #16
0
        /// <summary>
        /// Insert a Depot.
        /// </summary>
        public void Insert(Model.Depot depot)
        {
            //
            // todo:add other logic here
            //
            Validate(depot);
            if (this.Exists(depot.Id))
            {
                throw new Helper.InvalidValueException(Model.Depot.PRO_Id);
            }
            foreach (Model.DepotPosition dp in depot.Details)
            {
                if (string.IsNullOrEmpty(dp.Id))
                {
                    throw new Helper.RequireValueException(Model.DepotPosition.PROPERTY_ID + "aa");
                }

                if (DepotPositionAccessor.existsInsertName(dp.Id, depot))
                {
                    throw new Helper.InvalidValueException(Model.DepotPosition.PROPERTY_ID + "aa");
                }
            }
            try
            {
                BL.V.BeginTransaction();
                depot.InsertTime = DateTime.Now;
                accessor.Insert(depot);
                if (depot.Details != null)
                {
                    foreach (Model.DepotPosition dp in depot.Details)
                    {
                        dp.DepotPositionId = Guid.NewGuid().ToString();
                        dp.DepotId         = depot.DepotId;
                        DepotPositionAccessor.Insert(dp);
                    }
                }
                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
예제 #17
0
 protected override void Delete()
 {
     if (this.depot == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
     {
         return;
     }
     this.depotManager.Delete(this.depot);
     this.depot = this.depotManager.GetNext(this.depot);
     if (this.depot == null)
     {
         this.depot = this.depotManager.GetLast();
     }
     flag = 1;
     band();
 }
예제 #18
0
 public ChooseDepotPositionForm(Model.Depot depot)
 {
     InitializeComponent();
     this.manager = new BL.DepotPositionManager();
     this._depot  = depot;
 }
예제 #19
0
 public Model.Depot GetPrev(Model.Depot e)
 {
     return(sqlmapper.QueryForObject <Model.Depot>("Depot.get_prev", e));
 }
예제 #20
0
 public Model.Depot GetNext(Model.Depot e)
 {
     return(sqlmapper.QueryForObject <Model.Depot>("Depot.get_next", e));
 }
예제 #21
0
 public bool HasRowsAfter(Model.Depot e)
 {
     return(sqlmapper.QueryForObject <bool>("Depot.has_rows_after", e));
 }
예제 #22
0
 public bool HasRowsBefore(Model.Depot e)
 {
     return(sqlmapper.QueryForObject <bool>("Depot.has_rows_before", e));
 }
예제 #23
0
 public void Update(Model.Depot e)
 {
     this.Update <Model.Depot>(e);
 }
예제 #24
0
 public void Insert(Model.Depot e)
 {
     this.Insert <Model.Depot>(e);
 }
예제 #25
0
 public IList <Model.Product> Select(Model.Depot depot)
 {
     return(accessor.Select(depot));
 }
예제 #26
0
        public IList <Book.Model.InvoiceXSDetail> Select(DateTime startDate, DateTime endDate, Model.Employee employee, Model.Customer customer, Model.Depot depot)
        {
            Hashtable pars = new Hashtable();

            pars.Add("startdate", startDate);
            pars.Add("enddate", endDate);
            pars.Add("customerid", customer == null ? null : customer.CustomerId);
            pars.Add("employeeId", employee == null ? null : employee.EmployeeId);
            pars.Add("depotid", depot == null ? null : depot.DepotId);
            return(sqlmapper.QueryForList <Model.InvoiceXSDetail>("InvoiceXSDetail.selectByCustomEmpDepetQuJian", pars));
        }
예제 #27
0
 protected override void MoveFirst()
 {
     this.depot = this.depotManager.GetFirst();
 }
 public IList <Book.Model.ProduceInDepotDetail> SelectList(string startPronoteHeader, string endPronoteHeader, DateTime startDate, DateTime endDate, Model.Product product, Model.WorkHouse work, Model.Depot mDepot, Model.DepotPosition mDepotPosition, string id1, string id2, string cusxoid, Model.Customer customer1, Model.Customer customer2, int ProductState, string handBookId)
 {
     return(accessor.SelectList(startPronoteHeader, endPronoteHeader, startDate, endDate, product, work, mDepot, mDepotPosition, id1, id2, cusxoid, customer1, customer2, ProductState, handBookId));
 }
예제 #29
0
 protected override void MoveLast()
 {
     this.depot = this.depotManager.GetLast();
 }
예제 #30
0
        public override void Refresh()
        {
            if (this.depot == null)
            {
                this.depot         = new Book.Model.Depot();
                this.depot.Details = new List <Model.DepotPosition>();

                this.action = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this.depot = this.depotManager.GetDetails(depot.DepotId);
                }
            }
            if (this.action == "insert" || (this.action == "update" && this.depot.Details.Count == 0))
            {
                Model.DepotPosition detail = new Model.DepotPosition();
                detail.DepotPositionId = Guid.NewGuid().ToString();
                detail.Depot           = this.depot;
                this.depot.Details.Add(detail);
                this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
            }

            this.textEditId.Text        = this.depot.Id;
            this.textEditDepotName.Text = this.depot.DepotName;
            //this.textEditKeeper.Text = this.depot.StoreKeeper;
            this.textEditFax.Text              = this.depot.Fax;
            this.textEditTelphone.Text         = this.depot.Telphone;
            this.textEditDepotAddress.Text     = this.depot.DepotAddress;
            this.textEditBarCode.Text          = this.depot.DepotCode;
            this.textEditDepotDescription.Text = this.depot.DepotDescription;
            //this.comboBoxEditDepot.Text = this.depot.DepotTypeName;
            // this.radioGroup1.SelectedIndex =this.depot.IsFinalProductDepot==true?1:0 ;
            this.bindingSource1.DataSource = this.depot.Details;
            this.gridControl1.RefreshDataSource();
            flag = 1;
            if (this.action != "view")
            {
                band();
            }

            this.textEditDepotName.EditValue = this.depot.DepotName;
            flag = 0;
            switch (this.action)
            {
            case "insert":
                this.textEditId.Properties.ReadOnly        = false;
                this.textEditDepotName.Properties.ReadOnly = false;
                //this.textEditKeeper.Properties.ReadOnly = false;
                this.textEditFax.Properties.ReadOnly              = false;
                this.textEditTelphone.Properties.ReadOnly         = false;
                this.textEditDepotAddress.Properties.ReadOnly     = false;
                this.textEditDepotDescription.Properties.ReadOnly = false;
                this.textEditBarCode.Properties.ReadOnly          = false;
                //this.comboBoxEditDepot.Properties.ReadOnly = false;
                //this.comboBoxEditDepot.Properties.Buttons[0].Visible = true;
                this.gridView1.OptionsBehavior.Editable = true;
                break;

            case "update":
                this.textEditId.Properties.ReadOnly        = false;
                this.textEditDepotName.Properties.ReadOnly = false;
                //this.textEditKeeper.Properties.ReadOnly = false;
                this.textEditFax.Properties.ReadOnly              = false;
                this.textEditTelphone.Properties.ReadOnly         = false;
                this.textEditDepotAddress.Properties.ReadOnly     = false;
                this.textEditDepotDescription.Properties.ReadOnly = false;
                this.textEditBarCode.Properties.ReadOnly          = false;
                //this.comboBoxEditDepot.Properties.ReadOnly = false;
                //this.comboBoxEditDepot.Properties.Buttons[0].Visible = true;
                this.gridView1.OptionsBehavior.Editable = true;
                break;

            case "view":
                this.textEditId.Properties.ReadOnly        = true;
                this.textEditDepotName.Properties.ReadOnly = true;
                //this.textEditKeeper.Properties.ReadOnly = true;
                this.textEditFax.Properties.ReadOnly              = true;
                this.textEditTelphone.Properties.ReadOnly         = true;
                this.textEditDepotAddress.Properties.ReadOnly     = true;
                this.textEditDepotDescription.Properties.ReadOnly = true;
                this.textEditBarCode.Properties.ReadOnly          = true;
                //this.comboBoxEditDepot.Properties.ReadOnly = true;
                //this.comboBoxEditDepot.Properties.Buttons[0].Visible = false;
                this.gridView1.OptionsBehavior.Editable = false;
                break;

            default:
                break;
            }
            base.Refresh();
        }