示例#1
0
        public static void SetItem(MemberModels item)
        {
            SQLData.Database db    = new SQLData.Database(WebInfo.Conn);
            string           sql   = "Select 1 From [Member] Where ID = " + item.Id;
            bool             isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(WebInfo.Conn))
                {
                    sql  = $"IF not EXISTS (SELECT 1 FROM Member WHERE LoginID = @LoginID)";
                    sql += $@" INSERT INTO [Member]([ID],[LoginID],[Name],[Email],[MStatus],[Password],[GroupID] ,isSysOnly, [AddDate], [Phone], [Mobile], [Img], 
                            ArriveDate, PersonalNote, Salary, SalaryPaymentType, LaborAllowance, LaborPension, JobAdditionPay, ExecutionFee, LaborInsurance, HealthInsurance, Welfare, LeaveFee) 
                            VALUES({ WorkLib.GetItem.NewSN()},@LoginID,@Name, @Email, @MStatus,@Password ,@GroupID, 1, getdate(), @Phone, @Mobile, @Img,
                            @ArriveDate, @PersonalNote, @Salary, @SalaryPaymentType, @LaborAllowance, @LaborPension, @JobAdditionPay, @ExecutionFee, @LaborInsurance, @HealthInsurance, @Welfare, @LeaveFee) ";
                    conn.Execute(sql, item);
                }
            }
            else
            {
                using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(WebInfo.Conn))
                {
                    sql = @"UPDATE Member SET [Name]=@Name, [Email]=@Email,[MStatus]=@MStatus,[GroupID]=@GroupID, [Phone]=@Phone, [Mobile]=@Mobile, [Img]=@Img, 
                        [ArriveDate]=@ArriveDate, [PersonalNote]=@PersonalNote, [Salary]=@Salary, [SalaryPaymentType]=@SalaryPaymentType, [LaborAllowance]=@LaborAllowance, [LaborPension]=@LaborPension, [JobAdditionPay]=@JobAdditionPay, [ExecutionFee]=@ExecutionFee, [LaborInsurance]=@LaborInsurance, [HealthInsurance]=@HealthInsurance, [Welfare]=@Welfare, [LeaveFee]=@LeaveFee";
                    if (!string.IsNullOrEmpty(item.Password))
                    {
                        sql += ",[Password]=@Password";
                    }
                    sql += " WHERE ID=@ID ";
                    conn.Execute(sql, item);
                }
            }
        }
示例#2
0
        public ActionResult SiderBar()
        {
            List <Menu> backendMenu = new List <Menu>();

            if ((Session[WebInfo.SysMemSkey] == null ? null : (Request.Cookies["sessionId"] != null ? MemberDAO.Current(Request.Cookies["sessionId"].Value) : null)) == null)
            {
                ViewBag.BackendMenu = backendMenu;
                return(HttpNotFound());

                //return View();
            }
            if (MemberDAO.SysCurrent != null)
            {
                if (PageCache.SiteID == 0)
                {
                    backendMenu         = BackendMenuDAO.GetManagerRoots().ToList();
                    ViewBag.BackendMenu = backendMenu;
                    return(View("Backend/SiderBar"));
                }
                else
                {
                    long               SiteID = PageCache.SiteID;
                    MemberModels       mem    = MemberDAO.SysCurrent;
                    List <MenusModels> mm     = MenusDAO.GetData(SiteID);
                    backendMenu         = BackendMenuDAO.GetRoots(SiteID).ToList();
                    ViewBag.SiteID      = SiteID;
                    ViewBag.MenuList    = mm;
                    ViewBag.BackendMenu = backendMenu;

                    return(View("Backend/SiderBar", new { SiteId = SiteID }));
                }
            }
            ViewBag.BackendMenu = backendMenu;
            return(View());
        }
