コード例 #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
        public IHttpActionResult PutLeaveTable(int id, LeaveTable leaveTable)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != leaveTable.Id)
            {
                return(BadRequest());
            }

            db.Entry(leaveTable).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LeaveTableExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public IHttpActionResult PostLeaveTable(LeaveTable leaveTable)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.LeaveTables.Add(leaveTable);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException dEx)
            {
                if (LeaveTableExists(leaveTable.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = leaveTable.Id }, leaveTable));
        }
コード例 #4
0
        public ActionResult EditLeave(int 序號)
        {
            DBmanager  dbmanager = new DBmanager();
            LeaveTable leave     = dbmanager.GetLeaveById(序號);

            return(View(leave));
        }
コード例 #5
0
        public static bool addLeave(LeaveTable tb)
        {
            db = new DbDataContext();

            db.LeaveTables.InsertOnSubmit(tb);
            db.SubmitChanges();
            return(true);
        }
コード例 #6
0
        public IHttpActionResult GetLeaveTable(int id)
        {
            LeaveTable leaveTable = db.LeaveTables.Find(id);

            if (leaveTable == null)
            {
                return(NotFound());
            }

            return(Ok(leaveTable));
        }
コード例 #7
0
        public IHttpActionResult DeleteLeaveTable(int id)
        {
            LeaveTable leaveTable = db.LeaveTables.Find(id);

            if (leaveTable == null)
            {
                return(NotFound());
            }

            db.LeaveTables.Remove(leaveTable);
            db.SaveChanges();

            return(Ok(leaveTable));
        }
コード例 #8
0
        public ActionResult EditLeave(LeaveTable leave)
        {
            DBmanager dbmanager = new DBmanager();

            try
            {
                dbmanager.UpdateLeave(leave);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                return(View(leave));
            }
            return(RedirectToAction("Index"));
        }
コード例 #9
0
        public static bool EditLeave(LeaveTable tb)
        {
            db = new DbDataContext();

            var q = db.LeaveTables.Where(p => p.Id == tb.Id).SingleOrDefault();

            q.EmpId     = tb.EmpId;
            q.LeaveDate = tb.LeaveDate;
            q.LeaveTime = tb.LeaveTime;
            q.BackTime  = tb.BackTime;
            q.LeaveType = tb.LeaveType;



            db.SubmitChanges();
            return(true);
        }
コード例 #10
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)
            {
                LeaveTable tb = new LeaveTable
                {
                    EmpId      = int.Parse(EmpComboBox.SelectedValue.ToString()),
                    LeaveDate  = LeaveDateTimePicker.Value.Date,
                    LeaveTime  = leaveTimeTimeEdit.Time.TimeOfDay,
                    BackTime   = backTimeTimeEdit.Time.TimeOfDay,
                    LeaveType  = radDropDownList1.Text,
                    TotalHouer = TotalHouer,
                };

                LeaveCmdClass.addLeave(tb);

                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        = backTimeTimeEdit.Time.TimeOfDay,
                        RealWorkTimeNo = UserClass.XWorkTime,
                        WorkTime       = Totaltime,
                        DefernceTime   = (Totaltime - UserClass.XWorkTime),
                        WorkFinsh      = "true"
                    };
                    WorkCmd.EditWorkUser(tb1);
                    RadMessageBox.Show("تمت الاضافة واعتماد ساعة الخروج", "تمت", MessageBoxButtons.OK, RadMessageIcon.Info);
                }
                else
                {
                    RadMessageBox.Show("تمت الاضافة بدون اعتماد ساعةالخروج", "تمت", MessageBoxButtons.OK, RadMessageIcon.Info);
                }
            }
            else
            {
                RadMessageBox.Show("يرجى اولا تسجيل الحضور", "خطأ", MessageBoxButtons.OK, RadMessageIcon.Error);
                return;
            }
        }