Beispiel #1
0
 protected override void Delete()
 {
     if (this.depotPosition == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
     {
         return;
     }
     try
     {
         this.depotPositionManager.Delete(this.depotPosition.DepotPositionId);
     }
     catch (Helper.InvalidValueException ex)
     {
         if (this.invalidValueExceptions.ContainsKey(ex.Message))
         {
             AA a = this.invalidValueExceptions[ex.Message];
             MessageBox.Show(a.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         throw;
     }
     this.depotPosition = this.depotPositionManager.GetNext(this.depotPosition);
     if (this.depotPosition == null)
     {
         this.depotPosition = this.depotPositionManager.GetLast();
     }
 }
 /// <summary>
 /// Delete DepotPosition by primary key.
 /// </summary>
 public void Delete(Model.DepotPosition depotpositon)
 {
     //
     // todo:add other logic here
     //
     accessor.Delete(depotpositon.DepotPositionId);
 }
        public bool ExistsExcept(Model.DepotPosition e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.DepotPositionId) == null?null:Get(e.DepotPositionId).Id);
            return(sqlmapper.QueryForObject <bool>("DepotPosition.existsexcept", paras));
        }
 private void simpleButtonAppend_Click(object sender, EventArgs e)
 {
     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.gridControl1.RefreshDataSource();
 }
        public void MyClick(ref ChooseItem item)
        {
            ChooseDepotPositionForm f = new ChooseDepotPositionForm(this.depot);

            if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Model.DepotPosition depotPosition = f.SelectedItem as Model.DepotPosition;
                item = new ChooseItem(depotPosition, depotPosition.Id, depotPosition.DepotPositionName);
            }
        }
Beispiel #6
0
        protected override void MovePrev()
        {
            Model.DepotPosition position = this.depotPositionManager.GetPrev(this.depotPosition);
            if (position == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.depotPosition = position;
        }
Beispiel #7
0
        private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            Model.Product       p        = null;
            Model.DepotPosition position = null;

            if (this.action != "view")
            {
                IList <Model.InvoiceJRDetail> invoiceJcDetails = this.bindingSource1.DataSource as IList <Model.InvoiceJRDetail>;

                if (invoiceJcDetails == null || invoiceJcDetails.Count <= 0)
                {
                    return;
                }
                p        = invoiceJcDetails[e.ListSourceRowIndex].Product;
                position = invoiceJcDetails[e.ListSourceRowIndex].DepotPosition;
            }
            else
            {
                IList <Model.InvoiceHCDetail> invoiceHrDetails = this.bindingSource1.DataSource as IList <Model.InvoiceHCDetail>;
                if (invoiceHrDetails == null || invoiceHrDetails.Count <= 0)
                {
                    return;
                }
                p        = invoiceHrDetails[e.ListSourceRowIndex].Product;
                position = invoiceHrDetails[e.ListSourceRowIndex].DepotPosition;
            }

            switch (e.Column.Name)
            {
            //case "gridColumn2":
            //    e.DisplayText = p.Id;
            //    break;
            //case "gridColumn3":
            //    e.DisplayText = p.ProductName;
            //    break;
            case "gridColumn4":
                e.DisplayText = p.ProductSpecification;
                break;

            case "gridColumn5":
                e.DisplayText = p.ProductSpecification;
                break;
                //case "gridColumn6":
                //    e.DisplayText = p.ProduceUnit == null ? "" : p.ProduceUnit.CnName;
                //    break;

                //case "gridColumn10":
                //    e.DisplayText = position == null ? "" : position.ToString();
                //    break;
            }
        }
 private void Validate(Model.DepotPosition depotPosition)
 {
     if (string.IsNullOrEmpty(depotPosition.Id))
     {
         throw new Helper.RequireValueException(Model.DepotPosition.PROPERTY_ID);
     }
     if (depotPosition.DepotId == null)
     {
         throw new Helper.RequireValueException(Model.DepotPosition.PROPERTY_DEPOTID);
     }
 }
 /// <summary>
 /// Update a DepotPosition.
 /// </summary>
 public void Update(Model.DepotPosition depotPosition)
 {
     //
     // todo: add other logic here.
     //
     this.Validate(depotPosition);
     if (this.ExistsExcept(depotPosition))
     {
         throw new Helper.InvalidValueException(Model.DepotPosition.PROPERTY_ID);
     }
     depotPosition.DepotId    = depotPosition.Depot.DepotId;
     depotPosition.UpdateTime = DateTime.Now;
     accessor.Update(depotPosition);
 }
 public void MyLeave(ref ChooseItem item)
 {
     BL.DepotPositionManager manager       = new Book.BL.DepotPositionManager();
     Model.DepotPosition     depotPosition = manager.GetById(item.ButtonText);
     if (depotPosition != null)
     {
         item.EditValue  = depotPosition;
         item.LabelText  = depotPosition.DepotPositionName;
         item.ButtonText = depotPosition.Id;
     }
     else
     {
         item.ErrorMessage = Properties.Resources.ChooseDepotError;
     }
 }
        /// <summary>
        /// Insert a DepotPosition.
        /// </summary>
        public void Insert(Model.DepotPosition depotPosition)
        {
            //
            // todo:add other logic here
            //

            this.Validate(depotPosition);
            if (this.Exists(depotPosition.Id))
            {
                throw new Helper.InvalidValueException(Model.DepotPosition.PROPERTY_ID);
            }
            depotPosition.DepotPositionId = Guid.NewGuid().ToString();
            depotPosition.DepotId         = depotPosition.DepotId;
            depotPosition.InsertTime      = DateTime.Now;
            accessor.Insert(depotPosition);
        }
        private void simpleButtonRemover_Click(object sender, EventArgs e)
        {
            if (this.bindingSource1.Current != null)
            {
                this.depot.Details.Remove(this.bindingSource1.Current as Book.Model.DepotPosition);

                if (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.gridControl1.RefreshDataSource();
            }
        }
Beispiel #13
0
        public override void Refresh()
        {
            if (this.depotPosition == null)
            {
                this.depotPosition = new Book.Model.DepotPosition();
                this.action        = "insert";

                this.textEditId.Text           = string.IsNullOrEmpty(this.depotPosition.Id) ? this.depotPosition.DepotPositionId : this.depotPosition.Id;
                this.memoEditDescription.Text  = this.depotPosition.DepotPositionDescription;
                this.buttonEditDepot.EditValue = this.depotPosition.Depot;

                switch (this.action)
                {
                case "insert":
                    this.textEditId.Properties.ReadOnly          = false;
                    this.memoEditDescription.Properties.ReadOnly = false;
                    this.buttonEditDepot.ShowButton     = true;
                    this.buttonEditDepot.ButtonReadOnly = false;
                    break;

                case "update":
                    this.textEditId.Properties.ReadOnly          = false;
                    this.memoEditDescription.Properties.ReadOnly = false;
                    this.buttonEditDepot.ShowButton     = true;
                    this.buttonEditDepot.ButtonReadOnly = false;
                    break;

                case "view":
                    this.textEditId.Properties.ReadOnly          = true;
                    this.memoEditDescription.Properties.ReadOnly = true;
                    this.buttonEditDepot.ShowButton     = false;
                    this.buttonEditDepot.ButtonReadOnly = true;
                    break;

                default:
                    break;
                }
                base.Refresh();
            }
        }
Beispiel #14
0
        private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            IList <Model.Stock> stock = this.bindingSourceStock.DataSource as IList <Model.Stock>;

            if (stock == null || stock.Count < 1)
            {
                return;
            }
            Model.DepotPosition depotposition = stock[e.ListSourceRowIndex].DepotPosition;
            if (depotposition == null)
            {
                return;
            }
            switch (e.Column.Name)
            {
            case "gridColumn1":
                e.DisplayText = depotposition.Id;
                break;
            }
        }
