コード例 #1
0
 public JsonResult DisplayContactUs()
 {
     var value = "";
     try
     {
         ContactUsRepository objupdate = new ContactUsRepository();
         var i = objupdate.GetContactUs();
         value = Convert.ToString(i);
     }
     catch(Exception ex)
     {
         string hostName1 = Dns.GetHostName();
         string GetUserIPAddress = Dns.GetHostByName(hostName1).AddressList[0].ToString();
         string PageName = Convert.ToString(Session["PageName"]);
         //string GetUserIPAddress = GetUserIPAddress1();
         using (BaseRepository baseRepo = new BaseRepository())
         {
             //BizContext BizContext1 = new BizContext();
             BizApplication.AddError(baseRepo.BizDB, PageName, ex.Message, ex.StackTrace, DateTime.Now, GetUserIPAddress);
         }
         Session["PageName"] = "";
         string error = ErrorHandling.HandleException(ex);
         return this.Json(new DataSourceResult { Errors = error });
     }
     return Json(value, JsonRequestBehavior.AllowGet);
 }
コード例 #2
0
        public ActionResult ContactUs()
        {
            Session["PageName"] = "ContactUs";
               // string id = "";
            try
            {
                ContactUsRepository objupdate = new ContactUsRepository();
                List<ContactUsExt> Value = objupdate.GetContactUs();
                ViewBag.Value = Value;
                AssignBizContext();
                SecurityUtils.SetGlobalViewbags(this, ActiveMenu, BizContext.UserContext.IsAdmin(), BizContext.UserContext.IsHotelAdmin(), BizContext.HotelID);
            }
            catch(Exception ex)
            {
                string hostName1 = Dns.GetHostName();
                string GetUserIPAddress = Dns.GetHostByName(hostName1).AddressList[0].ToString();
                string PageName = Convert.ToString(Session["PageName"]);
                //string GetUserIPAddress = GetUserIPAddress1();
                using (BaseRepository baseRepo = new BaseRepository())
                {
                    //BizContext BizContext1 = new BizContext();
                    BizApplication.AddError(baseRepo.BizDB, PageName, ex.Message, ex.StackTrace, DateTime.Now, GetUserIPAddress);
                }
                Session["PageName"] = "";
                string error = ErrorHandling.HandleException(ex);
                return this.Json(new DataSourceResult { Errors = error });
            }

            return View();
        }