Пример #1
0
 public RelationXOForm(string invoiceXOCusId)
     : this()
 {
     this._relationXO = this.manager.SelectByInvoiceXOCusId(invoiceXOCusId);
     //if (this._relationXO != null)  //如果为Null,则提示
     this.LastFlag = 1;
 }
Пример #2
0
        /// <summary>
        /// Insert a RelationXO.
        /// </summary>
        public void Insert(Model.RelationXO relationXO)
        {
            //
            // todo:add other logic here
            //
            try
            {
                BL.V.BeginTransaction();

                relationXO.InsertTime = DateTime.Now;
                relationXO.UpdateTime = DateTime.Now;
                accessor.Insert(relationXO);

                foreach (var item in relationXO.Detail)
                {
                    detailaccessor.Insert(item);
                }
                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Пример #3
0
 public void Validate(Model.RelationXO model)
 {
     if (model.InvoiceXOId == null)
     {
         throw new Helper.InvalidValueException(Model.RelationXO.PRO_RelationXOId);
     }
 }
Пример #4
0
        protected override void AddNew()
        {
            this._relationXO = new Book.Model.RelationXO();
            this._relationXO.RelationXOId = Guid.NewGuid().ToString();
            this._relationXO.Employee     = BL.V.ActiveOperator.Employee;

            this.action = "insert";
        }
Пример #5
0
 protected override void MoveLast()
 {
     if (LastFlag == 1)
     {
         LastFlag = 0; return;
     }
     this._relationXO = this.manager.GetLast();
 }
Пример #6
0
 protected override void MoveNext()
 {
     Model.RelationXO p = this.manager.GetNext(this._relationXO);
     if (p == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._relationXO = p;
 }
Пример #7
0
 public Model.RelationXO GetDetail(string id)
 {
     Model.RelationXO model = this.Get(id);
     if (model != null)
     {
         model.Detail = detailaccessor.SelectByHeaderId(id);
     }
     return(model);
 }
Пример #8
0
        private void btn_Search_Click(object sender, EventArgs e)
        {
            SearchForm f = new SearchForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Model.RelationXO model = this.manager.SelectByInvoiceXOCusId(f.InvoiceCusId);
                if (model != null)
                {
                    this._relationXO = model;
                    this.Refresh();
                }
                else
                {
                    MessageBox.Show("沒有符合條件的項!", this.Text, MessageBoxButtons.OK);
                }
            }
        }
Пример #9
0
        public override void Refresh()
        {
            if (this._relationXO == null)
            {
                this.AddNew();
            }
            else
            {
                if (this.action == "view")
                {
                    this._relationXO = this.manager.GetDetail(this._relationXO.RelationXOId);
                }
            }
            this.txt_InvoiceXOId.EditValue = this._relationXO.InvoiceXOId;
            //this.txt_InvoiceCusId.EditValue = this._relationXO.InvoiceCusId;
            Model.InvoiceXO xo = new BL.InvoiceXOManager().Get(this._relationXO.InvoiceXOId);
            if (xo != null)
            {
                this.txt_InvoiceCusId.EditValue = xo.CustomerInvoiceXOId;
            }
            else
            {
                this.txt_InvoiceCusId.EditValue = null;
            }
            this.nccEmp.EditValue = this._relationXO.Employee;

            this.bindingSourceDetail.DataSource = this._relationXO.Detail;

            base.Refresh();
            this.txt_InvoiceCusId.Properties.ReadOnly = true;
            this.txt_InvoiceXOId.Properties.ReadOnly  = true;
            switch (this.action)
            {
            case "view":
                this.gridView1.OptionsBehavior.Editable = false;
                break;

            default:
                this.gridView1.OptionsBehavior.Editable = true;
                break;
            }
            this.btn_Search.Enabled = true;
        }
Пример #10
0
 protected override void Delete()
 {
     if (this._relationXO == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Model.RelationXO model = this.manager.GetNext(this._relationXO);
         this.manager.Delete(this._relationXO.RelationXOId);
         if (model == null)
         {
             this._relationXO = this.manager.GetLast();
         }
         else
         {
             this._relationXO = model;
         }
     }
 }
Пример #11
0
 /// <summary>
 /// Update a RelationXO.
 /// </summary>
 public void Update(Model.RelationXO relationXO)
 {
     //
     // todo: add other logic here.
     //
     try
     {
         BL.V.BeginTransaction();
         relationXO.UpdateTime = DateTime.Now;
         accessor.Update(relationXO);
         //刪除詳細
         detailaccessor.DeleteByHeaderId(relationXO.RelationXOId);
         foreach (var item in relationXO.Detail)
         {
             detailaccessor.Insert(item);
         }
         BL.V.CommitTransaction();
     }
     catch
     {
         BL.V.RollbackTransaction();
         throw;
     }
 }
Пример #12
0
 public bool HasRowsBefore(Model.RelationXO e)
 {
     return(accessor.HasRowsBefore(e));
 }
Пример #13
0
 public Model.RelationXO GetPrev(Model.RelationXO e)
 {
     return(accessor.GetPrev(e));
 }
Пример #14
0
 public void Insert(Model.RelationXO e)
 {
     this.Insert <Model.RelationXO>(e);
 }
Пример #15
0
 public Model.RelationXO GetNext(Model.RelationXO e)
 {
     return(accessor.GetNext(e));
 }
Пример #16
0
 protected override void MoveFirst()
 {
     this._relationXO = this.manager.GetFirst();
 }
Пример #17
0
 public void Update(Model.RelationXO e)
 {
     this.Update <Model.RelationXO>(e);
 }
Пример #18
0
 public bool HasRowsBefore(Model.RelationXO e)
 {
     return(sqlmapper.QueryForObject <bool>("RelationXO.has_rows_before", e));
 }
Пример #19
0
 public bool HasRowsAfter(Model.RelationXO e)
 {
     return(sqlmapper.QueryForObject <bool>("RelationXO.has_rows_after", e));
 }
Пример #20
0
 public Model.RelationXO GetNext(Model.RelationXO e)
 {
     return(sqlmapper.QueryForObject <Model.RelationXO>("RelationXO.get_next", e));
 }
Пример #21
0
 public bool HasRowsAfter(Model.RelationXO e)
 {
     return(accessor.HasRowsAfter(e));
 }
Пример #22
0
 public Model.RelationXO GetPrev(Model.RelationXO e)
 {
     return(sqlmapper.QueryForObject <Model.RelationXO>("RelationXO.get_prev", e));
 }