Esempio n. 1
0
 protected override void MoveLast()
 {
     if (this.atProperty == null)
     {
         this.atProperty = this.atPropertyManager.GetLast();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Insert a AtProperty.
        /// </summary>
        public void Insert(Model.AtProperty atProperty)
        {
            //
            // todo:add other logic here
            //
            Validate(atProperty);
            atProperty.PropertyId = Guid.NewGuid().ToString();
            try
            {
                atProperty.InsertTime = DateTime.Now;
                BL.V.BeginTransaction();
                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, atProperty.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, atProperty.InsertTime.Value.Year, atProperty.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, atProperty.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);
                accessor.Insert(atProperty);
                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Esempio n. 3
0
        public bool ExistsExcept(Model.AtProperty e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.PropertyId) == null?null:Get(e.PropertyId).Id);
            return(sqlmapper.QueryForObject <bool>("AtProperty.existsexcept", paras));
        }
Esempio n. 4
0
 /// <summary>
 /// Update a AtProperty.
 /// </summary>
 public void Update(Model.AtProperty atProperty)
 {
     //
     // todo: add other logic here.
     //
     Validate(atProperty);
     atProperty.UpdateTime = DateTime.Now;
     accessor.Update(atProperty);
 }
Esempio n. 5
0
 protected override void MoveNext()
 {
     Model.AtProperty atProperty = this.atPropertyManager.GetNext(this.atProperty);
     if (atProperty == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this.atProperty = atProperty;
 }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        public void MyClick(ref ChooseItem item)
        {
            ChoosePropertyForm f = new ChoosePropertyForm();

            if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Model.AtProperty AtProperty = f.SelectedItem as Model.AtProperty;
                item = new ChooseItem(AtProperty, AtProperty.Id, AtProperty.PropertyName);
            }
        }
Esempio n. 7
0
 private void Validate(Model.AtProperty atProperty)
 {
     if (string.IsNullOrEmpty(atProperty.Id))
     {
         throw new Helper.RequireValueException(Model.AtProperty.PRO_Id);
     }
     if (string.IsNullOrEmpty(atProperty.PropertyName))
     {
         throw new Helper.RequireValueException(Model.AtProperty.PRO_PropertyName);
     }
 }
Esempio n. 8
0
 public void MyLeave(ref ChooseItem item)
 {
     BL.AtPropertyManager manager    = new Book.BL.AtPropertyManager();
     Model.AtProperty     AtProperty = manager.GetById(item.ButtonText);
     if (AtProperty != null)
     {
         item.EditValue  = AtProperty;
         item.LabelText  = AtProperty.Id;
         item.ButtonText = AtProperty.PropertyName;
     }
     else
     {
         item.ErrorMessage = "物料類型錯誤";
     }
 }
Esempio n. 9
0
 protected override void Delete()
 {
     if (this.atProperty == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
     {
         return;
     }
     this.atPropertyManager.Delete(this.atProperty.PropertyId);
     this.atProperty = this.atPropertyManager.GetNext(this.atProperty);
     if (this.atProperty == null)
     {
         this.atProperty = this.atPropertyManager.GetLast();
     }
 }
Esempio n. 10
0
 protected override void MoveFirst()
 {
     this.atProperty = this.atPropertyManager.GetFirst();
 }
Esempio n. 11
0
 public bool ExistsExcept(Model.AtProperty e)
 {
     return(accessor.ExistsExcept(e));
 }
Esempio n. 12
0
 protected override void AddNew()
 {
     this.atProperty    = new Model.AtProperty();
     this.atProperty.Id = this.atPropertyManager.GetId();
 }
Esempio n. 13
0
 public Model.AtProperty GetPrev(Model.AtProperty e)
 {
     return(sqlmapper.QueryForObject <Model.AtProperty>("AtProperty.get_prev", e));
 }
Esempio n. 14
0
 public Model.AtProperty GetNext(Model.AtProperty e)
 {
     return(sqlmapper.QueryForObject <Model.AtProperty>("AtProperty.get_next", e));
 }
Esempio n. 15
0
 public bool HasRowsAfter(Model.AtProperty e)
 {
     return(sqlmapper.QueryForObject <bool>("AtProperty.has_rows_after", e));
 }
Esempio n. 16
0
 public bool HasRowsBefore(Model.AtProperty e)
 {
     return(sqlmapper.QueryForObject <bool>("AtProperty.has_rows_before", e));
 }
Esempio n. 17
0
 public EditForm(Model.AtProperty atProperty)
     : this()
 {
     this.atProperty = atProperty;
     this.action     = "update";
 }
Esempio n. 18
0
 public bool HasRowsBefore(Model.AtProperty e)
 {
     return(accessor.HasRowsBefore(e));
 }
Esempio n. 19
0
 public bool HasRowsAfter(Model.AtProperty e)
 {
     return(accessor.HasRowsAfter(e));
 }
Esempio n. 20
0
 public Model.AtProperty GetPrev(Model.AtProperty e)
 {
     return(accessor.GetPrev(e));
 }
Esempio n. 21
0
 public Model.AtProperty GetNext(Model.AtProperty e)
 {
     return(accessor.GetNext(e));
 }
Esempio n. 22
0
        public override void Refresh()
        {
            if (this.atProperty == null)
            {
                this.atProperty = new Book.Model.AtProperty();
                this.action     = "insert";
            }
            this.textEditPropertyId.Text         = this.atProperty.Id;
            this.textEditPropertyName.Text       = this.atProperty.PropertyName;
            this.textEditSpecifications.Text     = this.atProperty.Specifications;
            this.textEditPosition.Text           = this.atProperty.Position;
            this.spinEditQuantity.EditValue      = this.atProperty.Quantity;
            this.textEditUnit.Text               = this.atProperty.Unit;
            this.spinEditDurableMonths.EditValue = this.atProperty.DurableMonths;
            if (global::Helper.DateTimeParse.DateTimeEquls(this.atProperty.ToDate, global::Helper.DateTimeParse.NullDate))
            {
                this.dateEditToDate.EditValue = null;
            }
            else
            {
                this.dateEditToDate.EditValue = this.atProperty.ToDate;
            }
            if (global::Helper.DateTimeParse.DateTimeEquls(this.atProperty.DepreciationDate, global::Helper.DateTimeParse.NullDate))
            {
                this.dateEditDepreciationDate.EditValue = null;
            }
            else
            {
                this.dateEditDepreciationDate.EditValue = this.atProperty.DepreciationDate;
            }
            this.spinEditReserveValue.EditValue          = this.atProperty.ReserveValue;
            this.spinEditObtainRegular.EditValue         = this.atProperty.ObtainRegular;
            this.comboBoxEditOften.EditValue             = this.atProperty.Often;
            this.spinEditDepreciationMoney.EditValue     = this.atProperty.DepreciationMoney;
            this.lookUpEditDepreciationSubject.EditValue = this.atProperty.DepreciationSubject;
            this.lookUpEditRespectiveSubject.EditValue   = this.atProperty.RespectiveSubject;
            this.lookUpEditCostSubject.EditValue         = this.atProperty.CostSubject;
            this.memoEditMark.Text = this.atProperty.Mark;
            switch (this.action)
            {
            case "insert":
                this.textEditPropertyId.Properties.ReadOnly                 = false;
                this.textEditPropertyName.Properties.ReadOnly               = false;
                this.textEditSpecifications.Properties.ReadOnly             = false;
                this.textEditPosition.Properties.ReadOnly                   = false;
                this.spinEditQuantity.Properties.ReadOnly                   = false;
                this.textEditUnit.Properties.ReadOnly                       = false;
                this.spinEditDurableMonths.Properties.ReadOnly              = false;
                this.dateEditDepreciationDate.Properties.ReadOnly           = false;
                this.dateEditDepreciationDate.Properties.Buttons[0].Visible = true;
                this.dateEditToDate.Properties.ReadOnly                     = false;
                this.dateEditToDate.Properties.Buttons[0].Visible           = true;

                this.spinEditReserveValue.Properties.ReadOnly          = false;
                this.spinEditObtainRegular.Properties.ReadOnly         = false;
                this.comboBoxEditOften.Properties.ReadOnly             = false;
                this.spinEditDepreciationMoney.Properties.ReadOnly     = false;
                this.lookUpEditDepreciationSubject.Properties.ReadOnly = false;
                this.lookUpEditRespectiveSubject.Properties.ReadOnly   = false;
                this.lookUpEditCostSubject.Properties.ReadOnly         = false;
                this.memoEditMark.Properties.ReadOnly = false;
                break;

            case "update":

                this.textEditPropertyId.Properties.ReadOnly                 = false;
                this.textEditPropertyName.Properties.ReadOnly               = false;
                this.textEditSpecifications.Properties.ReadOnly             = false;
                this.textEditPosition.Properties.ReadOnly                   = false;
                this.spinEditQuantity.Properties.ReadOnly                   = false;
                this.textEditUnit.Properties.ReadOnly                       = false;
                this.spinEditDurableMonths.Properties.ReadOnly              = false;
                this.dateEditDepreciationDate.Properties.ReadOnly           = false;
                this.dateEditDepreciationDate.Properties.Buttons[0].Visible = true;
                this.dateEditToDate.Properties.ReadOnly                     = false;
                this.dateEditToDate.Properties.Buttons[0].Visible           = true;

                this.spinEditReserveValue.Properties.ReadOnly          = false;
                this.spinEditObtainRegular.Properties.ReadOnly         = false;
                this.comboBoxEditOften.Properties.ReadOnly             = false;
                this.spinEditDepreciationMoney.Properties.ReadOnly     = false;
                this.lookUpEditDepreciationSubject.Properties.ReadOnly = false;
                this.lookUpEditRespectiveSubject.Properties.ReadOnly   = false;
                this.lookUpEditCostSubject.Properties.ReadOnly         = false;
                this.memoEditMark.Properties.ReadOnly = false;
                break;

            case "view":

                this.textEditPropertyId.Properties.ReadOnly                 = true;
                this.textEditPropertyName.Properties.ReadOnly               = true;
                this.textEditSpecifications.Properties.ReadOnly             = true;
                this.textEditPosition.Properties.ReadOnly                   = true;
                this.spinEditQuantity.Properties.ReadOnly                   = true;
                this.textEditUnit.Properties.ReadOnly                       = true;
                this.spinEditDurableMonths.Properties.ReadOnly              = true;
                this.dateEditDepreciationDate.Properties.ReadOnly           = true;
                this.dateEditDepreciationDate.Properties.Buttons[0].Visible = false;
                this.dateEditToDate.Properties.ReadOnly                     = true;
                this.dateEditToDate.Properties.Buttons[0].Visible           = false;

                this.spinEditReserveValue.Properties.ReadOnly          = true;
                this.spinEditObtainRegular.Properties.ReadOnly         = true;
                this.comboBoxEditOften.Properties.ReadOnly             = true;
                this.spinEditDepreciationMoney.Properties.ReadOnly     = true;
                this.lookUpEditDepreciationSubject.Properties.ReadOnly = true;
                this.lookUpEditRespectiveSubject.Properties.ReadOnly   = true;
                this.lookUpEditCostSubject.Properties.ReadOnly         = true;
                this.memoEditMark.Properties.ReadOnly = true;
                break;

            default:
                break;
            }
            base.Refresh();
        }
Esempio n. 23
0
 public void Insert(Model.AtProperty e)
 {
     this.Insert <Model.AtProperty>(e);
 }
Esempio n. 24
0
 public EditForm(Model.AtProperty atProperty, string action)
     : this()
 {
     this.atProperty = atProperty;
     this.action     = action;
 }
Esempio n. 25
0
 public void Update(Model.AtProperty e)
 {
     this.Update <Model.AtProperty>(e);
 }