예제 #1
0
 /// <summary>
 /// Insert a Duty.
 /// </summary>
 public void Insert(Model.Duty duty)
 {
     Validate(duty);
     duty.InsertTime = DateTime.Now;
     duty.DutyId     = Guid.NewGuid().ToString();
     accessor.Insert(duty);
 }
예제 #2
0
 public void Delete(Model.Duty duty)
 {
     //
     // todo:add other logic here
     //
     this.Delete(duty.DutyId);
 }
예제 #3
0
        public bool ExistsExcept(Model.Duty e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.DutyId) == null?null:Get(e.DutyId).Id);
            return(sqlmapper.QueryForObject <bool>("Duty.existsexcept", paras));
        }
예제 #4
0
 /// <summary>
 /// gridview2单击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gridView2_Click(object sender, EventArgs e)
 {
     Model.Duty dy = this.bindingSource_duty.Current as Model.Duty;
     if (dy != null)
     {
         this.currentduty = dy;
         this.action      = "view";
         this.Refresh();
     }
 }
예제 #5
0
        private void Validate(Model.Duty duty)
        {
            if (string.IsNullOrEmpty(duty.DutyName))
            {
                throw new Helper.RequireValueException(Model.Duty.PROPERTY_DUTYNAME);
            }

            if (accessor.IsExistsName(duty.DutyId, duty.DutyName))
            {
                throw new Helper.InvalidValueException(Model.Duty.PROPERTY_DUTYNAME);
            }
        }
예제 #6
0
        //新增
        protected override void AddNew()
        {
            switch (pageindex)
            {
            case 0:
                this.academ = new Book.Model.AcademicBackGround();
                this.academ.AcademicBackGroundId = Guid.NewGuid().ToString();
                break;

            case 1:
                this.currentduty        = new Book.Model.Duty();
                this.currentduty.DutyId = Guid.NewGuid().ToString();
                break;

            case 2:
                this.currentBank        = new Book.Model.Bank();
                this.currentBank.BankId = Guid.NewGuid().ToString();
                break;

            case 3:
                this.currentcompany           = new Book.Model.Company();
                this.currentcompany.CompanyId = Guid.NewGuid().ToString();
                break;

            case 4:
                this.currentbusinessHours = new Book.Model.BusinessHours();
                this.currentbusinessHours.BusinessHoursId = Guid.NewGuid().ToString();
                break;

            case 5:
                this.currentleaveType             = new Book.Model.LeaveType();
                this.currentleaveType.LeaveTypeId = Guid.NewGuid().ToString();
                break;

            case 6:
                this.currentAnnualholiday = new Book.Model.AnnualHoliday();
                this.currentAnnualholiday.AnnualHolidayId = Guid.NewGuid().ToString();
                break;

            case 7:
                break;
            }
        }
예제 #7
0
 public bool ExistsExcept(Model.Duty e)
 {
     return(accessor.ExistsExcept(e));
 }
예제 #8
0
 public Model.Duty GetPrev(Model.Duty e)
 {
     return(sqlmapper.QueryForObject <Model.Duty>("Duty.get_prev", e));
 }
예제 #9
0
 public Model.Duty GetNext(Model.Duty e)
 {
     return(sqlmapper.QueryForObject <Model.Duty>("Duty.get_next", e));
 }
예제 #10
0
 public bool HasRowsAfter(Model.Duty e)
 {
     return(sqlmapper.QueryForObject <bool>("Duty.has_rows_after", e));
 }
예제 #11
0
 public bool HasRowsBefore(Model.Duty e)
 {
     return(sqlmapper.QueryForObject <bool>("Duty.has_rows_before", e));
 }