示例#3
0
        public JsonResult UploadPersonPhotoFile(HttpPostedFileBase File)
        {
            if (File != null && File.ContentLength > 0)
            {
                string Path = string.Format("{0}/{1}", GetItem.UpdPath(), "Manager");
                if (!System.IO.Directory.Exists(Path))
                {
                    System.IO.Directory.CreateDirectory(Path);
                }
                string       saveName = WorkV3.Golbal.UpdFileInfo.SaveFiles(File, Path);
                MemberModels mem      = MemberDAO.SysCurrent;
                string       sql      = "UPDATE Member  SET Img=@Img WHERE LoginID=@ID";

                SQLData.Database            db       = new SQLData.Database(WebInfo.Conn);
                SQLData.ParameterCollection paraList = new SQLData.ParameterCollection();
                paraList.Add("@ID", mem.LoginID);
                paraList.Add("@Img", saveName);
                int exeCount = db.ExecuteNonQuery(sql, paraList);
                if (exeCount > 0)
                {
                    return(Json("success"));
                }
            }
            return(Json("fail"));
        }
示例#4
0
        public async Task <ActionResult> Index(MemberModels model)
        {
            if (ModelState.IsValid)
            {
                /*
                 * var user = new ApplicationUser() { UserName = model.UserName };
                 * var result = await UserManager.CreateAsync(user, model.Password);
                 * if (result.Succeeded)
                 * {
                 *  await SignInAsync(user, isPersistent: false);
                 *  return RedirectToAction("Index", "Home");
                 * }
                 * else
                 * {
                 *  AddErrors(result);
                 * }*/
                var m = new Member()
                {
                    Name = model.Name
                };
                _memberService.InsertMember(m);
                return(RedirectToAction("Index", "Home"));
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
示例#5
0
        public static List <MemberShipRegEmailManagersModels> GetMemberShipRegManagers(long SiteID)
        {
            List <MemberShipRegEmailManagersModels> modelList = new List <MemberShipRegEmailManagersModels>();
            string sql = $"SELECT * FROM MemberShipRegEmailManagers WHERE  SiteID={SiteID} ";

            DateTime now = DateTime.Now;

            SQLData.Database db    = new SQLData.Database(WebInfo.Conn);
            DataTable        datas = db.GetDataTable(sql);

            if (datas != null && datas.Rows.Count > 0)
            {
                for (int i = 0; i < datas.Rows.Count; i++)
                {
                    MemberShipRegEmailManagersModels m = new MemberShipRegEmailManagersModels();
                    m.ID        = datas.Rows[i]["ID"].ToString();
                    m.SiteID    = SiteID;
                    m.IsManager = (bool)datas.Rows[i]["IsManager"];
                    m.ManagerID = datas.Rows[i]["ManagerID"].ToString();
                    m.Email     = datas.Rows[i]["Email"].ToString();
                    m.Sort      = (int)datas.Rows[i]["Sort"];
                    if (m.IsManager)
                    {
                        MemberModels mem = Models.DataAccess.ManagerDAO.GetItem(long.Parse(m.ManagerID));
                        if (mem != null)
                        {
                            m.ManagerName = mem.Name;
                            m.Email       = mem.Email;
                        }
                    }
                    modelList.Add(m);
                }
            }
            return(modelList);
        }
示例#6
0
        public JsonResult RefreshLoginInfo()
        {
            ViewBag.UploadUrl = uploadUrl;
            MemberModels mem = MemberDAO.SysCurrent;

            string sql = "select * from Member where LoginID=@ID";

            SQLData.Database     db     = new SQLData.Database(WebInfo.Conn);
            SQLData.SelectObject selMem = db.GetSelectObject(sql, new SQLData.ParameterCollection("@ID", mem.LoginID));
            if (selMem != null)
            {
                MemberModels member = new MemberModels
                {
                    Id        = long.Parse(selMem["Id"].ToString()),
                    isSysOnly = bool.Parse(selMem["isSysOnly"].ToString()),
                    LoginID   = selMem["LoginID"].ToString(),
                    Name      = selMem["Name"].ToString(),
                    Img       = selMem["Img"].ToString(),
                    GroupId   = long.Parse(selMem["GroupId"].ToString()),
                    Email     = selMem["Email"].ToString()
                };
                string sessionID = Request.Cookies["sessionId"].Value;
                Session[sessionID] = member;
                return(Json("success"));
            }
            else
            {
                return(Json("fail"));
            }
        }
        public MemberModels Login([FromBody] string value)
        {
            try
            {
                ICredentialsHelper credentialsHelper = new CredentialsHelper();
                IMemberRepository  memberRepository  = new MemberRepository();

                LoginModels postModel = new JavaScriptSerializer().Deserialize <LoginModels>(value);

                MemberModels member = new MemberModels();
                if (CacheHelper.MemberCache.Contains(postModel.Username))
                {
                    member             = (MemberModels)CacheHelper.MemberCache.Where(x => x.Key == postModel.Username).FirstOrDefault().Value;
                    member.LoginMethod = LoginMethodEnums.Cache.GetHashCode();
                }
                else
                {
                    member             = memberRepository.GetByUsername(postModel.Username);
                    member.LoginMethod = LoginMethodEnums.Database.GetHashCode();
                }

                return(credentialsHelper.AuthenticateMember(postModel, member));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(StaticKeyHelper.API, StaticKeyHelper.Login, ex.Message);
                return(null);
            }
        }
示例#8
0
        public void ChangePassword(long memberId, string password)
        {
            MemberModels member = MemberDAO.GetItem(memberId);

            member.Password = password;

            ManagerDAO.SetItem(member);
        }
示例#9
0
        public bool Register(RegisterModels register)
        {
            string data = new JavaScriptSerializer().Serialize(register);

            HttpResponseMessage response = APIHelper.Post(GlobalKeyHelper.MemberRegisterUrl, data);
            MemberModels        result   = response.Content.ReadAsAsync <MemberModels>().Result;

            return(result != null);
        }
示例#10
0
        public MemberModels Authenticate(LoginModels member)
        {
            string data = new JavaScriptSerializer().Serialize(member);

            HttpResponseMessage response = APIHelper.Post(GlobalKeyHelper.MemberLoginUrl, data);
            MemberModels        result   = response.Content.ReadAsAsync <MemberModels>().Result;

            return(result);
        }
示例#11
0
        public ActionResult SaveMember(MemberModels member)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("AddMember", new { id = member.TeamId }));
            }
            context.Members.Add(member);
            context.SaveChanges();

            return(RedirectToAction("Show", new { id = member.TeamId }));
        }
