本文整理匯總了C#中BizContext類的典型用法代碼示例。如果您正苦於以下問題:C# BizContext類的具體用法?C# BizContext怎麽用?C# BizContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BizContext類屬於命名空間,在下文中一共展示了BizContext類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DisplayFirmInformation
public JsonResult DisplayFirmInformation()
{
var Value = "";
try
{
BizContext = (BizContext)Session["GBAdminBizContext"];
int id = Convert.ToInt32(BizContext.FirmID);
Session["GBAdminBizContext"] = BizContext;
FirmInformationRepository objupdate = new FirmInformationRepository();
var i = objupdate.GetFirmInfo(id);
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: FirmInformation
public ActionResult FirmInformation()
{
Session["PageName"] = "Finance";
try
{
BizContext = (BizContext)Session["GBAdminBizContext"];
int id = Convert.ToInt32(BizContext.FirmID);
Session["GBAdminBizContext"] = BizContext;
// long id = 100003;
FirmInformationRepository objupdate = new FirmInformationRepository();
var Firm = objupdate.GetFirmInfo(id).FirstOrDefault(f => f.ID == id);
SecurityUtils.SetGlobalViewbags(this, ActiveMenu, BizContext.UserContext.IsAdmin(), BizContext.UserContext.IsHotelAdmin(), BizContext.HotelID);
return View(Firm);
}
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 });
}
}
示例3: DailyPropertyStatistics
public JsonResult DailyPropertyStatistics(string HitCountPeriodID, string StartDate, string EndDate)
{
//DateTime dt = DateTime.ParseExact(StartDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
//DateTime dt1 = DateTime.ParseExact(EndDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
//string Datefromm = Convert.ToString(dt);
//string Datetoo = Convert.ToString(dt1);
//string Datefromm = dt.ToString("yyyy-MM-dd");
//string Datetoo = dt1.ToString("yyyy-MM-dd");
string startdate = dateconvert(StartDate);
string Enddate = dateconvert(EndDate);
var PartID = "1";
//string HotelID = Convert.ToString(Session["GBAdminBizContext"]);
BizContext = (BizContext)Session["GBAdminBizContext"];
int HotelID = BizContext.HotelID;
Session["GBAdminBizContext"] = BizContext;
DataTable dts = new DataTable();
PropertyStatisticsRepository objupdate = new PropertyStatisticsRepository();
List<PropertyStatisticsExt> list = new List<PropertyStatisticsExt>();
try{
dts = objupdate.DisplaydatewisePropertyStatistics(PartID, HitCountPeriodID, startdate, Enddate, HotelID);
if (dts != null)
{
if (dts.Rows.Count > 0)
{
foreach (DataRow dr in dts.Rows)
{
PropertyStatisticsExt FirmObj = new PropertyStatisticsExt();
FirmObj.PartID = dr["PartID"].ToString();
FirmObj.RecordID = dr["RecordID"].ToString();
FirmObj.ReservationCount = dr["ReservationCount"].ToString();
FirmObj.Date = dr["Date"].ToString();
FirmObj.HitCount = dr["HitCount"].ToString();
FirmObj.Month = dr["Month"].ToString();
FirmObj.MonthName = dr["MonthName"].ToString();
FirmObj.Day = dr["Day"].ToString();
FirmObj.DayName = dr["DayName"].ToString();
list.Add(FirmObj);
}
}
}
}
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(list, JsonRequestBehavior.AllowGet);
}
示例4: GetAccomodationByID
public JsonResult GetAccomodationByID()
{
BizContext = (BizContext)Session["GBAdminBizContext"];
int id = BizContext.HotelAccommodationTypeID;
Session["GBAdminBizContext"] = BizContext;
DropDownListsRepository model = new DropDownListsRepository();
return Json(model.GetTypeHotelAccommodationByID(id).OrderBy(o => o.Name).Select(c => new { ID = c.ID, Name = c.Name }).OrderBy(o => o.Name), JsonRequestBehavior.AllowGet);
}
示例5: AssignBizContext
public void AssignBizContext()
{
if (Session["GBAdminBizContext"] != null)
{
BizContext = (BizContext)Session["GBAdminBizContext"];
}
Session["GBAdminBizContext"] = BizContext;
}
示例6: GetReviews1
public JsonResult GetReviews1()
{
BizContext = (BizContext)Session["GBAdminBizContext"];
int HotelID = BizContext.HotelID; ;
int HotelID1 = Convert.ToInt32(Session["HotelID"]);
PropertyReviewRepository modelRepo = new PropertyReviewRepository();
var PropertyReviews = modelRepo.GetReviews1(HotelID);
return Json(PropertyReviews, JsonRequestBehavior.AllowGet);
}
示例7: Initialize
protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
// string CurrentCulture_TwoLetter = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
if (requestContext.HttpContext.Session["GBAdminBizContext"] != null)
{
BizContext = (BizContext)requestContext.HttpContext.Session["GBAdminBizContext"];
}
//string Nameax = ReturnSyatemCulture();
string SelectedLanguage = "en-Gb";
if (BizContext.SystemCultureCode != null)
{
SelectedLanguage = BizContext.SystemCultureCode;
}
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo(SelectedLanguage);
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo(SelectedLanguage);
base.Initialize(requestContext);
if (SelectedLanguage != "en-Gb")
{
try
{
CultureInfo TempCulture = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
TempCulture.DateTimeFormat.Calendar = System.Globalization.CultureInfo.GetCultureInfo("en-Gb").DateTimeFormat.Calendar;
TempCulture.NumberFormat.NumberDecimalSeparator = ".";
System.Threading.Thread.CurrentThread.CurrentCulture = TempCulture;
CultureInfo TempCulture1 = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentUICulture.Clone();
TempCulture1.DateTimeFormat.Calendar = System.Globalization.CultureInfo.GetCultureInfo("en-Gb").DateTimeFormat.Calendar;
TempCulture1.NumberFormat.NumberDecimalSeparator = ".";
System.Threading.Thread.CurrentThread.CurrentUICulture = TempCulture1;
}
catch
{
}
//base.Initialize(requestContext);
}
}
示例8: SaveRoomAvailabilityAndRate
public JsonResult SaveRoomAvailabilityAndRate(string StartDate, string Enddate, string RoomType, string PricePolicy, string AccommodationType, string WeekDay,
string DateIDArray,string WeekDayIDArray,string SinglePriceNameArray,string DoublePriceNameArray,string RoomPriceNameArray,
string AvailableRoomCountNameArray, string MinimumStayNameArray, string CloseToArrivalArray, string CloseToDepartureArray, string ClosedArray)
{
int i = 1;
int RoomID = Convert.ToInt32(RoomType);
BizContext = (BizContext)Session["GBAdminBizContext"];
int Hotelid = BizContext.HotelID;
long UserSessionID= Convert.ToInt64(BizContext.UserSessionID);
Session["GBAdminBizContext"] = BizContext;
RoomAvailabilityAndRateRepository ObjRep = new RoomAvailabilityAndRateRepository();
try {
var HotelRooms = ObjRep.GetHotelRooms(Hotelid).FirstOrDefault(f => f.RoomID == RoomID);
int MaximamPeopleCount = GetMaximamPeopleCount(HotelRooms);
ObjRep.CreateHotelRoomAvailability(RoomType, StartDate, Enddate, HotelRooms);
ObjRep.CreateHotelRoomRate(RoomType, StartDate, Enddate, AccommodationType, PricePolicy);
ObjRep.SaveRoomAvailabilityAndRate(Convert.ToInt32(AccommodationType), Convert.ToInt32(PricePolicy), Convert.ToInt32(RoomType), MaximamPeopleCount,
DateIDArray, SinglePriceNameArray, DoublePriceNameArray, RoomPriceNameArray, AvailableRoomCountNameArray, MinimumStayNameArray,
CloseToArrivalArray, CloseToDepartureArray, ClosedArray,UserSessionID, this);
}
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(i, JsonRequestBehavior.AllowGet);
}
示例9: updatepassword
//
// POST: /Account/LogOn
//public string Decrypt128New(string Pass)
//{
// // string EncryptionKey = "MAKV2SPBNI99212";
// byte[] cipherBytes = Convert.FromBase64String(Pass);
// using (Aes encryptor = Aes.Create())
// {
// encryptor.Key = Encoding.UTF8.GetBytes("2428598755421637");
// encryptor.IV = Encoding.UTF8.GetBytes("5369523205842148");
// using (MemoryStream ms = new MemoryStream())
// {
// using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateDecryptor(), CryptoStreamMode.Write))
// {
// cs.Write(cipherBytes, 0, cipherBytes.Length);
// cs.Close();
// }
// Pass = Encoding.Unicode.GetString(ms.ToArray());
// }
// }
// return Pass;
//}
//public string Encrypt(string clearText)
//{
// byte[] clearBytes = Encoding.Unicode.GetBytes(clearText);
// using (Aes encryptor = Aes.Create())
// {
// encryptor.Key = Encoding.UTF8.GetBytes("2428598755421637");
// encryptor.IV = Encoding.UTF8.GetBytes("5369523205842148");
// using (MemoryStream ms = new MemoryStream())
// {
// using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateEncryptor(), CryptoStreamMode.Write))
// {
// cs.Write(clearBytes, 0, clearBytes.Length);
// cs.Close();
// }
// clearText = Convert.ToBase64String(ms.ToArray());
// }
// }
// return clearText;
//}
//public ActionResult LogOn(LogOnModel model, string returnUrl, FormCollection formcollection)
//{
// // Decrypt128New("M5z8bP0bD/auyD/1wfthvCCkrr6q+quBRRRcyTGBh5c=");
// Home obj = new Home();
// ViewBag.AllCulture = obj.GetCulturecode();
// RemoveUserfromSession();
// string Msg = "";
// //Set Application Header with Application Type + Version and Build Date
// // Session["ApplicationHeader"] = SecurityUtils.ApplicationHeader;
// if (returnUrl != null)
// if (returnUrl.Contains("%2f"))
// returnUrl = Server.UrlDecode(returnUrl);
// bool locked = false;
// //string kjhgkhjk = model.Language;
// bool val = true;
// if (ModelState.IsValid)
// {
// if (ValidateUser(model.UserName, model.Password, model.Language, ref locked, ref Msg))
// {
// if (!locked)
// {
// FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
// return RedirectToAction("Index", "Home");
// }
// else
// {
// ModelState.AddModelError("", "Your cannot log on the System, because your status is Locked. Please contact your Department Administrator.");
// }
// }
// else
// {
// ModelState.AddModelError("", Msg);
// }
// }
// // If we got this far, something failed, redisplay form
// return View(model);
//}
public ActionResult updatepassword(string Language, string UserName, string Password)
{
string status = "false";
bool locked = false;
string Msg = "";
string ReminduserID = Convert.ToString(Session["RemindUserid"]);
using (BaseRepository baseRepo = new BaseRepository())
{
bool RememberMe = true;
BizContext BizContext = new BizContext();
BizUser.UnlockUser(baseRepo.BizDB, "", UserName);
BizUser.UpdateUserPassword(baseRepo.BizDB, ReminduserID, (new BizCrypto.AES128()).Encrypt(Password));
if (ValidateUser(UserName, Password, Language, ref locked, ref Msg))
{
if (!locked)
{
FormsAuthentication.SetAuthCookie(UserName, RememberMe);
//return RedirectToAction("Index", "Home");
}
//.........這裏部分代碼省略.........
示例10: LogOn
public ActionResult LogOn(LogOnModel model, string returnUrl, FormCollection formcollection)
{
// Decrypt128New("M5z8bP0bD/auyD/1wfthvCCkrr6q+quBRRRcyTGBh5c=");
Home obj = new Home();
ViewBag.AllCulture = obj.GetCulturecode();
RemoveUserfromSession();
string Msg = "";
//Set Application Header with Application Type + Version and Build Date
// Session["ApplicationHeader"] = SecurityUtils.ApplicationHeader;
if (returnUrl != null)
if (returnUrl.Contains("%2f"))
returnUrl = Server.UrlDecode(returnUrl);
bool locked = false;
//string kjhgkhjk = model.Language;
bool val = true;
if (Request.QueryString["RemindCode"] != null)
{
string userID = "";
string userName = "";
string RemindCode = BizUtil.DecryptQueryStringParam(Request.QueryString["RemindCode"], ref val, true);
bool checkDate = false;
string[] tokens = RemindCode.Split(';');
if (tokens.Length >= 3)
{
userID = tokens[0];
userName = tokens[1];
}
if (RemindCode != "")
{
using (BaseRepository baseRepo = new BaseRepository())
{
if (model.Password == model.ConfirmPassword)
{
BizContext BizContext = new BizContext();
if (userName != "" )
{
BizUser.UnlockUser(baseRepo.BizDB, "", userName);
}
BizUser.UpdateUserPassword(baseRepo.BizDB, userID, (new BizCrypto.AES128()).Encrypt(model.Password));
if (ValidateUser(model.UserName, model.Password, model.Language, ref locked, ref Msg))
{
if (!locked)
{
FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
return RedirectToAction("Index", "Home");
}
else
{
ModelState.AddModelError("", "Your cannot log on the System, because your status is Locked. Please contact your Department Administrator.");
}
}
}
else
{
ModelState.AddModelError("", Msg);
}
}
}
}
if (ModelState.IsValid)
{
if (ValidateUser(model.UserName, model.Password, model.Language, ref locked, ref Msg))
{
if (!locked)
{
FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
return RedirectToAction("Index", "Home");
}
else
{
ModelState.AddModelError("", "Your cannot log on the System, because your status is Locked. Please contact your Department Administrator.");
}
}
else
{
ModelState.AddModelError("", Msg);
}
}
// If we got this far, something failed, redisplay form
return View(model);
}
示例11: GetCultureByIpaddress
public void GetCultureByIpaddress(string UserIP)
{
//UserIP = "5.11.79.255";
using (BaseRepository baseRepo = new BaseRepository())
{
BizContext BizContext = new BizContext();
try
{
try
{
string url = "http://freegeoip.lwan.ws/json/" + UserIP.ToString();
WebClient client = new WebClient();
string jsonstring = client.DownloadString(url);
dynamic dynObj = JsonConvert.DeserializeObject(jsonstring);
// System.Web.HttpContext.Current.Session["LocId"] = dynObj.country_code;
string countryCode = dynObj.country_code;
Session["CountryCodeFromIP"] = countryCode;
DataTable Cultures = new DataTable();
baseRepo.SQLCon.Open();
SqlCommand cmd = new SqlCommand("B_GetCultureAvailableCount_BizTbl_Culture_SP", baseRepo.SQLCon);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Culture", countryCode);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(Cultures);
baseRepo.SQLCon.Close();
if (Cultures != null)
{
if (Cultures.Rows.Count > 0)
{
foreach (DataRow dr in Cultures.Rows)
{
if (Session["GBAdminBizContext"] != null)
{
BizContext = (BizContext)Session["GBAdminBizContext"];
}
BizContext.SystemCultureCode = dr["SystemCode"].ToString();
BizContext.CultureCode = dr["CultureCode"].ToString();
Session["CultureCode"] = dr["CultureCode"].ToString();
Session["GBAdminBizContext"] = BizContext;
}
}
else
{
if (Session["GBAdminBizContext"] != null)
{
BizContext = (BizContext)Session["GBAdminBizContext"];
}
BizContext.SystemCultureCode = "en-Gb";
BizContext.CultureCode = "en";
Session["GBAdminBizContext"] = BizContext;
Session["CultureCode"] = "en";
}
}
else
{
if (Session["GBAdminBizContext"] != null)
{
BizContext = (BizContext)Session["GBAdminBizContext"];
}
BizContext.SystemCultureCode = "en-Gb";
BizContext.CultureCode = "en";
Session["GBAdminBizContext"] = BizContext;
Session["CultureCode"] = "en";
}
}
catch
{
if (Session["GBAdminBizContext"] != null)
{
BizContext = (BizContext)Session["GBAdminBizContext"];
}
BizContext.SystemCultureCode = "en-Gb";
BizContext.CultureCode = "en";
Session["GBAdminBizContext"] = BizContext;
Session["CultureCode"] = "en";
}
}
catch
{
string url = "http://freegeoip.net/json/" + UserIP.ToString();
WebClient client = new WebClient();
string jsonstring = client.DownloadString(url);
dynamic dynObj = JsonConvert.DeserializeObject(jsonstring);
// System.Web.HttpContext.Current.Session["LocId"] = dynObj.country_code;
string countryCode = dynObj.country_code;
Session["CountryCodeFromIP"] = countryCode;
DataTable Cultures = new DataTable();
baseRepo.SQLCon.Open();
SqlCommand cmd = new SqlCommand("B_GetCultureAvailableCount_BizTbl_Culture_SP", baseRepo.SQLCon);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Culture", countryCode);
//.........這裏部分代碼省略.........
示例12: ValidateUser
//*********The Following Method can be used if Authentication take place from custom users Table***********//
public Boolean ValidateUser(string Username, string password, string UserLanguage, ref bool locked, ref string Msg)
{
Boolean status = false;
using (BaseRepository baseRepo = new BaseRepository())
{
// BizContext bc = new BizContext();
Business.BizTbl_User user = BizUser.GetUser(baseRepo.BizDB, string.Empty, Username, password);
BizContext BizContext = new BizContext();
// BizContext bc = new BizContext();
UserContext uc = new UserContext();
// BizApplication.GetBizContext(Username, password, CultureCode,ref bc);
if (user != null)
{
status = true;
BizApplication.SetUserContext(baseRepo.BizDB, ref uc, Convert.ToInt64(user.ID), CultureCode);
BizContext.UserContext = uc;
//if (uc.IsHotelAdmin()) {
// System.Linq.IQueryable<Business.TB_Hotel> userHotels = BizHotel.GetHotels(baseRepo.BizDB, null, uc.FirmID, null, user.ID.ToString());
// foreach (Business.TB_Hotel hotel in userHotels)
// {
// BizContext.Hotels.Add(hotel.ID, hotel.Name);
// }
// Business.TB_Hotel userHotel = userHotels.First();
// BizContext.HotelID = userHotel.ID;
// BizContext.HotelCountryID = userHotel.CountryID;
// BizContext.HotelRegionID = Convert.ToInt64(userHotel.RegionID);
// BizContext.HotelCityID = Convert.ToInt64(userHotel.CityID);
// BizContext.HotelCurrencyID = Convert.ToString(userHotel.CurrencyID);
// // BizContext.HotelCurrencyName = dc.GetColumn(GetCurrencies(dc, CultureCode, bc.HotelCurrencyID)(0), "Name");
// BizContext.HotelAccommodationTypeID = userHotel.HotelAccommodationTypeID;
// BizContext.HotelAvailabilityRateUpdate = Convert.ToBoolean(userHotel.AvailabilityRateUpdate);
// BizContext.HotelRoutingName = userHotel.RoutingName;
// BizContext.FirmID = Convert.ToString(userHotel.FirmID);
// Session["SelectedHotelID"] = userHotel.ID;
// Session["SelectedHotelName"] = userHotel.Name;
//}
if (BizContext.UserContext.IsHotelAdmin())
{
// System.Linq.IQueryable<Business.TB_Hotel> userHotels = BizHotel.GetHotels(baseRepo.BizDB, null, uc.FirmID, null, user.ID.ToString());
int i = 0;
baseRepo.SQLCon.Open();
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand("B_Ex_GetUserHotelByUserID_TB_Hotel_SP", baseRepo.SQLCon);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@UserID", user.ID.ToString());
cmd.Parameters.AddWithValue("@FirmID", uc.FirmID);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(dt);
baseRepo.SQLCon.Close();
foreach (DataRow hotel in dt.Rows)
{
BizContext.Hotels.Add(Convert.ToInt32(hotel["ID"]), (hotel["Name"].ToString()));
if (i == 0)
{
BizContext.HotelID = Convert.ToInt32(hotel["ID"]);
BizContext.FirmID = hotel["FirmID"].ToString();
BizContext.HotelAccommodationTypeID = Convert.ToInt32(hotel["HotelAccommodationTypeID"]);
BizContext.HotelRoutingName = hotel["Name"].ToString();
Session["SelectedHotelID"] = Convert.ToInt32(hotel["ID"]);
Session["SelectedHotelName"] = hotel["Name"].ToString();
}
i++;
}
}
int userCountryID = 0;
//if (bc.UserContext.IPAddress == string.Empty)
//{
if (Session["GBAdminBizContext"] != null)
{
BizContext = (BizContext)Session["GBAdminBizContext"];
}
Session["GBAdminBizContext"] = BizContext;
if (UserLanguage != "")
{
try
{
string[] words = UserLanguage.Split(',');
BizContext.SystemCultureCode = words[1];
BizContext.CultureCode = words[0];
Session["CultureCode"] = words[0];
Session["GBAdminBizContext"] = BizContext;
}
catch
{
BizContext.SystemCultureCode = "en-GB";
BizContext.CultureCode = "en";
Session["GBAdminBizContext"] = BizContext;
Session["CultureCode"] = "en";
}
}
else
//.........這裏部分代碼省略.........
示例13: YearlyPropertyStatistics
public JsonResult YearlyPropertyStatistics()
{
// string HotelID = Convert.ToString(Session["GBAdminBizContext"]);
BizContext = (BizContext)Session["GBAdminBizContext"];
int HotelID = BizContext.HotelID;
Session["GBAdminBizContext"] = BizContext;
var PartID = "1";
PropertyStatisticsRepository objupdate = new PropertyStatisticsRepository();
var yearlyPropertyStatistics = objupdate.YearlyPropertyStatistics(PartID, HotelID);
ViewBag.yearlyPropertyStatistics = yearlyPropertyStatistics;
return Json(yearlyPropertyStatistics, JsonRequestBehavior.AllowGet);
}
示例14: MonthlyPropertyStatistics
public JsonResult MonthlyPropertyStatistics(string Year)
{
// string HotelID = Convert.ToString(Session["GBAdminBizContext"]);
BizContext = (BizContext)Session["GBAdminBizContext"];
int HotelID = BizContext.HotelID;
Session["GBAdminBizContext"] = BizContext;
var PartID = "1";
if (Year == "")
{
Year = "2015";
}
DataTable dt = new DataTable();
PropertyStatisticsRepository objupdate = new PropertyStatisticsRepository();
List<PropertyStatisticsExt> list = new List<PropertyStatisticsExt>();
try
{
dt = objupdate.MonthlyPropertyStatistics(PartID, HotelID, Year);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
PropertyStatisticsExt FirmObj = new PropertyStatisticsExt();
FirmObj.PartID = dr["PartID"].ToString();
FirmObj.RecordID = dr["RecordID"].ToString();
FirmObj.ReservationCount = dr["ReservationCount"].ToString();
FirmObj.HitCount = dr["HitCount"].ToString();
FirmObj.MonthName = dr["MonthName"].ToString();
list.Add(FirmObj);
}
}
}
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(list, JsonRequestBehavior.AllowGet);
}
示例15: Initialize
protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
// string CurrentCulture_TwoLetter = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
if (requestContext.HttpContext.Session["GBAdminBizContext"] != null)
{
BizContext = (BizContext)requestContext.HttpContext.Session["GBAdminBizContext"];
}
//string Nameax = ReturnSyatemCulture();
string SelectedLanguage = "en-Gb";
if (BizContext.SystemCultureCode != null)
{
SelectedLanguage = BizContext.SystemCultureCode;
}
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo(SelectedLanguage);
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo(SelectedLanguage);
base.Initialize(requestContext);
}