Пример #1
0
        public ROCustomer(Model.Customer customer)
            : this()
        {
            this.lblCompanyName.Text = BL.Settings.CompanyChineseName;
            this.lblReportName.Text  = "¿Í‘ô»ù±¾ÙYÁÏ";

            this.lblCustomerNumber.Text    = customer.CustomerNumber;
            this.lblId.Text                = customer.Id;
            this.lblCustomerFullName.Text  = customer.CustomerFullName;
            this.lblCustomerShortName.Text = customer.CustomerShortName;

            Model.CompanyLevel level = this.companyLevelManager.Get(customer.CompanyLevelId);
            if (level != null)
            {
                this.lblCustomerLevel.Text = level.CompanyLevelId + @"-" + level.CompanyLevelName;
            }
            this.lblCustomerPhone.Text          = customer.CustomerPhone;
            this.lblCustomerPhone1.Text         = customer.CustomerPhone1;
            this.lblCustomerFax.Text            = customer.CustomerFax;
            this.lblCustomerMobile.Text         = customer.CustomerMobile;
            this.lblCustomerPayDate.Text        = customer.CustomerPayDate.HasValue ? customer.CustomerPayDate.ToString() : "";
            this.lblCustomerContact.Text        = customer.CustomerContact;
            this.lblCustomerManager.Text        = customer.CustomerManager;
            this.lblCustomerEMail.Text          = customer.CustomerEMail;
            this.lblLastTransactionDate.Text    = customer.LastTransactionDate.HasValue ? customer.LastTransactionDate.Value.ToString("yyyy-MM-dd") : "";
            this.lblCustomerAddress.Text        = customer.CustomerAddress;
            this.lblCustomerJinChuAddress.Text  = customer.CustomerJinChuAddress;
            this.lblCustomerWebSiteAddress.Text = customer.CustomerWebSiteAddress;
            this.lblCheckedStandard.Text        = customer.CheckedStandard;
            this.lblCustomerFP.Text             = customer.CustomerFP;
            this.lblCustomerDescription.Rtf     = customer.CustomerDescription;
        }
Пример #2
0
        public override void Refresh()
        {
            if (this.companyLevel == null)
            {
                this.companyLevel = new Book.Model.CompanyLevel();
                this.action       = "insert";
            }

            this.CompanyLevelIdTextEdit.EditValue   = this.companyLevel.CompanyLevelId;
            this.CompanyLevelNameTextEdit.EditValue = this.companyLevel.CompanyLevelName;
            switch (this.action)
            {
            case "insert":
                this.CompanyLevelIdTextEdit.Properties.ReadOnly   = false;
                this.CompanyLevelNameTextEdit.Properties.ReadOnly = false;
                break;

            case "update":

                this.CompanyLevelIdTextEdit.Properties.ReadOnly   = false;
                this.CompanyLevelNameTextEdit.Properties.ReadOnly = false;

                break;

            case "view":

                this.CompanyLevelIdTextEdit.Properties.ReadOnly   = true;
                this.CompanyLevelNameTextEdit.Properties.ReadOnly = true;
                break;

            default:
                break;
            }
            base.Refresh();
        }
Пример #3
0
 public EditForm(Model.CompanyLevel level, string action)
     : this()
 {
     //if (level == null)
     //    throw new ArithmeticException();
     this.companyLevel = level;
     this.action       = action;
 }
Пример #4
0
 public EditForm(Model.CompanyLevel level) : this()
 {
     //if (level == null)
     //    throw new ArithmeticException();
     // oldId =level.CompanyLevelId;
     this.companyLevel = level;
     this.action       = "update";
 }
Пример #5
0
 /// <summary>
 /// Update a CompanyLevel.
 /// </summary>
 public void Update(Model.CompanyLevel companyLevel)
 {
     //
     // todo: add other logic here.
     //
     Validate(companyLevel);
     companyLevel.UpdateTime = DateTime.Now;
     accessor.Update(companyLevel);
 }
Пример #6
0
        protected override void MovePrev()
        {
            Model.CompanyLevel companyLevel = this.companyLevelManager.GetPrev(this.companyLevel);
            if (companyLevel == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.companyLevel = companyLevel;
        }
Пример #7
0
 private void Validate(Model.CompanyLevel companyLevel)
 {
     if (string.IsNullOrEmpty(companyLevel.CompanyLevelId))
     {
         throw new Helper.RequireValueException(Model.CompanyLevel.PROPERTY_COMPANYLEVELID);
     }
     if (string.IsNullOrEmpty(companyLevel.CompanyLevelName))
     {
         throw new Helper.RequireValueException(Model.CompanyLevel.PROPERTY_COMPANYLEVELNAME);
     }
 }
Пример #8
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataRowView dr = this.companyLevelBindingSource.Current as DataRowView;

            Model.CompanyLevel model = null;
            if (dr != null)
            {
                model = this.companyLevelManager.Get(dr[0].ToString());
            }
            if (model != null)
            {
                EditForm f = new EditForm(model);
                f.ShowDialog(this);
                this.companyLevelBindingSource.DataSource = this.companyLevelManager.SelectDateTable();
            }
        }
