public static List <ShiftOfficewise> GetShiftOfficewiseByOfficeID(int OfficeID) { try { DataTable ShiftOfficewiseRows = ShiftOfficewiseDataAccess.GetInstance.GetShiftOfficewiseByOfficeID(OfficeID); List <ShiftOfficewise> _ShiftOfficewiseList = new List <ShiftOfficewise>(); foreach (DataRow dr in ShiftOfficewiseRows.Rows) { ShiftOfficewise _ShiftOfficewise = new ShiftOfficewise(); _ShiftOfficewise.ShiftOfficewiseID = int.Parse(dr["ShiftOfficewiseID"].ToString()); _ShiftOfficewise.ShiftID = int.Parse(dr["ShiftID"].ToString()); _ShiftOfficewise.ShiftDescription = dr["ShiftDescription"].ToString(); _ShiftOfficewise.ShiftAlias = dr["ShiftAlias"].ToString(); // _ShiftOfficewise.InTime = Convert.ToDateTime(dr["InTime"].ToString()).ToShortTimeString(); // _ShiftOfficewise.OutTime = Convert.ToDateTime(dr["OutTime"].ToString()).ToShortTimeString(); _ShiftOfficewise.Office.OfficeID = int.Parse(dr["OfficeID"].ToString()); _ShiftOfficewise.IsActive = Boolean.Parse(dr["IsActive"].ToString()); //_ShiftOfficewise.IsDeleted = Boolean.Parse(dr["IsDeleted"].ToString()); _ShiftOfficewiseList.Add(_ShiftOfficewise); } return(_ShiftOfficewiseList); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
public int UpdateShiftOfficewise(ShiftOfficewise _ShiftOfficewise) { 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("ShiftOfficewiseID", SqlDbType.Int, _ShiftOfficewise.ShiftOfficewiseID)); SqlCmd.Parameters.Add(GetParameter("@ShiftID", SqlDbType.Int, _ShiftOfficewise.ShiftID)); // SqlCmd.Parameters.Add(GetParameter("@InTime", SqlDbType.DateTime, _ShiftOfficewise.Shift.InTime)); // SqlCmd.Parameters.Add(GetParameter("@OutTime", SqlDbType.DateTime, _ShiftOfficewise.Shift.OutTime)); SqlCmd.Parameters.Add(GetParameter("@OfficeID", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.OfficeID)); SqlCmd.Parameters.Add(GetParameter("@IsActive", SqlDbType.Bit, (_ShiftOfficewise.IsActive == true ? 1 : 0))); SqlCmd.Parameters.Add(GetParameter("@DateModified", SqlDbType.DateTime, DateTime.Now)); SqlCmd.Parameters.Add(GetParameter("@ModifiedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); SqlCmd.CommandText = "pHRM_ShiftsOfficewise_Update"; 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)); } }
public int UpdateShiftOfficewise(ShiftOfficewise _ShiftOfficewise) { try { return(ShiftOfficewiseIntegration.UpdateShiftOfficewise(_ShiftOfficewise)); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
public static int InsertShiftOfficewise(ShiftOfficewise _ShiftOfficewise) { try { return(ShiftOfficewiseDataAccess.GetInstance.InsertShiftOfficewise(_ShiftOfficewise)); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
protected void btn_Apply_Click(object sender, EventArgs e) { int result = (int)MicroEnums.DataOperationResult.Failure; ShiftOfficewise TheShiftOfficewise = new ShiftOfficewise(); List <ShiftOfficewise> thisShiftOfficewiseList = new List <ShiftOfficewise>(); foreach (GridViewRow therow in gview_Shiftelect.Rows) { ShiftOfficewise thisShiftOfficewise = new ShiftOfficewise(); CheckBox chkb = (CheckBox)therow.FindControl("chk_Add"); Label theOfficelabel = (Label)therow.FindControl("lbl_ShiftOfficeId"); if (int.Parse(theOfficelabel.Text) == 0) { if (chkb.Checked) { TheShiftOfficewise.ShiftID = int.Parse(therow.Cells[2].Text); result = ShiftOfficewiseManagement.GetInstance.InsertShiftOfficewise(TheShiftOfficewise); lbl_TheMessage.Text = GetDataOperationResult(result, "Shift", MicroEnums.DataOperation.AddNew); } } else if (int.Parse(theOfficelabel.Text) != 0) { TheShiftOfficewise.ShiftID = int.Parse(therow.Cells[2].Text); if (!chkb.Checked) { TheShiftOfficewise.IsActive = false; } else { TheShiftOfficewise.IsActive = true; } TheShiftOfficewise.ShiftOfficewiseID = int.Parse(theOfficelabel.Text); result = ShiftOfficewiseManagement.GetInstance.UpdateShiftOfficewise(TheShiftOfficewise); lbl_TheMessage.Text = GetDataOperationResult(result, "Shift", MicroEnums.DataOperation.Edit); } } if (!string.IsNullOrEmpty(lbl_TheMessage.Text)) { dialog_Message.Show(); } }
public void BindGridViewOfficeDesignations() { ShiftOfficewise teShiftOfficewise = new ShiftOfficewise(); List <ShiftOfficewise> _ShiftsList = new List <ShiftOfficewise>(); _ShiftsList = ShiftOfficewiseManagement.GetInstance.GetShiftOfficewiseByOfficeID(Connection.LoggedOnUser.OfficeID); gview_ShiftTiming.DataSource = _ShiftsList; gview_ShiftTiming.DataBind(); int counter = 0; foreach (GridViewRow therow in gview_ShiftTiming.Rows) { Label theShiftlabel = (Label)therow.FindControl("lbl_ShiftID"); Label theShiftTimingIdlabel = (Label)therow.FindControl("lbl_ShiftTimingID"); Label theOfficelabel = (Label)therow.FindControl("lbl_ShiftOfficeId"); Label theAilaslabel = (Label)therow.FindControl("lbl_ShiftAlias"); Label theDescriptionlabel = (Label)therow.FindControl("lbl_ShiftDescription"); Label theintimelabel = (Label)therow.FindControl("lbl_InTime"); Label theouttimelabel = (Label)therow.FindControl("lbl_OutTime"); Label theWeeklyOfflabel = (Label)therow.FindControl("lbl_WeeklyOff"); CheckBox theCheckBox = (CheckBox)therow.FindControl("chk_Add"); PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID; Employee TheEmployee = EmployeeManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID); //Get ShiftTimings of Current Employee Department int shiftTID = (int)gview_ShiftTiming.DataKeys[therow.RowIndex].Value; List <ShiftTiming> _ShftTimingList = new List <Micro.Objects.HumanResource.ShiftTiming>(); _ShftTimingList = ShiftTimingsManagement.GetInstance.GetShiftTimingsByOfficeIDandDepartmentID(TheEmployee.DepartmentID); var thisShiftID = _ShftTimingList.Where(shift => shift.ShiftID.Equals(shiftTID)).ToList(); if (thisShiftID.Count > 0) { foreach (ShiftTiming theShiftTiming in thisShiftID) { if (theShiftlabel.Text.Equals(theShiftTiming.ShiftID.ToString())) { if (theShiftTiming.IsActive.Equals(true)) { theCheckBox.Checked = true; } theOfficelabel.Text = theShiftTiming.ShiftOfficewiseID.ToString(); theAilaslabel.Text = theShiftTiming.ShiftAlias; theDescriptionlabel.Text = theShiftTiming.ShiftDescription; theintimelabel.Text = theShiftTiming.InTime.ToShortTimeString(); theouttimelabel.Text = theShiftTiming.OutTime.ToShortTimeString(); theWeeklyOfflabel.Text = theShiftTiming.WeeklyOffDay; theShiftTimingIdlabel.Text = theShiftTiming.ShiftTimingID.ToString(); if (_ShftTimingList.Count > 1 && counter == _ShftTimingList.Count) { break; } } } } else { var thisShiftID1 = _ShiftsList.Where(shift => shift.ShiftID.Equals(shiftTID)).SingleOrDefault(); int a = Convert.ToInt16(theShiftlabel.Text); if (a == shiftTID) { theOfficelabel.Text = "0"; theShiftTimingIdlabel.Text = "0"; theAilaslabel.Text = thisShiftID1.ShiftAlias; theDescriptionlabel.Text = thisShiftID1.ShiftDescription; theintimelabel.Text = thisShiftID1.InTime; theouttimelabel.Text = thisShiftID1.OutTime; theWeeklyOfflabel.Text = ""; } } } BasePage.HideGridViewColumn(gview_ShiftTiming, "ShiftID"); BasePage.HideGridViewColumn(gview_ShiftTiming, "ShiftTimingID"); BasePage.HideGridViewColumn(gview_ShiftTiming, "ShiftOfficeWiseID"); }