示例#12
0
        public int checkPasswordSimilarity(long memberId, string password)
        {
            IEnumerable <string> siteSns = WorkV3.Models.DataAccess.SitesDAO.GetDatas().Select(x => x.SN);
            string       strSites        = String.Join("|", WorkV3.Models.DataAccess.SitesDAO.GetDatas().Select(x => x.SN).ToArray());
            MemberModels member          = MemberDAO.GetItem(memberId);
            string       pattern         = $@"^(?i:({strSites}))(?:20[0-9]{{2}})$";
            Regex        regex           = new Regex(pattern);

            bool retValue = regex.Match(password).Success;

            return(retValue ? 1 : 0);
        }
示例#13
0
        public void Add(string modelFile, ModelTransformInfo modelTrf)
        {
            if (MemberModels.ContainsKey(modelFile))
            {
                return;
            }
            FederationModelItem mItem = new FederationModelItem();

            mItem.ModelFileName  = modelFile;
            mItem.ModelTransform = modelTrf;
            MemberModels.Add(modelFile, mItem);
        }
示例#14
0
        public ActionResult EditMemberInfo(MemberModels model)
        {
            model.IsChangedPassword = true;
            ManagerDAO.SetPersonalItem(model);
            ViewBag.Exit             = true;
            ViewBag.RefreshLoginInfo = true;
            ViewBag.UploadUrl        = uploadUrl;
            var group = GroupDAO.GetItems();

            ViewBag.group = group;

            return(View(model));
        }
示例#15
0
 public ActionResult Login()
 {
     if (MemberDAO.SysCurrent != null)
     {
         MemberModels mem = MemberDAO.SysCurrent;
         //Response.Redirect(Url.Action("index", new { SiteSN = "huashan1914" }));
         Response.Redirect(Url.Action("Sites"));
         return(View("Sites"));
     }
     else
     {
         return(View());
     }
 }
