Пример #1
0
        private void radGridView1_CommandCellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
        {
            var col = radGridView1.CurrentColumn.Index;

            if (col == 8)
            {
                EditLeaveFrm frm = new EditLeaveFrm();
                LeaveTable   tb  = (LeaveTable)radGridView1.CurrentRow.DataBoundItem;
                frm.LvTb = tb;
                frm.ShowDialog();
            }

            if (col == 9)
            {
                if (RadMessageBox.Show(this, "هل تريد حذف السجل", "حذف السجلات", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
                {
                    if (LeaveCmdClass.DeleteLeave(((LeaveTable)this.radGridView1.CurrentRow.DataBoundItem).Id))
                    {
                    }

                    else
                    {
                        RadMessageBox.Show("لا يمكن حذف السجل", "خطأ", MessageBoxButtons.OK, RadMessageIcon.Error);
                    }
                }
            }
        }
Пример #2
0
 private void ManageLeaveFrm_Load(object sender, EventArgs e)
 {
     fillcombo();
     radGridView1.DataSource  = LeaveCmdClass.GetAll();
     FromDateTimePicker.Value = DateTime.Now.Date;
     ToDateTimePicker.Value   = DateTime.Now.Date;
 }
Пример #3
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked == true && checkBox2.Checked == false)
            {
                #region "  CheckFillTextBox "

                if (EmpComboBox.Text == "")
                {
                    EmpComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed;

                    EmpComboBox.Focus();

                    return;
                }
                else
                {
                    EmpComboBox.MultiColumnComboBoxElement.BackColor = Color.White;
                }
                if (EmpComboBox.SelectedValue == null)
                {
                    EmpComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed;

                    EmpComboBox.Focus();

                    return;
                }
                else
                {
                    EmpComboBox.MultiColumnComboBoxElement.BackColor = Color.White;
                }



                #endregion

                this.Cursor             = Cursors.WaitCursor;
                radGridView1.DataSource = LeaveCmdClass.GetByEmpID(int.Parse(EmpComboBox.SelectedValue.ToString()));

                GC.SuppressFinalize(LeaveCmdClass.GetByEmpID(int.Parse(EmpComboBox.SelectedValue.ToString())));

                GC.Collect();
                GC.WaitForFullGCComplete();
                GC.WaitForPendingFinalizers();
                this.Cursor = Cursors.Default;
            }


            if (checkBox1.Checked == false && checkBox2.Checked == true)
            {
                this.Cursor             = Cursors.WaitCursor;
                radGridView1.DataSource = LeaveCmdClass.GetByDate(FromDateTimePicker.Value.Date, ToDateTimePicker.Value.Date);

                GC.SuppressFinalize(LeaveCmdClass.GetByDate(FromDateTimePicker.Value.Date, ToDateTimePicker.Value.Date));

                GC.Collect();
                GC.WaitForFullGCComplete();
                GC.WaitForPendingFinalizers();
                this.Cursor = Cursors.Default;
            }

            if (checkBox1.Checked == true && checkBox2.Checked == true)
            {
                #region "  CheckFillTextBox "

                if (EmpComboBox.Text == "")
                {
                    EmpComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed;

                    EmpComboBox.Focus();

                    return;
                }
                else
                {
                    EmpComboBox.MultiColumnComboBoxElement.BackColor = Color.White;
                }
                if (EmpComboBox.SelectedValue == null)
                {
                    EmpComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed;

                    EmpComboBox.Focus();

                    return;
                }
                else
                {
                    EmpComboBox.MultiColumnComboBoxElement.BackColor = Color.White;
                }



                #endregion

                this.Cursor             = Cursors.WaitCursor;
                radGridView1.DataSource = LeaveCmdClass.GetByIDAndDate(int.Parse(EmpComboBox.SelectedValue.ToString()), FromDateTimePicker.Value.Date, ToDateTimePicker.Value.Date);

                GC.SuppressFinalize(LeaveCmdClass.GetByIDAndDate(int.Parse(EmpComboBox.SelectedValue.ToString()), FromDateTimePicker.Value.Date, ToDateTimePicker.Value.Date));

                GC.Collect();
                GC.WaitForFullGCComplete();
                GC.WaitForPendingFinalizers();
                this.Cursor = Cursors.Default;
            }
        }
