/// <summary>
        /// Update Detail of Worldref user
        /// </summary>
        /// <param name="signModel"></param>
        /// <returns></returns>
        public string Save(SignUpWorldRefModel signModel)
        {
            string ReturnStatus = "Success";

            try
            {
                LoginDetailWorldRef loginDetail = context.LoginDetailWorldRefs.Where(x => x.id == signModel.Id).FirstOrDefault();

                //loginDetail.Name            = signModel.Name;
                //loginDetail.Type            = signModel.Type;
                //loginDetail.Email           = signModel.Email;
                //loginDetail.Industry        = signModel.Industry;
                //loginDetail.Country         = signModel.Country;
                //loginDetail.ProfileName     = signModel.ProfileFileName;
                //loginDetail.ProfilePath     = signModel.ProfilePath;
                //loginDetail.dateModified    = DateTime.Now;

                context.SaveChanges();
            }
            catch (Exception ex)
            {
                ReturnStatus = ex.Message;
            }
            return(ReturnStatus);
        }
        public SignUpWorldRefModel SignInCommonUser(string UserName, string Password)
        {
            try
            {
                SignUpWorldRefModel signUp = null;

                RegisterUser loginDetail = context.RegisterUsers.Where(x => x.UserNo.ToLower() == UserName.ToLower() && x.Password == Password && x.UserRole == _userRole).FirstOrDefault();

                if (loginDetail != null)
                {
                    signUp = new SignUpWorldRefModel()
                    {
                        Id   = loginDetail.Id,
                        Name = loginDetail.UserFirstName
                    };
                }

                return(signUp);
            }
            catch (Exception ex)
            {
                return(null);
            }

            return(null);
        }
        /// <summary>
        /// Register worlref user
        /// </summary>
        /// <param name="signModel"></param>
        /// <returns></returns>
        public string Add(SignUpWorldRefModel signModel)
        {
            string ReturnStatus = "Success";
            string UserRole = "W";
            try
            {
                RegisterUser register = new RegisterUser()
                {

                    UserFirstName = signModel.Name,
                    Company = signModel.Name,
                    Type = signModel.Type,
                    Email = signModel.Email,
                    phone = signModel.ContactNumber,
                    Industries = signModel.Industry,
                    OfficialNumber=signModel.OfficialNumber,
                    CountryName = signModel.Country.ToString(),
                    BusinessInterestCountry = signModel.BusinessInterestCountry.ToString(),
                    ProfileAttach = signModel.ProfilePath,
                    PhotoAttach = signModel.ProfileFileName,
                    UserNo = signModel.UserName,
                    Password = signModel.Password,
                    UserRole = UserRole,
                    UploaderType=signModel.UploaderType,
                    OrganisationName=signModel.OrganisationName,
                    BussinessUnitName=signModel.BusinessUnitName,
                    MyCompany=signModel.MyCompany,
                    RecoveryMail=signModel.RecoveryMail,
                    OtherMail = signModel.OtherMail,
                    ProfileUrl = signModel.ProfileUrl,
                    ProfileLanguageID = Convert.ToInt16(signModel.Language),
                    Date = DateTime.Now
                };

                context.RegisterUsers.Add(register);
                context.SaveChanges();

            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                        eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                            ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }
            return ReturnStatus;
        }
        /// <summary>
        /// Register worlref user
        /// </summary>
        /// <param name="signModel"></param>
        /// <returns></returns>
        public string Add(SignUpWorldRefModel signModel)
        {
            string ReturnStatus = "Success";
            string UserRole     = "W";

            try
            {
                RegisterUser register = new RegisterUser()
                {
                    UserFirstName           = signModel.Name,
                    Company                 = signModel.Name,
                    Type                    = signModel.Type,
                    Email                   = signModel.Email,
                    phone                   = signModel.ContactNumber,
                    Industries              = signModel.Industry,
                    OfficialNumber          = signModel.OfficialNumber,
                    CountryName             = signModel.Country.ToString(),
                    BusinessInterestCountry = signModel.BusinessInterestCountry.ToString(),
                    ProfileAttach           = signModel.ProfilePath,
                    PhotoAttach             = signModel.ProfileFileName,
                    UserNo                  = signModel.UserName,
                    Password                = signModel.Password,
                    UserRole                = UserRole,
                    UploaderType            = signModel.UploaderType,
                    OrganisationName        = signModel.OrganisationName,
                    BussinessUnitName       = signModel.BusinessUnitName,
                    MyCompany               = signModel.MyCompany,
                    RecoveryMail            = signModel.RecoveryMail,
                    OtherMail               = signModel.OtherMail,
                    ProfileUrl              = signModel.ProfileUrl,
                    ProfileLanguageID       = Convert.ToInt16(signModel.Language),
                    Date                    = DateTime.Now
                };

                context.RegisterUsers.Add(register);
                context.SaveChanges();
            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }
            return(ReturnStatus);
        }
        /// <summary>
        /// Login The worldref model
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="Password"></param>
        /// <returns></returns>
        public SignUpWorldRefModel Login(string userName, string Password)
        {
            SignUpWorldRefModel signUp = null;

            RegisterUser loginDetail = context.RegisterUsers.Where(x => x.UserNo == userName && x.Password == Password && (x.UserRole == "W" || x.UserRole == "P" || x.UserRole == "C")).FirstOrDefault();

            if (loginDetail != null)
            {
                signUp = new SignUpWorldRefModel()
                {
                    Id          = loginDetail.Id,
                    Name        = loginDetail.UserFirstName,
                    UserRole    = loginDetail.UserRole,
                    PhotoAttach = loginDetail.PhotoAttach
                };
            }

            return(signUp);
        }
        /// <summary>
        /// Send email when user fill forget the username and password
        /// </summary>
        /// <param name="Email"></param>
        /// <returns></returns>
        public SignUpWorldRefModel ForgetPassword(string Email)
        {
            SignUpWorldRefModel signModel = null;

            try
            {
                RegisterUser loginDetail = context.RegisterUsers.Where(x => x.Email == Email && x.UserRole == "W").FirstOrDefault();

                if (loginDetail != null)
                {
                    signModel          = new SignUpWorldRefModel();
                    signModel.Name     = loginDetail.UserFirstName;
                    signModel.Email    = loginDetail.Email;
                    signModel.UserName = loginDetail.UserNo;
                    signModel.Password = loginDetail.Password;
                }
            }
            catch
            {
            }
            return(signModel);
        }
 //
 // GET: /Uploader/
 public ActionResult UploadExcel()
 {
     SignUpWorldRefModel signUpModel = new SignUpWorldRefModel();
     signUpModel = GetAllSignUpDetails();
     return View(signUpModel);
 }
        private SignUpWorldRefModel GetAllSignUpDetails()
        {
            SignUpWorldRefModel signUpModel = new SignUpWorldRefModel();
            List<SelectListItem> selectListCountry = new List<SelectListItem>();
            List<SelectListItem> selectList = new List<SelectListItem>();//Developer, Investor, Fabricator, Procurement Staff, Others
            //selectList.Add(new SelectListItem() { Text = "I am", Value = "0" });
            selectList.Add(new SelectListItem() { Text = "Manufacturer", Value = "Manufacturer" });
            selectList.Add(new SelectListItem() { Text = "Contractor", Value = "Contractor" });
            selectList.Add(new SelectListItem() { Text = "Consultant", Value = "Consultant" });
            selectList.Add(new SelectListItem() { Text = "Trading Company", Value = "Trading Company" });
            selectList.Add(new SelectListItem() { Text = "Project Owner’s/Procurement Staff", Value = "Project Owner’s/Procurement Staff" });
            selectList.Add(new SelectListItem() { Text = "Developer", Value = "Developer" });
            selectList.Add(new SelectListItem() { Text = "Investor", Value = "Investor" });
            selectList.Add(new SelectListItem() { Text = "Fabricator", Value = "Fabricator" });
            selectList.Add(new SelectListItem() { Text = "Raw Material Supplier", Value = "Raw Material Supplier" });
            selectList.Add(new SelectListItem() { Text = "Others", Value = "Others" });
            signUpModel.TypeList = selectList;

            var content = (from p in context.Countries
                           select new { p.CountryID, p.CountryName }).AsEnumerable();

            selectListCountry.Add(new SelectListItem() { Text = "Select Country", Value = "0" });

            foreach (var item in content)
            {
                selectListCountry.Add(new SelectListItem() { Text = item.CountryName, Value = item.CountryName });

            }
            signUpModel.CountryList = selectListCountry;
            KnowledgeLogic knowIndustry = new KnowledgeLogic();
            signUpModel.IndustryList = knowIndustry.GetIndustry();
            List<SelectListItem> selectList1 = new List<SelectListItem>();
            selectList1.Add(new SelectListItem() { Text = "Type of Recruitment", Value = "0" });
            selectList1.Add(new SelectListItem() { Text = "I recruit for my Organisation only", Value = "I recruit for my Organisation only" });
            selectList1.Add(new SelectListItem() { Text = "I recruit for Other Organisations only", Value = "I recruit for Other Organisations only" });
            selectList1.Add(new SelectListItem() { Text = "Both: I recruit for my and other organisations", Value = "Both: I recruit for my and other organisations" });
            signUpModel.RecruitersTypeList = selectList1;
            return signUpModel;
        }
        /// <summary>
        /// Send email when user fill forget the username and password
        /// </summary>
        /// <param name="Email"></param>
        /// <returns></returns>
        public SignUpWorldRefModel ForgetPassword(string Email)
        {
            SignUpWorldRefModel signModel = null;

            try
            {
                RegisterUser loginDetail = context.RegisterUsers.Where(x => x.Email == Email && x.UserRole == "W").FirstOrDefault();

                if (loginDetail != null)
                {
                    signModel = new SignUpWorldRefModel();
                    signModel.Name = loginDetail.UserFirstName;
                    signModel.Email = loginDetail.Email;
                    signModel.UserName = loginDetail.UserNo;
                    signModel.Password = loginDetail.Password;
                }
            }
            catch
            {
            }
            return signModel;
        }
        public SignUpWorldRefModel SignInCommonUser(string UserName, string Password)
        {
            try
            {

                SignUpWorldRefModel signUp = null;

                RegisterUser loginDetail = context.RegisterUsers.Where(x => x.UserNo.ToLower() == UserName.ToLower() && x.Password == Password && x.UserRole == _userRole).FirstOrDefault();

                if (loginDetail != null)
                {
                    signUp = new SignUpWorldRefModel()
                    {
                        Id = loginDetail.Id,
                        Name = loginDetail.UserFirstName
                    };
                }

                return signUp;
            }
            catch (Exception ex)
            {
                return null;
            }

            return null;
        }
        /// <summary>
        /// Update Detail of Worldref user
        /// </summary>
        /// <param name="signModel"></param>
        /// <returns></returns>
        public string Save(SignUpWorldRefModel signModel)
        {
            string ReturnStatus = "Success";
            try
            {
                LoginDetailWorldRef loginDetail = context.LoginDetailWorldRefs.Where(x => x.id == signModel.Id).FirstOrDefault();

                //loginDetail.Name            = signModel.Name;
                //loginDetail.Type            = signModel.Type;
                //loginDetail.Email           = signModel.Email;
                //loginDetail.Industry        = signModel.Industry;
                //loginDetail.Country         = signModel.Country;
                //loginDetail.ProfileName     = signModel.ProfileFileName;
                //loginDetail.ProfilePath     = signModel.ProfilePath;
                //loginDetail.dateModified    = DateTime.Now;

                context.SaveChanges();

            }
            catch (Exception ex)
            {
                ReturnStatus = ex.Message;
            }
            return ReturnStatus;
        }
        /// <summary>
        /// Login The worldref model
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="Password"></param>
        /// <returns></returns>
        public SignUpWorldRefModel Login(string userName, string Password)
        {
            SignUpWorldRefModel signUp = null;

            RegisterUser loginDetail = context.RegisterUsers.Where(x => x.UserNo == userName && x.Password == Password && (x.UserRole == "W" || x.UserRole == "P" || x.UserRole == "C")).FirstOrDefault();

            if (loginDetail != null)
            {
                signUp = new SignUpWorldRefModel()
                {
                    Id = loginDetail.Id,
                    Name = loginDetail.UserFirstName,
                    UserRole = loginDetail.UserRole,
                    PhotoAttach = loginDetail.PhotoAttach

                };
            }

            return signUp;
        }