Пример #1
0
 public ActionResult SaveSangamBanner(HttpPostedFileBase file)
 {
     Mugurtham.Core.Login.LoggedInUser objLoggedIn = (Mugurtham.Core.Login.LoggedInUser)Session["LoggedInUser"];
     if (file != null && file.ContentLength > 0)
         try
         {
             string path = Path.Combine(Server.MapPath("~/Images/Mugurtham/Sangam/Banner"),
                                        objLoggedIn.sangamID + Path.GetExtension(Path.GetFileName(file.FileName)));
             file.SaveAs(path);
             Mugurtham.Core.Sangam.SangamCore objSangamCore = new Core.Sangam.SangamCore();
             using (objSangamCore as IDisposable)
             {
                 Mugurtham.Core.Sangam.SangamCoreEntity objSangamCoreEntity = new Core.Sangam.SangamCoreEntity();
                 using (objSangamCoreEntity as IDisposable)
                 {
                     objSangamCoreEntity = objSangamCore.GetByID(objLoggedIn.sangamID);
                     objSangamCoreEntity.BannerPath = "/Images/Mugurtham/Sangam/Banner/" + objLoggedIn.sangamID + Path.GetExtension(Path.GetFileName(file.FileName));
                     objSangamCore.Edit(ref objSangamCoreEntity);
                 }
                 objSangamCoreEntity = null;
             }
             objSangamCore = null;
         }
         catch (Exception ex)
         {
             ViewBag.Message = "ERROR:" + ex.Message.ToString();
         }
     else
     {
         ViewBag.Message = "You have not specified a file.";
     }
     return Redirect("/Mugurtham#/SangamAdminSettings");
 }
Пример #2
0
 private int initializeUser()
 {
     try
     {
         Core.User.UserCore objUserCore = new Core.User.UserCore(ConnectionStringAppKey);
         using (objUserCore as IDisposable)
         {
             objUserCoreEntity = objUserCore.GetByLoginID(_strLoggedInID);
         }
         objUserCore      = null;
         _objLoggedInUser = this;
         Core.BasicInfo.BasicInfoCore objBasicInfoCore = new BasicInfo.BasicInfoCore(ref _objLoggedInUser);
         using (objBasicInfoCore as IDisposable)
             objBasicInfoCoreEntity = objBasicInfoCore.GetByProfileID(_strLoggedInID);
         objBasicInfoCore = null;
         if (objUserCoreEntity.SangamID != null)
         {
             Core.Sangam.SangamCore objSangamCore = new Sangam.SangamCore(this.ConnectionStringAppKey);
             using (objSangamCore as IDisposable)
             {
                 objSangamCoreEntity = objSangamCore.GetByID(objUserCoreEntity.SangamID);
             }
             objSangamCore = null;
         }
         else
         {
             return(-1);
         }
     }
     catch (Exception objEx)
     {
         Helpers.LogExceptionInFlatFile(objEx);
     }
     return(0);
 }
 public ActionResult SaveSangamBanner(HttpPostedFileBase file)
 {
     Mugurtham.Core.Login.LoggedInUser objLoggedIn = (Mugurtham.Core.Login.LoggedInUser)Session["LoggedInUser"];
     if (file != null && file.ContentLength > 0)
     {
         try
         {
             string path = Path.Combine(Server.MapPath("~/Images/Mugurtham/Sangam/Banner"),
                                        objLoggedIn.sangamID + Path.GetExtension(Path.GetFileName(file.FileName)));
             file.SaveAs(path);
             Mugurtham.Core.Sangam.SangamCore objSangamCore = new Core.Sangam.SangamCore(objLoggedIn.ConnectionStringAppKey);
             using (objSangamCore as IDisposable)
             {
                 Mugurtham.Core.Sangam.SangamCoreEntity objSangamCoreEntity = new Core.Sangam.SangamCoreEntity();
                 using (objSangamCoreEntity as IDisposable)
                 {
                     objSangamCoreEntity            = objSangamCore.GetByID(objLoggedIn.sangamID);
                     objSangamCoreEntity.BannerPath = "/Images/Mugurtham/Sangam/Banner/" + objLoggedIn.sangamID + Path.GetExtension(Path.GetFileName(file.FileName));
                     objSangamCore.Edit(ref objSangamCoreEntity);
                 }
                 objSangamCoreEntity = null;
             }
             objSangamCore = null;
         }
         catch (Exception ex)
         {
             ViewBag.Message = "ERROR:" + ex.Message.ToString();
         }
     }
     else
     {
         ViewBag.Message = "You have not specified a file.";
     }
     return(Redirect("/Matrimony#/SangamAdminSettings"));
 }