/// <summary> /// To Get shift list /// </summary> /// <returns></returns> public List<Shift> GetShiftList(Shift objShift) { List<Shift> lstShift = null; try { using (ShiftManagementDLL shiftManagementDLL = new ShiftManagementDLL()) { lstShift = shiftManagementDLL.GetShiftList(objShift); } return lstShift; } catch { throw; } }
public List<Shift> GetShiftList(Shift objShift) { List<Shift> lstShift = null; string proc_name = ConstantsDLL.USP_GETSHIFTINFO; SqlParameter[] param = new SqlParameter[4]; if(objShift.ShiftId==0) { param[0] = new SqlParameter("@ShiftId", null); } else { param[0] = new SqlParameter("@ShiftId", objShift.ShiftId); } param[1] = new SqlParameter("@ShiftType", objShift.ShiftType); param[2] = new SqlParameter("@ShiftCategory", objShift.ShiftCategory); param[3] = new SqlParameter("@IsActive", objShift.IsActive); using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper()) { using (DataSet ds = db.ExecDataSetProc(proc_name, param)) { if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { DataTable tbShift = ds.Tables[0]; lstShift = tbShift.AsEnumerable().Select(shift => new Shift { ShiftId = Convert.ToInt32(shift["ShiftId"]), ShiftType = Convert.ToString(shift["ShiftType"]), ShiftCategory = Convert.ToString(shift["ShiftCategory"]), ShiftTime =DateTime.Parse(shift["ShiftTime"].ToString()).ToString("HH:mm"), DcName = Convert.ToString(shift["DCName"]), IsActive=Convert.ToBoolean(shift["IsActive"]) }).ToList(); } } } } return lstShift; }
public string UpdateShift(Shift shift) { string proc_name = ConstantsDLL.USP_UPDATESHIFTINFO; SqlParameter[] param = new SqlParameter[7]; param[0] = new SqlParameter("@ShiftId", shift.ShiftId); param[1] = new SqlParameter("@ShiftCategory", shift.ShiftCategory); param[2] = new SqlParameter("@ShiftType",shift.ShiftType); param[3] = new SqlParameter("@ShiftTime",shift.ShiftTime); param[4] = new SqlParameter("@DCID", shift.DCID); param[5] = new SqlParameter("@ModifiedBy",shift.ModifiedBy); string Result = ""; param[6] = new SqlParameter("@Result", SqlDbType.VarChar, 50, Result); param[6].Direction = ParameterDirection.Output; using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper()) { db.ExecNonQueryProc(proc_name, param); } Result = Convert.ToString(param[6].Value); return Result; }
/// <summary> /// To insert a new shift /// </summary> /// <param name="shift"></param> /// <returns></returns> public string InsertShift(Shift shift) { string OutResult =""; try { using (ShiftManagementDLL shiftManagementDLL = new ShiftManagementDLL()) { OutResult = shiftManagementDLL.InsertShift(shift); } return OutResult; } catch { throw; } }
/// <summary> /// to update details in shift /// </summary> /// <param name="shift"></param> /// <returns></returns> public string UpdateShift(Shift shift) { string isFlag = string.Empty; try { using (ShiftManagementDLL shiftManagementDLL = new ShiftManagementDLL()) { isFlag = shiftManagementDLL.UpdateShift(shift); } return isFlag; } catch { throw; } }