Пример #4
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            #region "  CheckFillTextBox "

            if (EmpComboBox.Text == "")
            {
                EmpComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed;

                EmpComboBox.Focus();

                return;
            }
            else
            {
                EmpComboBox.MultiColumnComboBoxElement.BackColor = Color.White;
            }
            if (EmpComboBox.SelectedValue == null)
            {
                EmpComboBox.MultiColumnComboBoxElement.BackColor = Color.OrangeRed;

                EmpComboBox.Focus();

                return;
            }
            else
            {
                EmpComboBox.MultiColumnComboBoxElement.BackColor = Color.White;
            }

            if (radDropDownList1.Text == "")
            {
                radDropDownList1.BackColor = Color.OrangeRed;

                radDropDownList1.Focus();

                return;
            }
            else
            {
                radDropDownList1.BackColor = Color.White;
            }


            #endregion

            var q = WorkCmd.CheckWork(int.Parse(EmpComboBox.SelectedValue.ToString()), LeaveDateTimePicker.Value.Date);
            if (q != null)
            {
                if (RadMessageBox.Show(this, "هل تريد حفظ التغيرات", "تنبيه", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
                {
                    LvTb.EmpId     = int.Parse(EmpComboBox.SelectedValue.ToString());
                    LvTb.LeaveDate = LeaveDateTimePicker.Value.Date;
                    LvTb.LeaveTime = leaveTimeTimeEdit.Time.TimeOfDay;
                    LvTb.BackTime  = backTimeTimeEdit.Time.TimeOfDay;
                    LvTb.LeaveType = radDropDownList1.Text;
                    LeaveCmdClass.EditLeave(LvTb);
                }
                if (RadMessageBox.Show(this, "هل يتم اعتماد ساعة العودة  ساعة الانصراف", "تنبيه", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
                {
                    var ListData = WorkCmd.GetWorkInfo(int.Parse(EmpComboBox.SelectedValue.ToString()), LeaveDateTimePicker.Value.Date);

                    foreach (var item in ListData)
                    {
                        Startime            = DateTime.Parse(item.startTime.ToString());
                        UserClass.XWorkTime = float.Parse(item.RealWorkTimeNo.ToString());
                    }

                    float     compMonth = (backTimeTimeEdit.Time.Minute + backTimeTimeEdit.Time.Hour * 60) - (Startime.Minute + Startime.Hour * 60);
                    float     Totaltime = compMonth / 60;
                    WorkTable tb1       = new WorkTable()
                    {
                        EmpId          = int.Parse(EmpComboBox.SelectedValue.ToString()),
                        WorkDate       = LeaveDateTimePicker.Value.Date,
                        startTime      = Startime.TimeOfDay,
                        endtime        = leaveTimeTimeEdit.Time.TimeOfDay,
                        RealWorkTimeNo = UserClass.XWorkTime,
                        WorkTime       = Totaltime,
                        DefernceTime   = (Totaltime - UserClass.XWorkTime),
                        WorkFinsh      = "true"
                    };
                    WorkCmd.EditWorkUser(tb1);
                    RadMessageBox.Show("تمت الاضافة واعتماد ساعة الانتهاء من الدوام", "تمت", MessageBoxButtons.OK, RadMessageIcon.Info);
                }

                RadMessageBox.Show("تمت الاضافة بدون اعتماد ساعةالانتهاء من الدوام", "تمت", MessageBoxButtons.OK, RadMessageIcon.Info);
            }
            else
            {
                RadMessageBox.Show("يرجى اولا تسجيل الحضور", "خطأ", MessageBoxButtons.OK, RadMessageIcon.Error);
                return;
            }
        }