コード例 #1
0
        public ActionResult UpdateAdminSettingData()
        {
            if (Session["User"] != null)
            {
                Domain.Socioboard.Domain.User _User = (Domain.Socioboard.Domain.User)Session["User"];
                if (_User.UserType != "SuperAdmin")
                {
                    return(RedirectToAction("Index", "Index"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "Index"));
            }
            Domain.Socioboard.Domain.User ObjUser = (Domain.Socioboard.Domain.User)Session["User"];
            string FirstName           = Request.Form["Adminfname"];
            string LastName            = Request.Form["Adminlname"];
            string TimeZone            = Request.Form["AdminTimeZone"];
            var    fi                  = Request.Files["adminprofileimage"];
            string file                = string.Empty;
            string UpdateChnfesMessage = string.Empty;

            if (Request.Files.Count > 0)
            {
                if (fi != null)
                {
                    var path = Server.MapPath("~/Themes/" + System.Configuration.ConfigurationManager.AppSettings["domain"] + "/Contents/img/admin");

                    // var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"]+"Contents/img/upload";
                    file = path + "/" + fi.FileName;
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    fi.SaveAs(file);
                    path = path + "/" + fi.FileName;
                    ObjUser.ProfileUrl = path.ToString();
                }
            }



            //string ObjAdminUpdate = (new JavaScriptSerializer().Serialize(ObjUser));
            Api.User.User ApiobjUser = new Api.User.User();
            string        ret        = ApiobjUser.UpdateAdminUser(ObjUser.Id.ToString(), FirstName, LastName, TimeZone, ObjUser.ProfileUrl);

            if (ret == "1")
            {
                ObjUser.UserName    = FirstName + " " + LastName;
                ObjUser.TimeZone    = TimeZone;
                Session["User"]     = ObjUser;
                UpdateChnfesMessage = "Setting Updated Successfully";
            }
            return(Content(UpdateChnfesMessage));
        }
コード例 #2
0
        public ActionResult UpdateAdminSettingData()
        {
            if (Session["User"] != null)
            {
                Domain.Socioboard.Domain.User _User = (Domain.Socioboard.Domain.User)Session["User"];
                if (_User.UserType != "SuperAdmin")
                {
                    return RedirectToAction("Index", "Index");
                }
            }
            else
            {
                return RedirectToAction("Index", "Index");
            }
            Domain.Socioboard.Domain.User ObjUser = (Domain.Socioboard.Domain.User)Session["User"];
            string FirstName = Request.Form["Adminfname"];
            string LastName = Request.Form["Adminlname"];
            string TimeZone = Request.Form["AdminTimeZone"];
            var fi = Request.Files["adminprofileimage"];
            string file = string.Empty;
            string UpdateChnfesMessage=string.Empty;
            if (Request.Files.Count > 0)
            {
                if (fi != null)
                {
                    var path = Server.MapPath("~/Themes/" + System.Configuration.ConfigurationManager.AppSettings["domain"] + "/Contents/img/admin");

                    // var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"]+"Contents/img/upload";
                    file = path + "/" + fi.FileName;
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    fi.SaveAs(file);
                    path = path + "/" + fi.FileName;
                    ObjUser.ProfileUrl = path.ToString();
                }
            }



            //string ObjAdminUpdate = (new JavaScriptSerializer().Serialize(ObjUser));
            Api.User.User ApiobjUser = new Api.User.User();
            string ret = ApiobjUser.UpdateAdminUser(ObjUser.Id.ToString(), FirstName, LastName, TimeZone, ObjUser.ProfileUrl);
            if (ret == "1")
            {
                ObjUser.UserName = FirstName + " " + LastName;
                ObjUser.TimeZone = TimeZone;
                Session["User"] = ObjUser;
                UpdateChnfesMessage = "Setting Updated Successfully";
            }
            return Content(UpdateChnfesMessage);
        }