예제 #12
0
        /// <summary>
        /// 初始化
        /// </summary>
        public override void Refresh()
        {
            switch (pageindex)
            {
            case 0:
                if (this.academ == null)
                {
                    this.academ = new Book.Model.AcademicBackGround();
                    this.action = "insert";
                }
                this.textEdit_AcademicName.EditValue        = this.academ.AcademicBackGroundName;
                this.memoEdit_AcademicDescription.EditValue = this.academ.Description;

                switch (this.action)
                {
                case "insert":
                    this.textEdit_AcademicName.Properties.ReadOnly        = false;
                    this.memoEdit_AcademicDescription.Properties.ReadOnly = false;
                    break;

                case "update":
                    this.textEdit_AcademicName.Properties.ReadOnly        = false;
                    this.memoEdit_AcademicDescription.Properties.ReadOnly = false;
                    break;

                case "view":
                    this.textEdit_AcademicName.Properties.ReadOnly        = true;
                    this.memoEdit_AcademicDescription.Properties.ReadOnly = true;
                    break;

                default:
                    break;
                }
                break;

            case 1:
                if (this.currentduty == null)
                {
                    this.currentduty = new Book.Model.Duty();
                    this.action      = "insert";
                }
                this.textEdit_DutyName.EditValue = this.currentduty.DutyName;
                this.memoEdit_DutyNote.EditValue = this.currentduty.DutyNote;
                switch (this.action)
                {
                case "insert":
                    this.textEdit_DutyName.Properties.ReadOnly = false;
                    this.memoEdit_DutyNote.Properties.ReadOnly = false;
                    break;

                case "update":
                    this.textEdit_DutyName.Properties.ReadOnly = false;
                    this.memoEdit_DutyNote.Properties.ReadOnly = false;
                    break;

                case "view":
                    this.textEdit_DutyName.Properties.ReadOnly = true;
                    this.memoEdit_DutyNote.Properties.ReadOnly = true;
                    break;

                default:
                    break;
                }
                break;

            case 2:
                if (this.currentBank == null)
                {
                    this.currentBank = new Book.Model.Bank();
                    this.action      = "insert";
                }
                this.textEdit_BankName.EditValue        = this.currentBank.BankName;
                this.textEdit_BankPhone.EditValue       = this.currentBank.BankPhone;
                this.textEdit_BankAddress.EditValue     = this.currentBank.BankAddress;
                this.memoEdit_BankDescription.EditValue = this.currentBank.Description;
                switch (this.action)
                {
                case "insert":
                    this.textEdit_BankName.Properties.ReadOnly        = false;
                    this.textEdit_BankPhone.Properties.ReadOnly       = false;
                    this.textEdit_BankAddress.Properties.ReadOnly     = false;
                    this.memoEdit_BankDescription.Properties.ReadOnly = false;
                    break;

                case "update":
                    this.textEdit_BankName.Properties.ReadOnly        = false;
                    this.textEdit_BankPhone.Properties.ReadOnly       = false;
                    this.textEdit_BankAddress.Properties.ReadOnly     = false;
                    this.memoEdit_BankDescription.Properties.ReadOnly = false;;
                    break;

                case "view":
                    this.textEdit_BankName.Properties.ReadOnly        = true;
                    this.textEdit_BankPhone.Properties.ReadOnly       = true;
                    this.textEdit_BankAddress.Properties.ReadOnly     = true;
                    this.memoEdit_BankDescription.Properties.ReadOnly = true;
                    break;

                default:
                    break;
                }
                break;

            case 3:
                if (this.currentcompany == null)
                {
                    this.currentcompany = new Book.Model.Company();
                    this.action         = "null";
                }
                this.textEdit_CompanyName.EditValue        = this.currentcompany.CompanyName;
                this.memoEdit_CompanyDescription.EditValue = this.currentcompany.Description;
                switch (this.action)
                {
                case "insert":
                    this.textEdit_CompanyName.Properties.ReadOnly        = false;
                    this.memoEdit_CompanyDescription.Properties.ReadOnly = false;
                    break;

                case "update":
                    this.textEdit_CompanyName.Properties.ReadOnly        = false;
                    this.memoEdit_CompanyDescription.Properties.ReadOnly = false;
                    break;

                case "view":
                    this.textEdit_CompanyName.Properties.ReadOnly        = true;
                    this.memoEdit_CompanyDescription.Properties.ReadOnly = true;
                    break;

                default:
                    break;
                }
                break;

            case 4:
                if (this.currentbusinessHours == null)
                {
                    this.currentbusinessHours = new Book.Model.BusinessHours();
                    this.action = "insert";
                }
                this.textEdit_BusinessHoursName.EditValue   = this.currentbusinessHours.BusinessHoursName;
                this.memoEdit_BusinessDescription.EditValue = this.currentbusinessHours.Description;
                this.timeEdit_Formtime.EditValue            = this.currentbusinessHours.Fromtime;
                this.timeEdit_Totime.EditValue     = this.currentbusinessHours.ToTime;
                this.textEdit_SpecialPay.EditValue = this.currentbusinessHours.SpecialPay;
                switch (this.action)
                {
                case "insert":
                    this.textEdit_BusinessHoursName.Properties.ReadOnly   = false;
                    this.memoEdit_BusinessDescription.Properties.ReadOnly = false;
                    break;

                case "update":
                    this.textEdit_BusinessHoursName.Properties.ReadOnly   = false;
                    this.memoEdit_BusinessDescription.Properties.ReadOnly = false;
                    break;

                case "view":
                    this.textEdit_BusinessHoursName.Properties.ReadOnly   = true;
                    this.memoEdit_BusinessDescription.Properties.ReadOnly = true;
                    break;

                default:
                    break;
                }
                break;

            case 5:
                if (this.currentleaveType == null)
                {
                    this.currentleaveType = new Book.Model.LeaveType();
                    this.action           = "insert";
                }
                //this.textEdit_LeaveTypeName.EditValue = this.currentleaveType.LeaveTypeName;
                //this.textEdit_PayRate.EditValue = this.currentleaveType.PayRate;
                //if (this.currentleaveType.IsCountToPunish == true)
                //    this.checkEdit_IsCountToPunish.Checked = true;
                //else
                //    this.checkEdit_IsCountToPunish.Checked = false;
                switch (this.action)
                {
                case "insert":
                    //this.textEdit_LeaveTypeName.Properties.ReadOnly = false;
                    //this.textEdit_PayRate.Properties.ReadOnly = false;
                    //this.checkEdit_IsCountToPunish.Properties.ReadOnly = false;
                    break;

                case "update":
                    // this.textEdit_LeaveTypeName.Properties.ReadOnly = false;
                    // this.textEdit_PayRate.Properties.ReadOnly = false;
                    // this.checkEdit_IsCountToPunish.Properties.ReadOnly = false;
                    break;

                case "view":
                    //this.textEdit_LeaveTypeName.Properties.ReadOnly = true;
                    //this.textEdit_PayRate.Properties.ReadOnly = true;
                    //this.checkEdit_IsCountToPunish.Properties.ReadOnly = true;
                    break;

                default:
                    break;
                }
                break;

            case 6:
                if (this.currentAnnualholiday == null)
                {
                    this.currentAnnualholiday = new Book.Model.AnnualHoliday();
                    this.action = "insert";
                }

                break;

            case 7:
                break;
            }

            base.Refresh();
        }