Beispiel #15
0
 /// <param name="position">model 對象</param>
 /// <param name="action">當前動作</param>
 public EditForm(Book.Model.DepotPosition position, string action)
     : this()
 {
     this.depotPosition = position;
     this.action        = action;
 }
 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));
 }
Beispiel #17
0
 /// <param name="position">model 對象</param>
 public EditForm(Book.Model.DepotPosition position)
     : this()
 {
     this.depotPosition = position;
     this.action        = "update";
 }
 public bool HasRowsAfter(Model.DepotPosition e)
 {
     return(accessor.HasRowsAfter(e));
 }
 public Model.DepotPosition GetNext(Model.DepotPosition e)
 {
     return(sqlmapper.QueryForObject <Model.DepotPosition>("DepotPosition.get_next", e));
 }
 public bool HasRowsBefore(Model.DepotPosition e)
 {
     return(sqlmapper.QueryForObject <bool>("DepotPosition.has_rows_before", e));
 }
 public bool ExistsExcept(Model.DepotPosition e)
 {
     return(accessor.ExistsExcept(e));
 }
 public Model.DepotPosition GetNext(Model.DepotPosition e)
 {
     return(accessor.GetNext(e));
 }
 public Model.DepotPosition GetPrev(Model.DepotPosition e)
 {
     return(accessor.GetPrev(e));
 }
 public void Insert(Model.DepotPosition e)
 {
     this.Insert <Model.DepotPosition>(e);
 }
 public void Update(Model.DepotPosition e)
 {
     this.Update <Model.DepotPosition>(e);
 }
Beispiel #26
0
 protected override void AddNew()
 {
     this.depotPosition = new Book.Model.DepotPosition();
 }
 public bool HasRowsAfter(Model.DepotPosition e)
 {
     return(sqlmapper.QueryForObject <bool>("DepotPosition.has_rows_after", e));
 }
        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();
        }
 public Model.DepotPosition GetPrev(Model.DepotPosition e)
 {
     return(sqlmapper.QueryForObject <Model.DepotPosition>("DepotPosition.get_prev", e));
 }
 public bool HasRowsBefore(Model.DepotPosition e)
 {
     return(accessor.HasRowsBefore(e));
 }