/// <summary>
 /// Update a HrDailyEmployeeAttendInfo.
 /// </summary>
 public void Update(Model.HrDailyEmployeeAttendInfo hrDailyEmployeeAttendInfo)
 {
     //
     // todo: add other logic here.
     //
     accessor.Update(hrDailyEmployeeAttendInfo);
 }
Exemple #2
0
        // 加载异常考勤信息
        private void AnormalySalaryEditForm_Load(object sender, EventArgs e)
        {
            if (this._hrDaily_begUpdate != null)
            {
                this.lblEmployeeName.Text   = this._hrDaily_begUpdate.EmployeeName;
                this.lblNote.Text           = this._hrDaily_begUpdate.Note;
                this.lblShouldCheckIn.Text  = this._hrDaily_begUpdate.ShouldCheckIn.Value.ToString("HH:mm");
                this.lblShouldCheckOut.Text = this._hrDaily_begUpdate.ShouldCheckOut.Value.ToString("HH:mm");
                this.lblActualCheckIn.Text  = this._hrDaily_begUpdate.ActualCheckIn == global::Helper.DateTimeParse.NullDate ? "" : this._hrDaily_begUpdate.ActualCheckIn.Value.ToString("HH:mm");
                this.lblActualCheckOut.Text = this._hrDaily_begUpdate.ActualCheckOut == global::Helper.DateTimeParse.NullDate ? "" : this._hrDaily_begUpdate.ActualCheckOut.Value.ToString("HH:mm");
                this.lblDutyDate.Text       = this._hrDaily_begUpdate.DutyDate.Value.ToString("HH:mm");

                //获取重新考勤之后的结果
                Model.Employee emp = new BL.EmployeeManager().Get(this._hrDaily_begUpdate.EmployeeId);
                this._hrDaily = new BL.HrDailyEmployeeAttendInfoManager().Reatten_Controller(this._hrDaily_begUpdate.DutyDate.Value, emp);
                if (this._hrDaily != null)
                {
                    this.ShouldCheckIn.Text              = this._hrDaily.ShouldCheckIn.Value.ToString("HH:mm");
                    this.ShouldCheckOut.Text             = this._hrDaily.ShouldCheckOut.Value.ToString("HH:mm");
                    this.txtActualCheckInTime.EditValue  = this._hrDaily.ActualCheckIn == null ? "" : this._hrDaily_begUpdate.ActualCheckIn.Value.ToString("HH:mm");
                    this.txtActualCheckOutTime.EditValue = this._hrDaily.ActualCheckOut == null ? "" : this._hrDaily_begUpdate.ActualCheckOut.Value.ToString("HH:mm");
                    this.Note.Text = this._hrDaily.Note;
                }
            }
        }
 /// <summary>
 /// Insert a HrDailyEmployeeAttendInfo.
 /// </summary>
 public void Insert(Model.HrDailyEmployeeAttendInfo hrDailyEmployeeAttendInfo)
 {
     //
     // todo:add other logic here
     //
     hrDailyEmployeeAttendInfo.HrDailyEmployeeAttendInfoId = Guid.NewGuid().ToString();
     accessor.Insert(hrDailyEmployeeAttendInfo);
 }
