public int InsertShiftTimings(ShiftTiming _ShiftTimings)
        {
            try
            {
                int ReturnValue = 0;

                SqlCommand SqlCmd = new SqlCommand();

                SqlCmd.CommandType = CommandType.StoredProcedure;

                SqlCmd.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output;

                SqlCmd.Parameters.Add(GetParameter("@ShiftID", SqlDbType.Int, _ShiftTimings.ShiftID));
                SqlCmd.Parameters.Add(GetParameter("@OfficeID", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.OfficeID));
                SqlCmd.Parameters.Add(GetParameter("@DepartmentID", SqlDbType.Int, _ShiftTimings.DepartmentID));
                SqlCmd.Parameters.Add(GetParameter("@InTime", SqlDbType.DateTime, _ShiftTimings.InTime));
                SqlCmd.Parameters.Add(GetParameter("@OutTime", SqlDbType.DateTime, _ShiftTimings.OutTime));
                SqlCmd.Parameters.Add(GetParameter("@CalculationMode", SqlDbType.VarChar, _ShiftTimings.CalculationMode));
                SqlCmd.Parameters.Add(GetParameter("@WeeklyOffDay", SqlDbType.VarChar, _ShiftTimings.WeeklyOffDay));
                SqlCmd.Parameters.Add(GetParameter("@EffectiveDate", SqlDbType.DateTime, _ShiftTimings.EffectiveDate));
                SqlCmd.Parameters.Add(GetParameter("@AddedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID));

                SqlCmd.CommandText = "pHRM_ShiftTimings_Insert";

                ExecuteStoredProcedure(SqlCmd);
                ReturnValue = int.Parse(SqlCmd.Parameters[0].Value.ToString());

                return(ReturnValue);
            }
            catch (Exception ex)
            {
                throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
            }
        }
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID;
            Employee TheEmployee = EmployeeManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID);


            Label    txtShiftID   = (Label)gview_ShiftTiming.Rows[PageVariables.RowIndex].FindControl("lbl_ShiftID");
            Label    txtInTime    = (Label)gview_ShiftTiming.Rows[PageVariables.RowIndex].FindControl("lbl_InTime");
            Label    txtOutTime   = (Label)gview_ShiftTiming.Rows[PageVariables.RowIndex].FindControl("lbl_OutTime");
            Label    txtWeeklyOff = (Label)gview_ShiftTiming.Rows[PageVariables.RowIndex].FindControl("lbl_WeeklyOff");
            CheckBox chkSel       = (CheckBox)gview_ShiftTiming.FindControl("chk_Add");



            txtShiftID.Text   = lbl_ShiftID.Text;
            txtInTime.Text    = txt_InTime.Text;
            txtOutTime.Text   = txt_OutTime.Text;
            txtWeeklyOff.Text = ddl_WeeklyOff.SelectedValue;

            Label txtShiftTimingID = (Label)gview_ShiftTiming.Rows[PageVariables.RowIndex].FindControl("lbl_ShiftTimingID");

            if (Convert.ToInt16(txtShiftTimingID.Text) > 0)
            {
                ShiftTiming theShiftTiming = new ShiftTiming();

                theShiftTiming.ShiftTimingID   = Convert.ToInt16(txtShiftTimingID.Text);
                theShiftTiming.ShiftID         = Convert.ToInt16(txtShiftID.Text);
                theShiftTiming.DepartmentID    = TheEmployee.DepartmentID;
                theShiftTiming.InTime          = DateTime.Parse(txtInTime.Text);
                theShiftTiming.OutTime         = DateTime.Parse(txtOutTime.Text);
                theShiftTiming.WeeklyOffDay    = txtWeeklyOff.Text;
                theShiftTiming.EffectiveDate   = DateTime.Today;
                theShiftTiming.CalculationMode = "DAY";
                ShiftTimingsManagement.GetInstance.UpdateShiftTimings(theShiftTiming);
            }
            else if (Convert.ToInt16(txtShiftTimingID.Text) == 0)
            {
                ShiftTiming theShiftTiming = new ShiftTiming();

                theShiftTiming.ShiftID         = Convert.ToInt16(txtShiftID.Text);
                theShiftTiming.DepartmentID    = TheEmployee.DepartmentID;
                theShiftTiming.InTime          = DateTime.Parse(txtInTime.Text);
                theShiftTiming.OutTime         = DateTime.Parse(txtOutTime.Text);
                theShiftTiming.WeeklyOffDay    = txtWeeklyOff.Text;
                theShiftTiming.EffectiveDate   = DateTime.Today;
                theShiftTiming.CalculationMode = "DAY";
                ShiftTimingsManagement.GetInstance.InsertShiftTimings(theShiftTiming);
            }

            BindGridViewOfficeDesignations();


            ResetTextBoxes();
        }
 public static int UpdateShiftTimings(ShiftTiming _ShiftTimings)
 {
     try
     {
         return(ShiftTimingsDataAccess.GetInstance.UpdateShiftTimings(_ShiftTimings));
     }
     catch (Exception ex)
     {
         throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
     }
 }
 public int InsertShiftTimings(ShiftTiming _ShiftTimings)
 {
     try
     {
         return(ShiftTimingsIntegration.InsertShiftTimings(_ShiftTimings));
     }
     catch (Exception ex)
     {
         throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
     }
 }
        public static List <ShiftTiming> SetShiftTimingsList(DataTable ShiftTimingsTable)
        {
            try
            {
                List <ShiftTiming> _ShiftTimingsList = new List <ShiftTiming>();

                foreach (DataRow dr in ShiftTimingsTable.Rows)
                {
                    ShiftTiming _ShiftTimings = new ShiftTiming();
                    _ShiftTimings.ShiftTimingID     = int.Parse(dr["ShiftTimingID"].ToString());
                    _ShiftTimings.ShiftID           = int.Parse(dr["ShiftID"].ToString());
                    _ShiftTimings.ShiftOfficewiseID = int.Parse(dr["ShiftOfficewiseID"].ToString());
                    _ShiftTimings.ShiftDescription  = dr["ShiftDescription"].ToString();
                    _ShiftTimings.ShiftAlias        = dr["ShiftAlias"].ToString();
                    _ShiftTimings.OfficeID          = int.Parse(dr["OfficeID"].ToString());


                    _ShiftTimings.InTime = DateTime.Parse(dr["InTime"].ToString());


                    _ShiftTimings.OutTime         = DateTime.Parse(dr["OutTime"].ToString());
                    _ShiftTimings.WeeklyOffDay    = dr["WeeklyOffDay"].ToString();
                    _ShiftTimings.CalculationMode = dr["CalculationMode"].ToString();
                    _ShiftTimings.EffectiveDate   = DateTime.Parse(dr["EffectiveDate"].ToString());

                    _ShiftTimings.IsActive  = Boolean.Parse(dr["IsActive"].ToString());
                    _ShiftTimings.IsDeleted = Boolean.Parse(dr["IsDeleted"].ToString());

                    _ShiftTimingsList.Add(_ShiftTimings);
                }

                return(_ShiftTimingsList);
            }
            catch (Exception ex)
            {
                throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
            }
        }