Example #1
0
        protected override void AddNew()
        {
            this._PCIncomingCheck = new Book.Model.PCIncomingCheck();
            this._PCIncomingCheck.PCIncomingCheckId = this.manager.GetId();
            this._PCIncomingCheck.CheckDate         = DateTime.Now;
            this._PCIncomingCheck.Employee          = BL.V.ActiveOperator.Employee;

            this.action = "insert";
        }
Example #2
0
 protected override void MovePrev()
 {
     Model.PCIncomingCheck p = this.manager.GetPrev(this._PCIncomingCheck);
     if (p == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._PCIncomingCheck = p;
 }
Example #3
0
 public Model.PCIncomingCheck GetDetail(string PCIncomingCheckId)
 {
     Model.PCIncomingCheck model = this.Get(PCIncomingCheckId);
     if (model != null)
     {
         model.Detail = accessorDetail.SelectByPrimaryId(PCIncomingCheckId);
     }
     return(model);
 }
Example #4
0
 public EditForm(string PCIncomingCheckId)
     : this()
 {
     this._PCIncomingCheck = this.manager.Get(PCIncomingCheckId);
     this.action           = "view";
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
Example #5
0
 public EditForm(Model.PCIncomingCheck model, string action)
     : this()
 {
     if (model == null)
     {
         throw new ArithmeticException("invoiceid");
     }
     this._PCIncomingCheck = model;
     this.action           = action;
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
Example #6
0
 private void TiGuiExists(Model.PCIncomingCheck model)
 {
     if (this.ExistsPrimary(model.PCIncomingCheckId))
     {
         //设置KEY值
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.InsertTime.Value.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InsertTime.Value.Year, model.InsertTime.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd"));
         string sequencekey   = string.Format(invoiceKind);
         SequenceManager.Increment(sequencekey_y);
         SequenceManager.Increment(sequencekey_m);
         SequenceManager.Increment(sequencekey_d);
         SequenceManager.Increment(sequencekey);
         model.PCIncomingCheckId = this.GetId(model.InsertTime.Value);
         TiGuiExists(model);
     }
 }
Example #7
0
 protected override void Delete()
 {
     if (this._PCIncomingCheck == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Model.PCIncomingCheck model = this.manager.GetNext(this._PCIncomingCheck);
         this.manager.Delete(this._PCIncomingCheck.PCIncomingCheckId);
         if (model == null)
         {
             this._PCIncomingCheck = this.manager.GetLast();
         }
         else
         {
             this._PCIncomingCheck = model;
         }
     }
 }
Example #8
0
        /// <summary>
        /// Insert a PCIncomingCheck.
        /// </summary>
        public void Insert(Model.PCIncomingCheck pCIncomingCheck)
        {
            //
            // todo:add other logic here
            //
            try
            {
                BL.V.BeginTransaction();
                pCIncomingCheck.InsertTime = DateTime.Now;
                pCIncomingCheck.UpdateTime = DateTime.Now;
                this.Validate(pCIncomingCheck);
                this.TiGuiExists(pCIncomingCheck);

                accessor.Insert(pCIncomingCheck);

                //设置KEY值
                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, pCIncomingCheck.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, pCIncomingCheck.InsertTime.Value.Year, pCIncomingCheck.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, pCIncomingCheck.InsertTime.Value.ToString("yyyy-MM-dd"));
                string sequencekey   = string.Format(invoiceKind);
                SequenceManager.Increment(sequencekey_y);
                SequenceManager.Increment(sequencekey_m);
                SequenceManager.Increment(sequencekey_d);
                SequenceManager.Increment(sequencekey);

                foreach (var item in pCIncomingCheck.Detail)
                {
                    accessorDetail.Insert(item);
                }
                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Example #9
0
        public override void Refresh()
        {
            if (this._PCIncomingCheck == null)
            {
                this.AddNew();
            }
            else
            {
                if (this.action == "view")
                {
                    this._PCIncomingCheck = this.manager.GetDetail(this._PCIncomingCheck.PCIncomingCheckId);
                }
            }

            this.txt_Id.Text = this._PCIncomingCheck.PCIncomingCheckId;
            this.date_PurchaseDate.EditValue = this._PCIncomingCheck.PurchaseDate;
            this.date_IncomingDate.EditValue = this._PCIncomingCheck.IncomingDate;
            this.date_CheckDate.EditValue    = this._PCIncomingCheck.CheckDate;
            this.txt_materialCategory.Text   = this._PCIncomingCheck.MaterialCategory;
            this.nccEmployee.EditValue       = this._PCIncomingCheck.Employee;
            this.txt_Pihao.Text = this._PCIncomingCheck.Note;
            this.bindingSourceDetail.DataSource = this._PCIncomingCheck.Detail;

            base.Refresh();

            switch (this.action)
            {
            case "view":
                this.gridView1.OptionsBehavior.Editable = false;
                break;

            default:
                this.gridView1.OptionsBehavior.Editable = true;
                break;
            }

            this.txt_Id.Properties.ReadOnly = true;
        }
Example #10
0
 public bool HasRowsAfter(Model.PCIncomingCheck e)
 {
     return(sqlmapper.QueryForObject <bool>("PCIncomingCheck.has_rows_after", e));
 }
Example #11
0
 public bool HasRowsBefore(Model.PCIncomingCheck e)
 {
     return(sqlmapper.QueryForObject <bool>("PCIncomingCheck.has_rows_before", e));
 }
Example #12
0
 public void Update(Model.PCIncomingCheck e)
 {
     this.Update <Model.PCIncomingCheck>(e);
 }
Example #13
0
 public void Insert(Model.PCIncomingCheck e)
 {
     this.Insert <Model.PCIncomingCheck>(e);
 }
Example #14
0
 public Model.PCIncomingCheck GetNext(Model.PCIncomingCheck e)
 {
     return(accessor.GetNext(e));
 }
Example #15
0
 public Model.PCIncomingCheck GetPrev(Model.PCIncomingCheck e)
 {
     return(accessor.GetPrev(e));
 }
Example #16
0
 public bool HasRowsAfter(Model.PCIncomingCheck e)
 {
     return(accessor.HasRowsAfter(e));
 }
Example #17
0
 public Model.PCIncomingCheck GetNext(Model.PCIncomingCheck e)
 {
     return(sqlmapper.QueryForObject <Model.PCIncomingCheck>("PCIncomingCheck.get_next", e));
 }
Example #18
0
 protected override void MoveFirst()
 {
     this._PCIncomingCheck = this.manager.GetFirst();
 }
Example #19
0
 public Model.PCIncomingCheck GetPrev(Model.PCIncomingCheck e)
 {
     return(sqlmapper.QueryForObject <Model.PCIncomingCheck>("PCIncomingCheck.get_prev", e));
 }
Example #20
0
 public bool HasRowsBefore(Model.PCIncomingCheck e)
 {
     return(accessor.HasRowsBefore(e));
 }