Exemple #4
0
 private void gridView1_DoubleClick(object sender, EventArgs e)
 {
     Model.HrDailyEmployeeAttendInfo model = ((this.bindingSource_atten.Current as DataRowView) == null ? null : _hrManager.Get((this.bindingSource_atten.Current as DataRowView)["HrDailyEmployeeAttendInfoId"].ToString()));
     if (model != null)
     {
         AnormalySalaryEditForm f = new AnormalySalaryEditForm(model);
         f.ShowDialog();
         this.bindingSource_atten.DataSource = _hrManager.SelectDailyInfoByEmployee(this.lookUpEmployeeId.EditValue.ToString(), new DateTime(Convert.ToInt32(this.cmbDutyDate.Text.Substring(0, 4)), Convert.ToInt32(this.cmbDutyDate.Text.Substring(5)), 1), "2").Tables[0];
     }
 }
 public void UpdateDailyInfo(Model.HrDailyEmployeeAttendInfo dailyInfo, IList <Model.HrDailyEmployeeAttendInfo> dailyInfolist)
 {
     if (dailyInfo.ShouldCheckIn == null || dailyInfo.ShouldCheckOut == null)
     {
         foreach (Model.HrDailyEmployeeAttendInfo item in dailyInfolist)
         {
             item.OverTimeOff = dailyInfo.ActualCheckOut == null ? null : dailyInfo.ActualCheckOut;
             item.OverTimeON  = dailyInfo.ActualCheckIn == null ? null : dailyInfo.ActualCheckIn;
             this.Update(item);
         }
     }
     else
     {
         foreach (Model.HrDailyEmployeeAttendInfo item in dailyInfolist)
         {
             DataSet annualHolidayData = annualholidayManager.SelectSingleAnnualInfo(Convert.ToDateTime(item.DutyDate));
             dailyInfo.HrDailyEmployeeAttendInfoId = item.HrDailyEmployeeAttendInfoId;
             if (item.Note != null)
             {
                 if (item.Note == "缺刷卡資料")
                 {
                     this.Update(dailyInfo);
                 }
                 else
                 {
                     foreach (DataRow rows in annualHolidayData.Tables[0].Rows)
                     {
                         if (Convert.ToDateTime(rows[Model.AnnualHoliday.PRO_HolidayDate]) == item.DutyDate)
                         {
                             item.OverTimeOff = dailyInfo.ActualCheckOut == null ? null : dailyInfo.ActualCheckOut;
                             item.OverTimeON  = dailyInfo.ActualCheckIn == null ? null : dailyInfo.ActualCheckIn;
                             this.Update(item);
                         }
                     }
                 }
             }
             else
             {
                 dailyInfo.OverTimeOff = item.OverTimeOff;
                 dailyInfo.OverTimeON  = item.OverTimeON;
                 this.Update(dailyInfo);
             }
         }
     }
 }
