public List <mUserProfileHead> SelectEmployeeDepartmentwise(mDesignation objmDesignation, string[] conn)
        {
            BISPL_CRMDBEntities     ce  = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));
            List <mUserProfileHead> lst = new List <mUserProfileHead>();

            if (objmDesignation.Name == "0")
            {
                var result = from dbtable in ce.mUserProfileHeads
                             where ((dbtable.DesignationID == objmDesignation.ID) && (dbtable.DepartmentID == objmDesignation.DepartmentID))
                             select new { dbtable.FirstName, dbtable.ID, dbtable.MiddelName, dbtable.LastName, dbtable.EmployeeID };
                lst = result.AsEnumerable().Select(o => new mUserProfileHead {
                    FirstName = o.FirstName, ID = o.ID, MiddelName = o.MiddelName, LastName = o.LastName, EmployeeID = o.EmployeeID
                }).ToList();
            }
            else
            {
                var result = from dbtable in ce.mUserProfileHeads
                             where ((dbtable.DesignationID == objmDesignation.ID) && (dbtable.DepartmentID == objmDesignation.DepartmentID) && (dbtable.ReportingTo == objmDesignation.Name))
                             select new { dbtable.FirstName, dbtable.ID, dbtable.MiddelName, dbtable.LastName, dbtable.EmployeeID };
                lst = result.AsEnumerable().Select(o => new mUserProfileHead {
                    FirstName = o.FirstName, ID = o.ID, MiddelName = o.MiddelName, LastName = o.LastName, EmployeeID = o.EmployeeID
                }).ToList();
            }



            return(lst);
        }
        public int InsertmDesignation(mDesignation designation, string[] conn)
        {
            BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));

            ce.mDesignations.AddObject(designation);
            ce.SaveChanges();
            return(1);
        }
        public int updatemDesignation(mDesignation updateDesignation, string[] conn)
        {
            BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));

            ce.mDesignations.Attach(updateDesignation);
            ce.ObjectStateManager.ChangeObjectState(updateDesignation, EntityState.Modified);
            ce.SaveChanges();
            return(1);
        }
        /// <summary>
        /// GetDesignationListByID is providing List of DesignationList By ID
        /// </summary>
        /// <returns></returns>
        ///
        public mDesignation GetDesignationListByID(int designationId, string[] conn)
        {
            BISPL_CRMDBEntities ce            = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));
            mDesignation        DesignationID = new mDesignation();

            DesignationID = (from p in ce.mDesignations
                             where p.ID == designationId
                             select p).FirstOrDefault();
            ce.Detach(DesignationID);
            return(DesignationID);
        }
        /// <summary>
        /// GetDesignationListByID is providing List of DesignationList By ID
        /// </summary>
        /// <returns></returns>
        ///
        public long GetDesignationIDByName(string designation, string[] conn)
        {
            BISPL_CRMDBEntities ce            = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));
            mDesignation        DesignationID = new mDesignation();

            DesignationID = (from p in ce.mDesignations
                             where p.Name == designation
                             select p).FirstOrDefault();
            ce.Detach(DesignationID);
            return(DesignationID.ID);
        }