示例#16
0
        //public static MemberModels.LoginStatus SysLoginCheck(string LoginID, string PassWord)
        //{
        //    //DENISE 待補

        //    string sql = "isSysOnly != false";


        //    MemberModels member = new MemberModels
        //    {
        //        Id = 510,
        //        isSysOnly = true,
        //        MemName = "Denise",
        //        Email = "*****@*****.**"
        //    };

        //    HttpContext.Current.Session[WebInfo.SysMemSkey] = member;
        //    return MemberModels.LoginStatus.Success;

        //}

        #region Login Check
        // 20180516 neil 新增選擇攔位 IsChangedPassword, IsSupremeAuthority
        public static string LoginCheck(string LoginID, string PassWord)
        {
            string sql = "select * from Member where LoginID='{0}'";

            SQLData.Database db = new SQLData.Database(WebInfo.Conn);

            DataTable dt = db.GetDataTable(string.Format(sql, LoginID, PassWord));

            if (dt.Rows.Count > 0 && dt.Rows[0] != null)
            {
                string Pwd    = (string)dt.Rows[0]["Password"];
                string Status = dt.Rows[0]["MStatus"].ToString();
                if (Status == "0")
                {
                    if (Pwd == PassWord)
                    {
                        MemberModels member = new MemberModels
                        {
                            Id                 = (long)dt.Rows[0]["id"],
                            isSysOnly          = (bool)dt.Rows[0]["isSysOnly"],
                            LoginID            = dt.Rows[0]["LoginID"].ToString(),
                            Name               = dt.Rows[0]["Name"].ToString(),
                            Img                = dt.Rows[0]["Img"].ToString(),
                            GroupId            = (long)dt.Rows[0]["GroupId"],
                            Email              = dt.Rows[0]["Email"].ToString(),
                            IsChangedPassword  = dt.Rows[0]["IsChangedPassword"] == null ? false : (bool)dt.Rows[0]["IsChangedPassword"],
                            IsSupremeAuthority = dt.Rows[0]["IsSupremeAuthority"] == null ? false : (bool)dt.Rows[0]["IsSupremeAuthority"],
                        };

                        String key = System.Guid.NewGuid().ToString();
                        HttpContext.Current.Session[key] = member;
                        HttpContext.Current.Session[WebInfo.SysMemSkey] = member;
                        return(key);
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    string isSuspension = "isSuspension";//20190917 Joe 停權判斷
                    return(isSuspension);
                }
            }
            else
            {
                return(null);
            }
        }
示例#17
0
        public bool Insert(MemberModels member)
        {
            DataManager dM = new DataManager();

            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("Id", Guid.NewGuid()));
            parameters.Add(new SqlParameter("Fullname", member.Fullname));
            parameters.Add(new SqlParameter("Username", member.Username));
            parameters.Add(new SqlParameter("Password", member.Password));
            parameters.Add(new SqlParameter("CreatedAt", DateTime.Now));
            parameters.Add(new SqlParameter("UpdatedAt", DateTime.Now));

            return(dM.ExecuteNonQuery(Sql.SqlResource.InsertMember, parameters) > 0);
        }
示例#18
0
        // GET: Member/Details/5
        public ActionResult Details(int id)
        {
            Member       p  = ms.GetById(id);
            MemberModels pm = new MemberModels

            {
                firstName = p.firstName,
                lastName  = p.lastName,
                phone_num = p.phone_num,
                email     = p.email,
                skills    = p.skills,
            };


            return(View(pm));
        }
示例#19
0
        public void Remove(string modelFile)
        {
            string model = modelFile;

            if (!MemberModels.ContainsKey(model))
            {
                if (UseRelativePath)
                {
                    model = XBimFederation.relativePath(Path.GetDirectoryName(fedFilePath), model);
                    if (!MemberModels.ContainsKey(model))
                    {
                        return;
                    }
                }
            }
            MemberModels.Remove(model);
        }
        public void CredentialsHelper_MatchingUsernameWrongPassword_Fails()
        {
            ICredentialsHelper credentialsHelper = new CredentialsHelper();

            LoginModels login = new LoginModels()
            {
                Username = "******",
                Password = "******"
            };

            MemberModels member = new MemberModels()
            {
                Username = "******",
                Password = "******"
            };

            Assert.IsNull(credentialsHelper.AuthenticateMember(login, member));
        }
示例#21
0
        public MemberModels RegisterNewMember(RegisterModels register)
        {
            IMemberRepository memberRepository = new MemberRepository();

            MemberModels member = new MemberModels()
            {
                Fullname = register.Fullname,
                Username = register.Username,
                Password = register.Password
            };

            if (memberRepository.Insert(member))
            {
                return(memberRepository.GetByUsername(member.Username));
            }

            return(null);
        }
        public void CredentialsHelper_WrongUsernameMatchingPassword_Fails()
        {
            ICredentialsHelper credentialsHelper = new CredentialsHelper();

            LoginModels login = new LoginModels()
            {
                Username = "******",
                Password = "******"
            };

            MemberModels member = new MemberModels()
            {
                Username = "******",
                Password = "******"
            };

            Assert.IsNull(credentialsHelper.AuthenticateMember(login, member));
        }