예제 #13
0
 public Model.Duty GetPrev(Model.Duty e)
 {
     return(accessor.GetPrev(e));
 }
예제 #14
0
 /// <summary>
 /// Update a Duty.
 /// </summary>
 public void Update(Model.Duty duty)
 {
     Validate(duty);
     duty.UpdateTime = DateTime.Now;;
     accessor.Update(duty);
 }
예제 #15
0
        /// <summary>
        /// 删除
        /// </summary>
        protected override void Delete()
        {
            switch (pageindex)
            {
            case 0:
                this.academ = this.bindingSource_Academic.Current as Model.AcademicBackGround;
                if (this.academ != null)
                {
                    this.academmanage.Delete(this.academ.AcademicBackGroundId);
                }
                loadParmeter();
                break;

            case 1:
                this.currentduty = this.bindingSource_duty.Current as Model.Duty;
                if (this.currentduty != null)
                {
                    this.dutymanage.Delete(this.currentduty);
                }
                loadParmeter();
                break;

            case 2:
                this.currentBank = this.bindingSource_bank.Current as Model.Bank;
                if (this.currentBank != null)
                {
                    this.bankmanage.Delete(this.currentBank.BankId);
                }
                loadParmeter();
                break;

            case 3:
                this.currentcompany = this.bindingSource_company.Current as Model.Company;
                if (this.currentcompany != null)
                {
                    this.companymanage.Delete(this.currentcompany.CompanyId);
                }
                loadParmeter();
                break;

            case 4:
                this.currentbusinessHours = this.bindingSource_BusinessHours.Current as Model.BusinessHours;
                if (this.currentbusinessHours != null)
                {
                    this.businesshoursmanage.Delete(this.currentbusinessHours.BusinessHoursId);
                }
                loadParmeter();
                break;

            case 5:
                this.currentleaveType = this.bindingSource_leaveType.Current as Model.LeaveType;
                if (this.currentleaveType != null)
                {
                    this.leaveTypemanage.Delete(this.currentleaveType.LeaveTypeId);
                }
                loadParmeter();
                break;

            case 6:
                this.currentAnnualholiday = this.bindingSource_AnnualHoliday.Current as Model.AnnualHoliday;
                if (this.currentAnnualholiday != null)
                {
                    this.annualholidaymanage.Delete(this.currentAnnualholiday.AnnualHolidayId);
                }
                loadParmeter();
                break;

            case 7:
                break;
            }
        }
예제 #16
0
 public bool HasRowsBefore(Model.Duty e)
 {
     return(accessor.HasRowsBefore(e));
 }
예제 #17
0
 public bool HasRowsAfter(Model.Duty e)
 {
     return(accessor.HasRowsAfter(e));
 }
예제 #18
0
 public void Insert(Model.Duty e)
 {
     this.Insert <Model.Duty>(e);
 }
예제 #19
0
 public Model.Duty GetNext(Model.Duty e)
 {
     return(accessor.GetNext(e));
 }
예제 #20
0
 public void Update(Model.Duty e)
 {
     this.Update <Model.Duty>(e);
 }