Exemple #6
0
        public int ReattenSave(Model.HrDailyEmployeeAttendInfo _hrEA)
        {
            SqlConnection con = new SqlConnection(sqlmapper.DataSource.ConnectionString);
            SqlCommand    cmd = new SqlCommand("addDailyEmployeeAttendInfo", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Connection.Open();
            SqlParameter[] Parameters =
            {
                new SqlParameter("@Id",             DbType.String),
                new SqlParameter("@DutyDate",       DbType.DateTime),
                new SqlParameter("@EmployeeId",     DbType.String),
                new SqlParameter("@ShouldCheckIn",  DbType.DateTime),
                new SqlParameter("@ShouldCheckOut", DbType.DateTime),
                new SqlParameter("@ActualCheckIn",  DbType.DateTime),
                new SqlParameter("@ActualCheckOut", DbType.DateTime),
                new SqlParameter("@LateInMinute",   DbType.Int32),
                new SqlParameter("@DayFactor",      DbType.Double),
                new SqlParameter("@MonthFactor",    DbType.Double),
                new SqlParameter("@SpecialBonus",   DbType.Double),
                new SqlParameter("@IsNormal",       DbType.Byte),
                new SqlParameter("@Note",           DbType.String)
            };
            Parameters[0].Value  = _hrEA.HrDailyEmployeeAttendInfoId;
            Parameters[1].Value  = _hrEA.DutyDate;
            Parameters[2].Value  = _hrEA.EmployeeId;
            Parameters[3].Value  = _hrEA.ShouldCheckIn;
            Parameters[4].Value  = _hrEA.ShouldCheckOut;
            Parameters[5].Value  = _hrEA.ActualCheckIn;
            Parameters[6].Value  = _hrEA.ActualCheckOut;
            Parameters[7].Value  = _hrEA.LateInMinute;
            Parameters[8].Value  = _hrEA.DayFactor;
            Parameters[9].Value  = _hrEA.MonthFactor;
            Parameters[10].Value = _hrEA.SpecialBonus;
            Parameters[11].Value = _hrEA.IsNormal;
            Parameters[12].Value = _hrEA.Note;

            cmd.Parameters.AddRange(Parameters);

            return(cmd.ExecuteNonQuery());
        }
 public void Update(Model.HrDailyEmployeeAttendInfo e)
 {
     this.Update <Model.HrDailyEmployeeAttendInfo>(e);
 }
 public void Insert(Model.HrDailyEmployeeAttendInfo e)
 {
     this.Insert <Model.HrDailyEmployeeAttendInfo>(e);
 }
 //获取传来异常数据Model
 public AnormalySalaryEditForm(Model.HrDailyEmployeeAttendInfo trans_HDEA)
 {
     InitializeComponent();
     this._hrDaily_begUpdate = trans_HDEA;
 }
        //保存修改
        private void barBtn_save_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            #region 原方法
            //if (this.txtActualCheckInTime.Text != string.Empty)
            //{
            //    try
            //    {
            //        this._hrDaily.ActualCheckIn = DateTime.Parse(this._hrDaily_begUpdate.DutyDate.Value.ToString("yyyy-MM-dd") + " " + this.txtActualCheckInTime.Text);
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show("輸入時間格式有誤,請查證!");
            //        return;
            //    }
            //}
            //else
            //{
            //    MessageBox.Show("實際上班時間不能為空!");
            //    return;
            //}
            //if (this.txtActualCheckOutTime.Text != string.Empty)
            //{
            //    try
            //    {
            //        this._hrDaily.ActualCheckOut = DateTime.Parse(this._hrDaily_begUpdate.DutyDate.Value.ToString("yyyy-MM-dd") + " " + this.txtActualCheckOutTime.Text);
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show("輸入時間格式有誤,請查證!");
            //        return;
            //    }
            //}
            //else
            //{
            //    MessageBox.Show("實際下班時間不能為空!");
            //    return;
            //}

            ////判断换日
            //TimeSpan? ts_1 = this._hrDaily.ShouldCheckIn - this._hrDaily.ActualCheckIn;
            //if (Math.Abs(ts_1.Value.Days * 24 + ts_1.Value.Hours) > 13)
            //    this._hrDaily.ActualCheckIn = this._hrDaily.ActualCheckIn.Value.AddDays(1);
            //TimeSpan? ts_2 = this._hrDaily.ShouldCheckOut - this._hrDaily.ActualCheckOut;
            //if (Math.Abs(ts_2.Value.Days * 24 + ts_2.Value.Hours) > 13)
            //    this._hrDaily.ActualCheckOut = this._hrDaily.ActualCheckOut.Value.AddDays(1);

            //if (this._hrDaily.ActualCheckIn > this._hrDaily.ActualCheckOut)
            //{
            //    MessageBox.Show("實際上班時間,不能大於實際下班時間!");
            //    return;
            //}

            //if (this._hrDaily.MLeave != null)
            //{
            //    if (this._hrDaily.MLeave.LeaveRange != 0)
            //    {
            //        this._hrDaily.DayFactor = 0.5 + 0.5 * this._hrDaily.MLeave.LeaveType.PayRate;
            //        this._hrDaily.SpecialBonus = Convert.ToInt32(Convert.ToDouble(this._hrDaily.MBusinessHours.SpecialPay) * 0.5);
            //        this._hrDaily.MonthFactor = 1;
            //        if (this._hrDaily.MLeave.LeaveRange == 1)
            //        {
            //            this._hrDaily.Note = this._hrDaily.MLeave.LeaveType.ToString() + "(上半日)";
            //        }
            //        else
            //        {
            //            this._hrDaily.Note = this._hrDaily.MLeave.LeaveType.ToString() + "(下半日)";
            //        }
            //    }
            //}
            //else
            //{
            //    this._hrDaily.SpecialBonus = Convert.ToInt32(this._hrDaily.MBusinessHours.SpecialPay);
            //    this._hrDaily.DayFactor = 1;
            //}

            //TimeSpan? ts = this._hrDaily.ActualCheckIn - this._hrDaily.ShouldCheckIn;
            //if ((ts.Value.Hours * 60 + ts.Value.Minutes) > 0 && !(this._hrDaily.MLeave != null && this._hrDaily.MLeave.LeaveRange == 0))
            //{
            //    this._hrDaily.LateInMinute = ts.Value.Hours * 60 + ts.Value.Minutes;
            //    this._hrDaily.Note += ";遲到";
            //}
            //else
            //{
            //    this._hrDaily.LateInMinute = 0;
            //}
            //TimeSpan? ts2 = this._hrDaily.ShouldCheckOut - this._hrDaily.ActualCheckOut;
            //if (ts2.Value.Hours * 60 + ts2.Value.Minutes > 0 && !(this._hrDaily.MLeave != null && this._hrDaily.MLeave.LeaveRange == 0))
            //{
            //    this._hrDaily.LateInMinute = ts2.Value.Hours * 60 + ts2.Value.Minutes;
            //    this._hrDaily.Note += ";早退";
            //}

            //this._hrDaily.Note = this._hrDaily.Note.Replace(";卻刷卡資料", "");
            //this._hrDaily.Note = this._hrDaily.Note.Replace("卻刷卡資料", "");

            //this._hrDaily.MonthFactor = 1;  //月基数设为1
            //this._hrDaily.IsNormal = true;  //设置为不存在异常
            //if (this._hrManger.UpdateSave_AnormalySalaryEditForm(this._hrDaily) > 0)//保存修改
            //{
            //    MessageBox.Show(Properties.Resources.SaveSuccess);
            //    this.DialogResult = DialogResult.OK;
            //}
            //else
            //{
            //    MessageBox.Show(Properties.Resources.SavaFailure);
            //}
            #endregion

            #region 新方法,曹瑞 2016年7月16日

            this._hrDaily = _hrManger.Get(this._hrDaily_begUpdate.HrDailyEmployeeAttendInfoId);
            if (this.txtActualCheckInTime.Text != string.Empty)
            {
                try
                {
                    this._hrDaily.ActualCheckIn = DateTime.Parse(this._hrDaily_begUpdate.DutyDate.Value.ToString("yyyy-MM-dd") + " " + this.txtActualCheckInTime.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("輸入時間格式有誤,請查證!");
                    return;
                }
            }
            else
            {
                this._hrDaily.ActualCheckIn = null;
            }
            if (this.txtActualCheckOutTime.Text != string.Empty)
            {
                try
                {
                    this._hrDaily.ActualCheckOut = DateTime.Parse(this._hrDaily_begUpdate.DutyDate.Value.ToString("yyyy-MM-dd") + " " + this.txtActualCheckOutTime.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("輸入時間格式有誤,請查證!");
                    return;
                }
            }
            else
            {
                this._hrDaily.ActualCheckOut = null;
            }
            if (this._hrDaily.ActualCheckIn != null && this._hrDaily.ShouldCheckIn != null)
            {
                TimeSpan?ts_1 = this._hrDaily.ShouldCheckIn - this._hrDaily.ActualCheckIn;
                if (Math.Abs(ts_1.Value.Days * 24 + ts_1.Value.Hours) > 13)
                {
                    this._hrDaily.ActualCheckIn = this._hrDaily.ActualCheckIn.Value.AddDays(1);
                }
            }
            if (this._hrDaily.ActualCheckOut != null && this._hrDaily.ShouldCheckOut != null)
            {
                TimeSpan?ts_2 = this._hrDaily.ShouldCheckOut - this._hrDaily.ActualCheckOut;
                if (Math.Abs(ts_2.Value.Days * 24 + ts_2.Value.Hours) > 13)
                {
                    this._hrDaily.ActualCheckOut = this._hrDaily.ActualCheckOut.Value.AddDays(1);
                }
            }
            try
            {
                DateTime       checkDate = Convert.ToDateTime(this._hrDaily_begUpdate.DutyDate);
                Model.Employee emp       = new BL.EmployeeManager().Get(this._hrDaily_begUpdate.EmployeeId);

                BL.V.BeginTransaction();
                _hrManger.Reatten_Controller(checkDate, emp, this._hrDaily.ActualCheckIn, this._hrDaily.ActualCheckOut);
                MessageBox.Show("訂正成功!", this.Text, MessageBoxButtons.OK);
                BL.V.CommitTransaction();
            }
            catch (Exception ex)
            {
                BL.V.RollbackTransaction();
                MessageBox.Show("訂正失敗!", this.Text, MessageBoxButtons.OK);
                return;
            }

            #endregion
        }
 /// <summary>
 /// 重新保存
 /// </summary>
 public int ReattenSave(Model.HrDailyEmployeeAttendInfo _hrEA)
 {
     return(accessor.ReattenSave(_hrEA));
 }
 public int UpdateSave_AnormalySalaryEditForm(Model.HrDailyEmployeeAttendInfo _hrDaily)
 {
     return(accessor.UpdateSave_AnormalySalaryEditForm(_hrDaily));
 }