示例#23
0
        // GET: BackEnd
        public ActionResult Index(string SiteSN)
        {
            ViewBag.Member    = Session[WebInfo.SysMemSkey] == null ?null:(Request.Cookies["sessionId"] != null? MemberDAO.Current(Request.Cookies["sessionId"].Value): null);
            ViewBag.UploadUrl = uploadUrl;
            if (ViewBag.Member != null)
            {
                WorkV3.Models.SitesModels SiteItem = WorkV3.Models.DataAccess.SitesDAO.GetSiteInfo(SiteSN);
                if (SiteItem != null)
                {
                    MemberModels mem = MemberDAO.SysCurrent;

                    PageCache.SiteID   = SiteItem.Id;
                    PageCache.SiteName = SiteItem.Title;
                    ViewBag.SiteSN     = SiteSN;
                    ViewBag.SiteID     = PageCache.SiteID;
                    ViewBag.SiteName   = PageCache.SiteName;
                    List <MenusModels> mm = MenusDAO.GetData(PageCache.SiteID);

                    long                  siteId      = PageCache.SiteID;
                    List <Menu>           backendMenu = BackendMenuDAO.GetRoots(siteId).ToList();
                    List <CardsViewModel> cards       = CardsDAO.GetBySiteID(PageCache.SiteID);
                    MemberModels          curUser     = ViewBag.Member;
                    GroupModels           group       = ViewBag.Member == null ? new GroupModels() : GroupDAO.GetItem(curUser.GroupId, siteId);

                    ViewBag.MenuList    = mm;
                    ViewBag.Cards       = cards;
                    ViewBag.CardTypes   = CardsTypeDAO.GetData();
                    ViewBag.BackendMenu = backendMenu;
                    ViewBag.Permissions = group.GetPermissions(siteId);
                }
                else
                {
                    Response.Redirect(Url.Action("Sites"));
                }
                return(View());
            }
            else
            {
                Response.Redirect(Url.Action("Login"));
                return(View());
            }
        }
        public MemberModels AuthenticateMember(LoginModels login, MemberModels member)
        {
            if (login.Username == member.Username &&
                encryptionHelper.DecryptString(login.Password, EncryptionTypeEnums.Member) == encryptionHelper.DecryptString(member.Password, EncryptionTypeEnums.Member))
            {
                if (!CacheHelper.MemberCache.Contains(login.Username))
                {
                    CacheHelper.MemberCache.Add(member.Username, member, new CacheItemPolicy()
                    {
                        AbsoluteExpiration = DateTime.UtcNow.AddMinutes(30)
                    });
                }

                return(member);
            }
            else
            {
                return(null);
            }
        }
示例#25
0
        public MemberModels GetByUsername(string username)
        {
            MemberModels result = null;
            DataManager  dM     = new DataManager();

            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("Username", username));

            using (SqlDataReader sqlData = dM.ExecuteReader(Sql.SqlResource.GetMemberByUsername, parameters))
            {
                if (sqlData.HasRows)
                {
                    sqlData.Read();
                    Member member = Mapping.ReflectType <Member>(sqlData);
                    result = ModelConversion.GetMemberModels(member);
                }
            }

            return(result);
        }
