Пример #1
0
 private void _Delete(Model.Flextime flextime)
 {
     this.Delete(flextime.FlextimeId);
     if (DateTime.Now.Date > flextime.FlexDate.Value.Date)
     {
         hrDatilyManager.ReCheck(flextime.FlexDate.Value.Date, flextime.Employee);
     }
 }
Пример #2
0
 //lyl--刪除當前行的排班
 private void sbtn_Delete_Click(object sender, EventArgs e)
 {
     this._flextime = bindingSource2.Current as Model.Flextime;
     if (this._flextime == null)
     {
         return;
     }
     this.flextimeManager.Delete(this._flextime.FlextimeId);
     NewMethod();
 }
Пример #3
0
 public void Delete(Model.Flextime flextime)
 {
     try
     {
         BL.V.BeginTransaction();
         _Delete(flextime);
         BL.V.CommitTransaction();
     }
     catch
     {
         BL.V.RollbackTransaction();
         throw;
     }
 }
Пример #4
0
        //删除多余排班
        private void sbtn_Delete_Click(object sender, EventArgs e)
        {
            if (FlexTimeSource.Current == null)
            {
                return;
            }
            if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
            {
                return;
            }

            Model.Flextime _flex = FlexTimeSource.Current as Model.Flextime;
            flextimemanager.Delete(_flex.FlextimeId);
            this.FlexTimeSource.DataSource = flextimemanager.getByempid(_flex.EmployeeId);
        }
Пример #5
0
        //lyl--gridview2展示時間列
        private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            IList <Model.Flextime> details = this.bindingSource2.DataSource as IList <Model.Flextime>;

            if (details == null || details.Count < 1)
            {
                return;
            }
            Model.Flextime flextime = details[e.ListSourceRowIndex];

            if (e.Column.Name == this.gridColumnFlextimes.Name && flextime.BusinessHours != null)
            {
                e.DisplayText = Convert.ToDateTime(flextime.BusinessHours.Fromtime).ToString("HH:mm") + "~" + Convert.ToDateTime(flextime.BusinessHours.ToTime).ToString("HH:mm");
            }
        }
Пример #6
0
        public void Insert(Model.Flextime flextime, IList <Model.Employee> emplist)
        {
            bool flag = false;

            try
            {
                BL.V.BeginTransaction();

                foreach (Model.Employee emp in emplist)
                {
                    Model.Flextime ft = new Book.Model.Flextime();
                    if (flag)
                    {
                        ft.FlextimeId = Guid.NewGuid().ToString();
                    }
                    else
                    {
                        ft.FlextimeId = flextime.FlextimeId;
                    }

                    ft.BusinessHours   = flextime.BusinessHours;
                    ft.BusinessHoursId = flextime.BusinessHoursId;
                    ft.EmployeeId      = emp.EmployeeId;
                    ft.FlexDate        = flextime.FlexDate;
                    accessor.Insert(ft);
                    if (DateTime.Now.Date > flextime.FlexDate.Value.Date)
                    {
                        hrDatilyManager.ReCheck(flextime.FlexDate.Value.Date, flextime.Employee);
                    }
                    flag = true;
                }

                BL.V.CommitTransaction();
            }
            catch (Exception ex)
            {
                BL.V.RollbackTransaction();
                throw ex;
            }
        }
Пример #7
0
        //lyl--添加排班
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (!this.gridView1.PostEditor() || !this.gridView1.UpdateCurrentRow())
            {
                return;
            }

            this._flextime = new Book.Model.Flextime();

            this._flextime.FlextimeId = Guid.NewGuid().ToString();

            IList <Model.Employee> mEmplist = (from Model.Employee emp in this.bindingSource3.DataSource as IList <Model.Employee>
                                               where emp.IsChecked == true
                                               select emp).ToList <Model.Employee>();

            if (this.lookUpEdit1.Text == "" && (mEmplist == null || mEmplist.Count == 0))
            {
                MessageBox.Show("請選擇員工!");
                return;
            }
            if (this.lookUpEdit2.Text == "")
            {
                MessageBox.Show("請選擇班別!");
                return;
            }

            if (this.Det_SelectDate.Text == "")
            {
                MessageBox.Show("請選日期!");
                return;
            }

            _flextime.BusinessHoursId = lookUpEdit2.EditValue.ToString();
            _flextime.FlexDate        = this.Det_SelectDate.DateTime;

            bool oldListCountFlag = false;          //标示筛选前是否有记录,后面将对mEmplist筛选

            if (mEmplist == null || mEmplist.Count == 0)
            {
                _flextime.EmployeeId = this.lookUpEdit1.EditValue.ToString();
                bool isexist = flextimeManager.selectbyempiddate(this.lookUpEdit1.EditValue.ToString(), this.Det_SelectDate.DateTime);
                if (isexist)
                {
                    MessageBox.Show(Properties.Resources.ExistsObject);
                    return;
                }
                oldListCountFlag = true;
            }
            else
            {
                _flextime.EmployeeId = mEmplist.First <Model.Employee>().EmployeeId;
                flextimeManager.selectbyempListdate(mEmplist, this.Det_SelectDate.DateTime);
                if (mEmplist == null || mEmplist.Count == 0)
                {
                    oldListCountFlag = false;
                }
            }

            if (mEmplist != null && mEmplist.Count != 0)
            {
                this.flextimeManager.Insert(this._flextime, mEmplist);
            }
            else
            {
                if (oldListCountFlag)
                {
                    this.flextimeManager.Insert(this._flextime);
                }
            }

            MessageBox.Show(Properties.Resources.Addsuccess);

            NewMethod();
        }
Пример #8
0
 public void Update(Model.Flextime e)
 {
     this.Update <Model.Flextime>(e);
 }
Пример #9
0
 public void Insert(Model.Flextime e)
 {
     this.Insert <Model.Flextime>(e);
 }
Пример #10
0
 public void Update(Model.Flextime flextime)
 {
     accessor.Update(flextime);
 }
Пример #11
0
 public void Insert(Model.Flextime flextime)
 {
     accessor.Insert(flextime);
     hrDatilyManager.ReCheck(flextime.FlexDate.Value.Date, flextime.Employee);
 }