Пример #9
0
        /// <summary>
        /// Insert a CompanyLevel.
        /// </summary>
        public void Insert(Model.CompanyLevel companyLevel)
        {
            //
            // todo:add other logic here
            //
            Validate(companyLevel);

            if (this.HasRows(companyLevel.CompanyLevelId))
            {
                throw new Helper.InvalidValueException(Model.CompanyLevel.PROPERTY_COMPANYLEVELID);
            }

            companyLevel.InsertTime = DateTime.Now;
            companyLevel.UpdateTime = DateTime.Now;

            accessor.Insert(companyLevel);
        }
Пример #10
0
 protected override void Delete()
 {
     if (this.companyLevel == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
     {
         return;
     }
     this.companyLevelManager.Delete(this.companyLevel);
     this.companyLevel = this.companyLevelManager.GetNext(this.companyLevel);
     if (this.companyLevel == null)
     {
         this.companyLevel = this.companyLevelManager.GetLast();
     }
 }
Пример #11
0
 public Model.CompanyLevel GetNext(Model.CompanyLevel e)
 {
     return(sqlmapper.QueryForObject <Model.CompanyLevel>("CompanyLevel.get_next", e));
 }
Пример #12
0
 public bool HasRowsBefore(Model.CompanyLevel e)
 {
     return(accessor.HasRowsBefore(e));
 }
Пример #13
0
 public void Delete(Model.CompanyLevel companyLevel)
 {
     this.Delete(companyLevel.CompanyLevelId);
 }
Пример #14
0
 protected override void MoveLast()
 {
     this.companyLevel = this.companyLevelManager.GetLast();
 }
Пример #15
0
 public bool HasRowsAfter(Model.CompanyLevel e)
 {
     return(accessor.HasRowsAfter(e));
 }
Пример #16
0
 protected override void AddNew()
 {
     this.companyLevel = new Model.CompanyLevel();
 }
Пример #17
0
 public Model.CompanyLevel GetPrev(Model.CompanyLevel e)
 {
     return(accessor.GetPrev(e));
 }
Пример #18
0
 public Model.CompanyLevel GetPrev(Model.CompanyLevel e)
 {
     return(sqlmapper.QueryForObject <Model.CompanyLevel>("CompanyLevel.get_prev", e));
 }
Пример #19
0
        public override void Refresh()
        {
            if (this._customer == null)
            {
                this.AddNew();
                this.action = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    if (this._customer.CustomerId != null)
                    {
                        this._customer = this.customerManager.Get(this._customer.CustomerId);
                    }
                }
            }
            this.bindingSourceBusiness.DataSource       = this.employeeManager.SelectOnActive();
            this.bindingSourceCustom.DataSource         = this.customerManager.Select();
            this.bindingSourceCustomsContact.DataSource = this._customer.Contacts;

            this.CompanyIdTextEdit.Text         = string.IsNullOrEmpty(this._customer.Id) ? this._customer.CustomerId : this._customer.Id;
            this.CustomerFullNameTextEdit.Text  = this._customer.CustomerFullName;
            this.CustomerShortNameTextEdit.Text = this._customer.CustomerShortName;
            this.CompanyDescriptionMemoEdit.Rtf = this._customer.CustomerDescription;
            this.textEditCompanyPhone.Text      = this._customer.CustomerPhone;
            this.CompanyFaxTextEdit.Text        = this._customer.CustomerFax;
            this.CompanyAddressTextEdit.Text    = this._customer.CustomerAddress;
            this.textEditCompanyEMail.Text      = this._customer.CustomerEMail;

            this.textEditCompanyJinChuAddress.Text = this._customer.CustomerJinChuAddress;
            //this.textEditCompanyManager.Text = this._customer.CustomerManager;
            this.textEditCompanyMobile.Text         = this._customer.CustomerMobile;
            this.textEditCompanyNumber.Text         = this._customer.CustomerNumber;
            this.textEditCompanyPhone1.Text         = this._customer.CustomerPhone1;
            this.textEditCompanyWebSiteAddress.Text = this._customer.CustomerWebSiteAddress;
            this.spinEditCompanyPayDate.EditValue   = this._customer.CustomerPayDate;
            this.lookUpEditBusiness.EditValue       = this._customer.EmployeesBusinessId;
            this.cobCheckedStandard.Text            = this._customer.CheckedStandard;
            this.textEditContact.Text = this._customer.CustomerContact;
            if (global::Helper.DateTimeParse.DateTimeEquls(this._customer.LastTransactionDate, global::Helper.DateTimeParse.NullDate))
            {
                this.dateEditCompanyExchangeDay.EditValue = null;
            }
            else
            {
                this.dateEditCompanyExchangeDay.EditValue = this._customer.LastTransactionDate;
            }
            Model.CompanyLevel level = this.companyLevelManager.Get(this._customer.CompanyLevelId);

            if (level != null)
            {
                this.comboBoxEditCompanyLevel.Text = level.CompanyLevelId + @"-" + level.CompanyLevelName;
            }
            else
            {
                this.comboBoxEditCompanyLevel.Text = "";
            }

            SetTextEditReadOnly(true);

            this.richTextBoxMarks1.Rtf    = this._customer.Marks1;
            this.richTextBoxMarks2.Rtf    = this._customer.Marks2;
            this.richTextBoxMarks3.Rtf    = this._customer.Marks3;
            this.comboBoxEditFP.EditValue = this._customer.CustomerFP;

            //联系人
            this.textEditEmail.Text   = "";
            this.textEditMobile.Text  = "";
            this.textEditName.Text    = "";
            this.textEditPhone.Text   = "";
            this.memoEditRemarks.Text = "";

            //this._customer.Marks = this.customerMarksManager.SelectByCustomerId(this._customer.CustomerId);
            //this.bindingSourceCustomerMarks.DataSource = this._customer.Marks;

            //switch (this.action)
            //{
            //    case "insert":
            //        this.CompanyIdTextEdit.Properties.ReadOnly = false;
            //        this.CompanyAddressTextEdit.Properties.ReadOnly = false;
            //        this.CompanyFaxTextEdit.Properties.ReadOnly = false;
            //        this.CustomerShortNameTextEdit.Properties.ReadOnly = false;
            //        this.CustomerFullNameTextEdit.Properties.ReadOnly = false;
            //        //this.CompanyPayDayTextEdit.Properties.ReadOnly = false;
            //        this.textEditCompanyPhone.Properties.ReadOnly = false;
            //        this.CompanyDescriptionMemoEdit.Rtf.ReadOnly = false;

            //        this.textEditCompanyEMail.Properties.ReadOnly = false;
            //        this.dateEditCompanyExchangeDay.Properties.ReadOnly = false;
            //        this.textEditCompanyJinChuAddress.Properties.ReadOnly = false;
            //        this.textEditCompanyManager.Properties.ReadOnly = false;
            //        this.textEditCompanyMobile.Properties.ReadOnly = false;
            //        this.textEditCompanyNumber.Properties.ReadOnly = false;
            //        this.textEditCompanyPhone1.Properties.ReadOnly = false;
            //        this.textEditCompanyWebSiteAddress.Properties.ReadOnly = false;
            //        this.spinEditCompanyPayDate.Properties.ReadOnly = false;
            //        this.dateEditCompanyExchangeDay.Properties.Buttons[0].Visible = true;

            //        this.lookUpEditBusiness.Properties.ReadOnly = false;
            //        this.lookUpEditBusiness.Properties.Buttons[0].Visible = true;

            //        this.simpleButtonAdd.Enabled = true;
            //        this.simpleButtonDel.Enabled = false;
            //        this.simpleButtonModify.Enabled = false;
            //        this.simpleButtonSave.Enabled = false;
            //        this.simpleButtonUndo.Enabled = false;
            //        break;

            //    case "update":

            //        this.CompanyIdTextEdit.Properties.ReadOnly = false;
            //        this.CompanyAddressTextEdit.Properties.ReadOnly = false;
            //        this.CompanyFaxTextEdit.Properties.ReadOnly = false;
            //        this.CustomerShortNameTextEdit.Properties.ReadOnly = false;
            //        this.CustomerFullNameTextEdit.Properties.ReadOnly = false;
            //        //this.CompanyPayDayTextEdit.Properties.ReadOnly = false;
            //        this.textEditCompanyPhone.Properties.ReadOnly = false;
            //        this.CompanyDescriptionMemoEdit.Rtf.ReadOnly = false;

            //        this.textEditCompanyEMail.Properties.ReadOnly = false;
            //        this.dateEditCompanyExchangeDay.Properties.ReadOnly = false;
            //        this.textEditCompanyJinChuAddress.Properties.ReadOnly = false;
            //        this.textEditCompanyManager.Properties.ReadOnly = false;
            //        this.textEditCompanyMobile.Properties.ReadOnly = false;
            //        this.textEditCompanyNumber.Properties.ReadOnly = false;
            //        this.textEditCompanyPhone1.Properties.ReadOnly = false;
            //        this.textEditCompanyWebSiteAddress.Properties.ReadOnly = false;
            //        this.spinEditCompanyPayDate.Properties.ReadOnly = false;
            //        this.dateEditCompanyExchangeDay.Properties.Buttons[0].Visible = true;

            //        this.lookUpEditBusiness.Properties.ReadOnly = false;
            //        this.lookUpEditBusiness.Properties.Buttons[0].Visible = true;

            //        this.simpleButtonAdd.Enabled = true;
            //        this.simpleButtonDel.Enabled = true;
            //        this.simpleButtonModify.Enabled = true;
            //        this.simpleButtonSave.Enabled = false;
            //        this.simpleButtonUndo.Enabled = false;
            //        break;

            //    case "view":
            //        this.CompanyIdTextEdit.Properties.ReadOnly = true;
            //        this.CompanyAddressTextEdit.Properties.ReadOnly = true;
            //        this.CompanyFaxTextEdit.Properties.ReadOnly = true;
            //        this.CustomerShortNameTextEdit.Properties.ReadOnly = true;
            //        this.CustomerFullNameTextEdit.Properties.ReadOnly = true;
            //        //this.CompanyPayDayTextEdit.Properties.ReadOnly = true;
            //        this.textEditCompanyPhone.Properties.ReadOnly = true;
            //        this.CompanyDescriptionMemoEdit.Rtf.ReadOnly = true;
            //        this.comboBoxEditCompanyLevel.Properties.ReadOnly = true;
            //        this.textEditCompanyEMail.Properties.ReadOnly = true;
            //        this.dateEditCompanyExchangeDay.Properties.ReadOnly = true;
            //        this.textEditCompanyJinChuAddress.Properties.ReadOnly = true;
            //        this.textEditCompanyManager.Properties.ReadOnly = true;
            //        this.textEditCompanyMobile.Properties.ReadOnly = true;
            //        this.textEditCompanyNumber.Properties.ReadOnly = true;
            //        this.textEditCompanyPhone1.Properties.ReadOnly = true;
            //        this.textEditCompanyWebSiteAddress.Properties.ReadOnly = true;
            //        this.spinEditCompanyPayDate.Properties.ReadOnly = true;
            //        this.dateEditCompanyExchangeDay.Properties.Buttons[0].Visible = false;

            //        this.lookUpEditBusiness.Properties.ReadOnly = true;
            //        this.lookUpEditBusiness.Properties.Buttons[0].Visible = false;

            //        this.simpleButtonAdd.Enabled = false;
            //        this.simpleButtonDel.Enabled = false;
            //        this.simpleButtonModify.Enabled = false;
            //        this.simpleButtonSave.Enabled = false;
            //        this.simpleButtonUndo.Enabled = false;
            //        break;

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

            //联系人 增删改 按钮状态
            //this.simpleButtonAdd.Enabled = true;
            //this.simpleButtonDel.Enabled = true;
            //this.simpleButtonModify.Enabled = true;
            this.simpleButtonSave.Enabled = false;
            this.simpleButtonUndo.Enabled = false;

            this.textEditEmail.Properties.ReadOnly   = true;
            this.textEditMobile.Properties.ReadOnly  = true;
            this.textEditName.Properties.ReadOnly    = true;
            this.textEditPhone.Properties.ReadOnly   = true;
            this.memoEditRemarks.Properties.ReadOnly = true;
        }
Пример #20
0
 public Model.CompanyLevel GetNext(Model.CompanyLevel e)
 {
     return(accessor.GetNext(e));
 }
Пример #21
0
 public bool HasRowsAfter(Model.CompanyLevel e)
 {
     return(sqlmapper.QueryForObject <bool>("CompanyLevel.has_rows_after", e));
 }
Пример #22
0
 public bool HasRowsBefore(Model.CompanyLevel e)
 {
     return(sqlmapper.QueryForObject <bool>("CompanyLevel.has_rows_before", e));
 }
Пример #23
0
 public void Update(Model.CompanyLevel e)
 {
     this.Update <Model.CompanyLevel>(e);
 }
Пример #24
0
 public void Insert(Model.CompanyLevel e)
 {
     this.Insert <Model.CompanyLevel>(e);
 }