示例#26
0
        public ActionResult Edit(MemberModels model, IEnumerable <MemberToCompanyModel> companyItems, long siteId = 0)
        {
            ////密碼
            //string hidpassword = Request["hidpassword"];
            //string hashKey = uRandom.GetRandomCode(10);

            //if (!string.IsNullOrEmpty(hidpassword))
            //{
            //    model.HashKey = hashKey;
            //    model.HashPwd = HashWord.EncryptSHA256(hidpassword, hashKey);
            //}

            ViewBag.Exit = true;

            HttpPostedFileBase imgFile = model.imgFile;

            if (imgFile != null && imgFile.ContentLength > 0)
            {
                string Path = string.Format("{0}/{1}", GetItem.UpdPath(), "Manager");
                if (!System.IO.Directory.Exists(Path))
                {
                    System.IO.Directory.CreateDirectory(Path);
                }
                string saveName = WorkV3.Golbal.UpdFileInfo.SaveFiles(imgFile, Path);

                model.Img = saveName;
            }
            ManagerDAO.SetItem(model);
            //ManagerDAO.SetMemberToCompany(model.Id, companyItems); 20190912 Joe 問題單,目前尚無MemberToCompany這張表,故先註解

            var group = GroupDAO.GetItems();

            ViewBag.group     = group;
            ViewBag.UploadUrl = Golbal.UpdFileInfo.GetVPathBySiteID(siteId).TrimEnd('/') + "/";
            ViewBag.SiteID    = siteId;

            return(View(model));
        }
示例#27
0
        public ActionResult Edit(long?ID, long siteId = 0)
        {
            MemberModels m = new MemberModels();

            if (ID.HasValue)
            {
                m             = ManagerDAO.GetItem((long)ID);
                ViewBag.IsNew = false;
            }
            else
            {
                ViewBag.IsNew = true;
            }

            var group = GroupDAO.GetItems();

            ViewBag.group = group;

            ViewBag.ID        = ID ?? 0;
            ViewBag.UploadUrl = GetItem.ViewUpdUrl().TrimEnd('/') + "/";
            ViewBag.SiteID    = siteId;
            return(View(m));
        }
示例#28
0
        public ActionResult EditMemberInfo(long?ID)
        {
            ViewBag.UploadUrl = uploadUrl;
            MemberModels m = new MemberModels();

            if (ID.HasValue)
            {
                m             = ManagerDAO.GetItem((long)ID);
                ViewBag.IsNew = false;
            }
            else
            {
                ViewBag.IsNew = true;
            }

            var group = GroupDAO.GetItems();

            ViewBag.group = group;

            ViewBag.ID = ID ?? 0;

            return(View(m));
        }
示例#29
0
        public ActionResult Login(LoginModels model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ILoginServices loginService = new LoginServices();

                    IEncryptionHelper encyptionHelper = new EncryptionHelper();
                    model.Password = encyptionHelper.EncryptString(model.Password, EncryptionTypeEnums.Member);
                    MemberModels memberModel = loginService.Authenticate(model);

                    if (memberModel == null)
                    {
                        ModelState.AddModelError("", ErrorMessages.UsernamePasswordInvalid);
                        return(View(model));
                    }

                    string userData = JsonConvert.SerializeObject(memberModel);
                    FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, model.Username, DateTime.Now, DateTime.Now.AddMinutes(30), false, userData);
                    string     encryptedTicket           = FormsAuthentication.Encrypt(authTicket);
                    HttpCookie authCookie = new HttpCookie("SitecoreCookie", encryptedTicket);
                    Response.Cookies.Add(authCookie);
                }
                else
                {
                    return(View(model));
                }
                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(StaticKeyHelper.WebApplication, StaticKeyHelper.Login, ex.Message);
                ModelState.AddModelError("", ErrorMessages.TechnicalIssues);
                return(RedirectToAction("Login", "Account"));
            }
        }
        public ActionResult ContactForm(MemberModels ImageFiles, HttpPostedFileBase ImageFile)
        {
            UserDBEntities user = new UserDBEntities();


            //string fileName = Path.GetFileName(member.ImagePath);


            string FileName = Path.GetFileName(ImageFile.FileName);
            // string path = Path.Combine(Server.MapPath("~/Models/Extended"), FileName);

            /// string file = MimeMapping.GetMimeMapping(FileName);

            string path = "~/MyGallery/" + FileName;

            ImageFile.SaveAs(Server.MapPath(path));

            var a = ImageFiles.Name;
            var b = ImageFiles.PhoneNumber;
            var c = path;
            var d = FileName;


            Upload u = new Upload();

            u.MemberName  = a;
            u.PhoneNumber = b;
            u.ImagePath   = c;
            u.ImageName   = d;
            user.Uploads.Add(u);

            user.SaveChanges();
            Session["MemberId"] = u.MemberId;
            ViewBag.FullName    = Session["MemberId"];

            return(RedirectToAction("ContactForm"));
        }