Пример #1
0
        private void BtnAddShift_Click(object sender, EventArgs e)
        {
            frmDriverShifts frm = new frmDriverShifts();

            frm.ShowDialog();
            frm.Dispose();
            PopulateData();
        }
Пример #2
0
        //public string ShowDayName(int FromDay)
        //{
        //    string Name = string.Empty;
        //    if (FromDay == 2)
        //    {
        //        Name = "Monday";
        //    }
        //    else if (FromDay == 3)
        //    {
        //        Name = "Tuesday";
        //    }
        //    else if (FromDay == 4)

        //    {
        //        Name = "Wednesday";
        //    }
        //    else if (FromDay == 5)
        //    {
        //        Name = "Thursday";
        //    }
        //    else if (FromDay == 6)
        //    {
        //        Name = "Friday";
        //    }
        //    else if (FromDay == 7)
        //    {
        //        Name = "Saturday";
        //    }
        //    else if (FromDay == 1)
        //    {
        //        Name = "Sunday";
        //    }
        //    return Name;
        //}
        private void GrdDriverShift_CommandCellClick(object sender, EventArgs e)
        {
            GridCommandCellElement gridCell = (GridCommandCellElement)sender;

            try
            {
                if (gridCell.ColumnInfo.Name.ToLower() == "btnedit")
                {
                    GridViewRowInfo row = grdLister.CurrentRow;
                    int             Id  = row.Cells["Id"].Value.ToInt();
                    objMaster.GetByPrimaryKey(Id);
                    frmDriverShifts frm = new frmDriverShifts();
                    frm.OnDisplayRecord(Id);
                    frm.ShowDialog();
                    PopulateData();
                    //OnDisplayRecord(Id);
                }
                else if (gridCell.ColumnInfo.Name.ToLower() == "btndelete")
                {
                    if (DialogResult.Yes == RadMessageBox.Show("Are you sure you want to delete a Record ? ", "", MessageBoxButtons.YesNo, RadMessageIcon.Question))
                    {
                        GridViewRowInfo row = grdLister.CurrentRow;

                        int Id = row.Cells["Id"].Value.ToInt();
                        objMaster.GetByPrimaryKey(Id);

                        objMaster.Delete(objMaster.Current);;
                        grdLister.CurrentRow.Delete();
                    }
                }
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }