/// <summary>
        /// Method to get CabCapacity
        /// </summary>
        /// <returns></returns>
        public List<CabCapacity> CABTYPELIST()
        {
            List<CabCapacity > lstcabcapacity = null;
            string proc_name = ConstantsDLL.usp_GETCABCAPACITY ;

            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            {
                using (DataSet ds = db.ExecDataSetProc(proc_name, null))
                {
                    if (ds != null)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            DataTable tbCABCPC = ds.Tables[0];
                            lstcabcapacity = tbCABCPC.AsEnumerable().Select(CabCpcty => new CabCapacity
                            {

                                capacity = Convert.ToString(CabCpcty["cabcapacity"])

                            }).ToList();
                        }
                    }
                }
            }

            return lstcabcapacity;
        }
        /// <summary>
        /// Method to get CabProperty
        /// </summary>
        public List<CabProperty> GetCabProperty()
        {
            List<CabProperty> lstgetcabproperty = null;
               string proc_name = ConstantsDLL.USP_GETCABPROPERTY;
               using(SqlHelper.SqlHelper db=new SqlHelper.SqlHelper() )
               {
               using (DataSet ds = db.ExecDataSetProc(proc_name, null))
               {
                   if (ds != null)
                   {
                       if (ds.Tables[0].Rows.Count > 0)
                       {
                           DataTable tbCabProperty = ds.Tables[0];
                           lstgetcabproperty = tbCabProperty.AsEnumerable().Select(cabProperty => new CabProperty {

                               PropertyId = Convert.ToInt32(cabProperty["PropertyId"]),
                               PropertyName = Convert.ToString(cabProperty["PropertyName"]),
                               IsCompulsory=Convert.ToBoolean(cabProperty["IsCompulsory"])

                           }).ToList();

                       }

                   }

              }
               }

               return lstgetcabproperty;
        }
        /// <summary>
        /// Method to get CabType
        /// </summary>
        /// <param name="CabName"></param>
        /// <param name="IsActive"></param>
        /// <returns></returns>
        public List<CabType> CABTYPELIST( bool? IsActive)
        {
            List<CabType> lstcabtype = null;
            string proc_name = ConstantsDLL.USP_GETCABTYPE;

            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            {
                using (DataSet ds = db.ExecDataSetProc(proc_name, null))
                {
                    if (ds != null)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            DataTable tbCABTYPE = ds.Tables[0];
                            lstcabtype = tbCABTYPE.AsEnumerable().Select(Cabtype => new CabType
                            {

                                CABNAME = Convert.ToString(Cabtype["CABNAME"])

                            }).ToList();
                        }
                    }
                }
            }

            return lstcabtype;
        }
        public bool CreateRoaster(string Prifix,out string roosternumber)
        {
            bool isFlag = false;
            try
            {
                ObjSqlHelper = new SqlHelper.SqlHelper();
                string proc_name = ConstantsDLL.USP_CREATEROASTERNO;
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Prefix", Prifix);
                param[1] = new SqlParameter("@RoosterNumber", SqlDbType.NVarChar, 20);

                param[1].Direction = ParameterDirection.Output;

                ObjSqlHelper.ExecNonQueryProc(proc_name, param);

                roosternumber = param[1].Value.ToString();

                if (roosternumber != null && roosternumber !="")
                isFlag = true;
            }
            catch(Exception ex)
            {
                isFlag = false;
                throw;
            }
            return isFlag;
        }
        /// <summary>
        /// Method to get DC list 
        /// </summary>
        /// <param name="VendorId"></param>
        /// <param name="IsActive"></param>
        /// <returns></returns>
        public List<DC> GetDCList()
        {
            List<DC> lstDC = null;
            string proc_name = ConstantsDLL.USP_GETDCLIST;

            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            {
                using (DataSet ds = db.ExecDataSetProc(proc_name, null))
                {
                    if (ds != null)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            DataTable tbDCs = ds.Tables[0];
                            lstDC = tbDCs.AsEnumerable().Select(vendor => new DC
                            {
                                DCID = Convert.ToInt32(vendor["DCID"]),
                                DCName = Convert.ToString(vendor["DCName"]),
                                IsActive = Convert.ToInt32(vendor["IsActive"]),
                                CreatedDate = Convert.ToString(vendor["CreatedDate"]),
                                CreatedBy = Convert.ToString(vendor["CreatedBy"]),
                                ModifiedDate = Convert.ToString(vendor["ModifiedDate"]),
                                ModifiedBy = Convert.ToString(vendor["ModifiedBy"])

                            }).ToList();
                        }
                    }
                }
            }

            return lstDC;
        }
        /// <summary>
        /// Method to get RoleDetail
        /// </summary>
        /// <returns></returns>
        public List<RoleDetail> GetRoleDetail()
        {
            List<RoleDetail> lstroledetail = null;
               string proc_name = ConstantsDLL.USP_GETROLEDETAIL;

               using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
               {
               using (DataSet ds = db.ExecDataSetProc(proc_name, null))
               {
                   if (ds != null)
                   {
                       if (ds.Tables[0].Rows.Count > 0)
                       {
                           DataTable tbRoleDeatil = ds.Tables[0];
                           lstroledetail = tbRoleDeatil.AsEnumerable().Select(roledetail => new RoleDetail
                           {
                               RoleId = Convert.ToInt32(roledetail["RoleId"]),
                               RoleName = Convert.ToString(roledetail["RoleName"]),
                               RoleAccess = Convert.ToString(roledetail["RoleAccess"]),
                               CreatedDate = Convert.ToString(roledetail["CreatedDate"]),
                               CreatedBy = Convert.ToString(roledetail["CreatedBy"]),
                               ModifiedDate = Convert.ToString(roledetail["ModifiedDate"]),
                               ModifiedBy = Convert.ToString(roledetail["ModifiedBy"]),
                               IsActive = Convert.ToBoolean(roledetail["IsActive"])
                           }).ToList();
                       }
                   }
               }
               }

               return lstroledetail;
        }
        public bool CancelRequest(int RequestId)
        {
            string proc_name = ConstantsDLL.USP_CANCELONDEMANDREQUEST;
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@OnDemandID", RequestId);

            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            {
                db.ExecNonQueryProc(proc_name, param);
            }
            return true;
        }
        /// <summary>
        /// Method to make ActiveInActive Driver
        /// </summary>
        /// <param name="vendor"></param>
        /// <returns></returns>
        public bool ActiveInactiveDriverDeatil(string DriverId, bool ActiveInactive, string ModifiedBy)
        {
            string proc_name = ConstantsDLL.USP_ActiveInactiveDriver;
            SqlParameter[] param = new SqlParameter[3];
            param[0] = new SqlParameter("@DriverId", DriverId);
            param[1] = new SqlParameter("@IsActive", ActiveInactive);
            param[2] = new SqlParameter("@ModifiedBy", ModifiedBy);

            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            {
                db.ExecNonQueryProc(proc_name, param);
            }
            return true;
        }
        public bool DeleteDC(string DCId, bool IsActive, string Modifiedby)
        {
            ObjSqlHelper = new SqlHelper.SqlHelper();

            string proc_name = ConstantsDLL.USP_DELETEDC;
            SqlParameter[] param = new SqlParameter[3];

            param[0] = new SqlParameter("@DCId", DCId);
            param[1] = new SqlParameter("@IsActive", IsActive);
            param[2] = new SqlParameter("@ModifyBy", Modifiedby);

            ObjSqlHelper.ExecNonQueryProc(proc_name, param);

            return true;
        }
        /// <summary>
        /// Method to active or deactivate the vendor with comment option
        /// </summary>
        /// <param name="VendorId"></param>
        /// <param name="IsActive"></param>
        /// <param name="IsActiveComment"></param>
        /// <param name="ModifiedBy"></param>
        /// <returns></returns>
        public bool Active_InactiveVendor(string VendorIds,bool IsActive,string IsActiveComment,string ModifiedBy)
        {
            string proc_name = ConstantsDLL.USP_ACTIVEINACTIVEVENDOR;
            SqlParameter[] param = new SqlParameter[4];
            param[0] = new SqlParameter("@VendorIDs",VendorIds);
            param[1] = new SqlParameter("@IsActive",IsActive);
            param[2] = new SqlParameter("@IsActiveComment", IsActiveComment);
            param[3] = new SqlParameter("@ModifiedBy", ModifiedBy);

            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            {
                db.ExecNonQueryProc(proc_name, param);
            }
            return true;
        }
        /// <summary>
        /// Method to Delete RoleDetail
        /// </summary>
        /// <returns></returns>
        public bool DeleteRole(string RoleId, bool IsActive, string Modifiedby)
        {
            ObjSqlHelper = new SqlHelper.SqlHelper();

            string proc_name = ConstantsDLL.USP_ACTIVEINACTIVEROLE;
            SqlParameter[] param = new SqlParameter[3];

            param[0] = new SqlParameter("@RoleId", RoleId);
            param[1] = new SqlParameter("@IsActive", IsActive);
            param[2] = new SqlParameter("@ModifyBy", Modifiedby);

            ObjSqlHelper.ExecNonQueryProc(proc_name, param);

            return true;
        }
        /// <summary>
        /// Method to Get List of Driver DETAIL
        /// </summary>
        /// <returns></returns>
        /// 
        public List<DriverDetail> GetDriverDetails(int DCID, bool ? IsActive)
        {
            List<DriverDetail> lstdriverdetails = null;
            string proc_name = ConstantsDLL.usp_GetDriverDetailsAccToDC;
            SqlParameter[] param = new SqlParameter[2];
            //if(DriverCode==string.Empty)
            //{
            //    param[0] = new SqlParameter("@DriverCode", null);
            //}
            //else
            //{
            //    param[0] = new SqlParameter("@DriverCode", DriverCode);
            //}

            param[0] = new SqlParameter("@DCID", DCID);
            param[1] = new SqlParameter("@IsActive", 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 tbDriverDetails = ds.Tables[0];
                            lstdriverdetails = tbDriverDetails.AsEnumerable().Select(DriverDetails => new DriverDetail
                            {
                                DriverId =Convert.ToInt32( DriverDetails["DriverId"].ToString()),
                                DriverCode = DriverDetails["DriverCode"].ToString(),
                                DriverName = DriverDetails["DriverName"].ToString(),
                                DCName= DriverDetails["DCName"].ToString(),
                                //EmpanelDate = (Convert.ToDateTime(DriverDetails["EmpanelDate"])).ToString("MMM dd,yyyy"),
                                //CreatedBy = DriverDetails["CreatedBy"].ToString(),
                                //ModifyDate = (Convert.ToDateTime(DriverDetails["ModifyDate"])).ToString("MMM dd,yyyy"),
                                //ModifyBy = DriverDetails["ModifyBy"].ToString(),
                                IsActive =Convert.ToBoolean(DriverDetails["IsActive"].ToString())

                            }).ToList();

                        }
                    }

                }
                return lstdriverdetails;

            }
        }
        public bool ActiveInactiveUser(string UserID, bool ActiveInactive, string ModifiedBy)
        {
            string proc_name = ConstantsDLL.USP_ACTIVEINACTIVEUSER;

            SqlParameter[] param = new SqlParameter[3];
            param[0] = new SqlParameter("@OndemandRequestID", UserID);
            param[1] = new SqlParameter("@IsActive", ActiveInactive);

            param[2] = new SqlParameter("@ModifiedBy", ModifiedBy);

            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            {
                db.ExecNonQueryProc(proc_name, param);
            }
            return true;
        }
        public bool Active_InactiveShift(string ShiftIds, bool IsActive, string ModifiedBy)
        {
            string proc_name = ConstantsDLL.USP_ACTIVEINACTIVESHIFT;

            SqlParameter[] param = new SqlParameter[3];
            param[0] = new SqlParameter("@ShiftIds", ShiftIds);
            param[1] = new SqlParameter("@IsActive",IsActive);

            param[2] = new SqlParameter("@ModifiedBy",ModifiedBy);

            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            {
                db.ExecNonQueryProc(proc_name, param);
            }
            return true;
        }
        public bool ApproveUserRequest(string UserId, string ModifiedBy, string Comment)
        {
            string proc_name = ConstantsDLL.USP_APPROVEUSERREQUEST;

            SqlParameter[] param = new SqlParameter[3];
            param[0] = new SqlParameter("@OndemandRequestID", UserId);
            param[1] = new SqlParameter("@ModifiedBy", ModifiedBy);

            param[2] = new SqlParameter("@Comment", Comment);

            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            {
                db.ExecNonQueryProc(proc_name, param);
            }
            return true;
        }
        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 Int32 DeleteRouteMaster(RouteMaster ObjRouteMaster)
 {
     ObjSqlHelper = new SqlHelper.SqlHelper();
     SqlParameter[] oPara =
     {
         new SqlParameter("@DPID", SqlDbType.VarChar),
         new SqlParameter("@IsActive", SqlDbType.Int),
         new SqlParameter("@ModifiedBy", SqlDbType.VarChar),
         new SqlParameter("@Rval", SqlDbType.Int)
     };
     oPara[0].Value = ObjRouteMaster.RouteIDs;
     oPara[0].Size = 255;
     oPara[1].Value = ObjRouteMaster.IsActive;
     oPara[1].Size = 155;
     oPara[2].Value = ObjRouteMaster.ModifiedBy;
     oPara[2].Size = 255;
     oPara[3].Direction = ParameterDirection.ReturnValue;
     ObjSqlHelper.ExecNonQueryProc(ConstantsDLL.USP_DeleteRoute, oPara);
     return Convert.ToInt32(oPara[3].Value);
 }
        /// <summary>
        /// Method to get Backend Record For Validate Roster
        /// </summary>
        /// <returns></returns>
        public DataSet RecordForValidateRoster()
        {
            DataSet RecordForValidateDS = new DataSet();
               string proc_name = ConstantsDLL.USP_GETRECORDFORROSTER;

               using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
               {
               using (DataSet ds = db.ExecDataSetProc(proc_name, null))
               {
                   if (ds != null)
                   {

                           RecordForValidateDS = ds;

                   }
               }

               }

               return RecordForValidateDS;
        }
 public List<RouteMaster> GetAllPointsByRoute(string RouteName)
 {
     try
     {
         List<RouteMaster> list = null;
         SqlParameter[] opara =
         {
             new SqlParameter("@RouteName",RouteName)
         };
         using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
         {
             using (DataSet ds = db.ExecDataSetProc(ConstantsDLL.USP_GETPOINTSBYROUTE, opara))
             {
                 if (ds != null)
                 {
                     list = ds.Tables[0].AsEnumerable().Select(x => new RouteMaster
                     {
                         RouteID = (Int32)(x["RouteID"]),
                         //RouteName = (string)(x["RouteName"] ?? ""),
                         DropPoint = (string)(x["DropPoint"] == null || x["DropPoint"] == DBNull.Value ? string.Empty : x["DropPoint"].ToString()),
                         //DCID = (Int32)(x["DCID"] ?? ""),
                        // DCName = (string)(x["DCName"] ?? ""),
                         //IsActive = (Boolean)(x["IsActive"] ?? "")
                     }).ToList();
                     return list;
                 }
                 else
                 {
                     return list;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        /// <summary>
        /// Method to get vendor list by their status
        /// </summary>
        /// <param name="VendorId"></param>
        /// <param name="IsActive"></param>
        /// <returns></returns>
        public List<Vendor> GetVendorList(Int32? VendorId, bool? IsActive)
        {
            List<Vendor> lstVendor = null;
            string proc_name = ConstantsDLL.USP_GETVENDORLIST;
            SqlParameter[] param = new SqlParameter[2];
            param[0] = new SqlParameter("@VendorID", VendorId);
            param[1] = new SqlParameter("@IsActive", 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 tbVendor = ds.Tables[0];
                        lstVendor = tbVendor.AsEnumerable().Select(vendor => new Vendor
                        {
                            VendorID = Convert.ToInt32(vendor["VendorID"]),
                            VendorName = Convert.ToString(vendor["VendorName"]),
                            Address = Convert.ToString(vendor["Address"]),
                            City = Convert.ToString(vendor["City"]),
                            EmpanelDate = (Convert.ToDateTime(vendor["EmpanelDate"])).ToString("MMM dd,yyyy"),
                            DCName = Convert.ToString(vendor["DCName"]),
                            Comment = Convert.ToString(vendor["Comment"]),
                            CreatedBy = Convert.ToString(vendor["CreatedBy"]),
                            CreatedDate = Convert.ToDateTime(vendor["CreatedDate"]),
                            IsActive = Convert.ToBoolean(vendor["IsActive"])
                        }).ToList();
                        }
                    }
                }
            }

            return lstVendor;
        }
        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>
        /// Method to make modification in vendor
        /// </summary>
        /// <param name="vendor"></param>
        /// <returns></returns>
        public Int32 UpdateVendor(Vendor vendor)
        {
            ObjSqlHelper = new SqlHelper.SqlHelper();
            SqlParameter[] oPara =
            {
                new SqlParameter("@VendorID", SqlDbType.Int),
                new SqlParameter("@VendorName", SqlDbType.VarChar),
                new SqlParameter("@Address", SqlDbType.VarChar),
                new SqlParameter("@City", SqlDbType.VarChar),
                new SqlParameter("@EmpanelDate",SqlDbType.VarChar),
                new SqlParameter("@DCID", SqlDbType.Int),
                new SqlParameter("Comment",SqlDbType.VarChar),
                new SqlParameter("ModifiedBy",SqlDbType.VarChar),
                new SqlParameter("@Rval", SqlDbType.Int)
            };
            oPara[0].Value = vendor.VendorID;
            oPara[0].Size = 155;
            oPara[1].Value = vendor.VendorName.Trim();
            oPara[1].Size = 155;
            oPara[2].Value = vendor.Address;
            oPara[2].Size = 255;
            oPara[3].Value = vendor.City;
            oPara[3].Size=255;
            oPara[4].Value = vendor.EmpanelDate;
            oPara[4].Size = 255;
            oPara[5].Value = vendor.DCID;
            oPara[5].Size = 255;
            oPara[6].Value = vendor.Comment;
            oPara[6].Size = 255;
            oPara[7].Value = vendor.ModifiedBy;
            oPara[7].Size = 255;

            oPara[8].Direction = ParameterDirection.ReturnValue;
            ObjSqlHelper.ExecNonQueryProc(ConstantsDLL.USP_UPDATEVENDOR, oPara);
            return Convert.ToInt32(oPara[8].Value);
        }
        /// <summary>
        /// Method to insert the details for creating new vendor
        /// </summary>
        /// <param name="vendor"></param>
        /// <returns></returns>
        public int InsertVendor(Vendor vendor)
        {
            //string proc_name = ConstantsDLL.USP_INSERTVENDOR;
            ObjSqlHelper = new SqlHelper.SqlHelper();
            SqlParameter[] param =
            {
             new SqlParameter("@VendorName",SqlDbType.VarChar),
             new SqlParameter("@Address",SqlDbType.VarChar),
             new SqlParameter("@City", SqlDbType.VarChar),
             new SqlParameter("@EmpanelDate",SqlDbType.Date),
             new SqlParameter("@DCID", SqlDbType.Int),
             new SqlParameter("@Comment",SqlDbType.VarChar),
             new SqlParameter("@CreatedBy",SqlDbType.VarChar),
             new SqlParameter("@rVal",SqlDbType.Int)
            };
            param[0].Value = vendor.VendorName;
            param[0].Size = 255;
            param[1].Value = vendor.Address;
            param[1].Size = 155;
            param[2].Value = vendor.City;
            param[2].Size = 255;
            param[3].Value = vendor.EmpanelDate;
            param[3].Size = 255;
            param[4].Value = vendor.DCID;
            param[4].Size = 155;
            param[5].Value = vendor.Comment;
            param[5].Size = 255;
            param[6].Value = vendor.CreatedBy;
            param[6].Size = 255;
            param[7].Direction = ParameterDirection.ReturnValue;

            ObjSqlHelper.ExecNonQueryProc(ConstantsDLL.USP_INSERTVENDOR, param);
            //using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            //{
            //    db.ExecNonQueryProc(proc_name, param);
            //}
            //return true;
            return Convert.ToInt32(param[7].Value);
        }
        public List<Vendor> GetVendorList(Int32? VendorId, bool? IsActive,int DCID)
        {
            List<Vendor> lstVendor = null;
            string proc_name = ConstantsDLL.USP_GETVENDORLISTACCTODC;
            SqlParameter[] param = new SqlParameter[3];
            param[0] = new SqlParameter("@VendorID", VendorId);
            param[1] = new SqlParameter("@IsActive", IsActive);
            param[2] = new SqlParameter("@DCID", DCID);

            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 tbVendor = ds.Tables[0];
                            lstVendor = tbVendor.AsEnumerable().Select(vendor => new Vendor
                            {
                                VendorID = Convert.ToInt32(vendor["VendorID"]),
                                VendorName = Convert.ToString(vendor["VendorName"]),
                                IsActive = Convert.ToBoolean(vendor["IsActive"])
                            }).ToList();
                        }
                    }
                }
            }

            return lstVendor;
        }
        /// <summary>
        /// Method to insert the details for creating new request
        /// </summary>
        /// <param name="vendor"></param>
        /// <returns></returns>
        public bool InsertRequest(OnDemandRequest request)
        {
            string proc_name = ConstantsDLL.USP_INSERTNEWREQUEST;
            SqlParameter[] param = new SqlParameter[15];
            param[0] = new SqlParameter("@RequestType", request.RequestType);
            param[1] = new SqlParameter("@ReoccuringRequestId", request.ReoccuringRequest);
            param[2] = new SqlParameter("@ToDate", request.toDate);

            param[3] = new SqlParameter("@EmailId", request.EmailId);
            param[4] = new SqlParameter("@BookingType", request.BookingType);
            param[5] = new SqlParameter("@Gender", request.Gender);
            param[6] = new SqlParameter("@RouteId", request.RouteId);
            param[7] = new SqlParameter("@RequestedDate", request.RequestedDate);

            param[8] = new SqlParameter("@RequestedTime", System.Data.SqlDbType.Time,50);
            param[8].Value = request.RequestedTime;
            param[9] = new SqlParameter("@Address", request.Address);
            param[10] = new SqlParameter("@Mobile", request.Mobile);
            param[11] = new SqlParameter("@RequestRemarks", request.RequestRemarks);
            param[12] = new SqlParameter("@CreatedBy", request.CreatedBy);
            param[13] = new SqlParameter("@DCID", request.DCID);
            param[14] = new SqlParameter("@Approver", request.Approver);

            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            {
                db.ExecNonQueryProc(proc_name, param);
            }
            return true;
        }
        public bool UpdateRequest(OnDemandRequest Request)
        {
            string proc_name = ConstantsDLL.USP_UPDATEONDEMANDREQUEST;
            SqlParameter[] param = new SqlParameter[8];
            param[0] = new SqlParameter("@OnDemandID", Request.OndemandRequestId);
            param[1] = new SqlParameter("@Approver", Request.Approver);
            param[2] = new SqlParameter("@Address", Request.Address);
             //   param[3] = new SqlParameter("@RequestedDate", Request.RequestedDate);

            param[3] = new SqlParameter("@RequestedDate", System.Data.SqlDbType.Date, 50);
            param[3].Value =Convert.ToDateTime(Request.RequestedDate);

            param[4] = new SqlParameter("@RequestedTime", Request.RequestedTime);
            param[5] = new SqlParameter("@ApproverRemarks", Request.RequestRemarks);
            param[6] = new SqlParameter("@RequestType", Request.RequestType);
               // param[7] = new SqlParameter("@RouteName", Request.RouteName);
            param[7] = new SqlParameter("@BookingType", Request.BookingType);

            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            {
                db.ExecNonQueryProc(proc_name, param);
            }
            return true;
        }
        public List<Shift> GetShiftListByDC(int DCId, string ShiftType, string RequestType)
        {
            List<Shift> lstShift = null;
            string proc_name = ConstantsDLL.USP_GETSHIFTDETAILBYDC;
            SqlParameter[] param = new SqlParameter[3];
            param[0] = new SqlParameter("@DCID", DCId);
            param[1] = new SqlParameter("@ShiftType", ShiftType);
            param[2] = new SqlParameter("@RequestType", RequestType);
            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"]),
                                ShiftCategory = Convert.ToString(shift["ShiftCategory"]),   //corrected by piyush
                                ShiftType = Convert.ToString(shift["ShiftType"]),
                                ShiftTime = DateTime.Parse(shift["ShiftTime"].ToString()).ToString("HH:mm"),
                             }).ToList();
                        }
                    }
                }

            }
            return lstShift;
        }
        public DataSet CheckRecords(string EmailId, int RouteId, DateTime RequestedDate)
        {
            DataSet lstCabdetail = null;
            string proc_name = ConstantsDLL.usp_CheckRecords;
            SqlParameter[] param = new SqlParameter[3];
            param[0] = new SqlParameter("@UserCode", EmailId);
            param[1] = new SqlParameter("@RouteId", RouteId);
            param[2] = new SqlParameter("@RequestedDate", RequestedDate);
            //string Query = "select * from OnDemandRequests where OndemandRequestId=(select max(OndemandRequestId) from OnDemandRequests where EmailId='" + EmailId + "')";
            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            {

                lstCabdetail = db.ExecDataSetProc(proc_name, param);

            }
            return lstCabdetail;
        }
        public string InsertDC(DC roledetail)
        {
            string outResult = string.Empty;
            ObjSqlHelper = new SqlHelper.SqlHelper();

            string proc_name = ConstantsDLL.USP_INSERTDC;
            SqlParameter[] param = new SqlParameter[4];

            param[0] = new SqlParameter("@DCName", roledetail.DCName);
            param[1] = new SqlParameter("@IsActive", roledetail.IsActive);
            param[2] = new SqlParameter("@CreatedBy", roledetail.CreatedBy);
            param[3] = new SqlParameter("@Result", outResult);
            param[3].Direction = ParameterDirection.Output;
            ObjSqlHelper.ExecNonQueryProc(proc_name, param);
            outResult = Convert.ToString(param[3].Value);

               // ObjSqlHelper.ExecNonQueryProc(proc_name, param);

            return outResult;
        }
        public string UpdateDC(DC roledetail)
        {
            ObjSqlHelper = new SqlHelper.SqlHelper();

            string proc_name = ConstantsDLL.USP_UPDATEDC;
            SqlParameter[] param = new SqlParameter[5];

            param[0] = new SqlParameter("@DCId", roledetail.DCID);
            param[1] = new SqlParameter("@IsActive", roledetail.IsActive);
            param[2] = new SqlParameter("@ModifyBy", roledetail.ModifiedBy);
            param[3] = new SqlParameter("@DCName", roledetail.DCName);
            string Result = "";
            param[4] = new SqlParameter("@Result", SqlDbType.VarChar, 50, Result);
            param[4].Direction = ParameterDirection.Output;

            using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
              //  ObjSqlHelper.ExecNonQueryProc(proc_name, param);

            {
                db.ExecNonQueryProc(proc_name, param);
            }
            Result = Convert.ToString(param[4].Value);
            return Result;

               // return true;
        }