private void CurMaster_OnDelete(object sender, EventArgs e) { bool result = false; Database db = LogicContext.GetDatabase(); db.BeginTrans(); try { result = this.OnDelete(); bool flag = result; if (flag) { db.CommitTrans(); } else { db.RollbackTrans(); } } catch { db.RollbackTrans(); } bool flag2 = result; if (flag2) { base.CloseDialog(); } }
public ActionResult GetMyQueryDetailByMyQueryIdForAdmin(int id) { var spqueryLogic = LogicContext.Create <SupportQueryLogic>(); var UserQueries = spqueryLogic.GetQueryDetailById(id); return(PartialView("~/Areas/Admin/Views/AppUserQueries/_UserQueriesPartial.cshtml", UserQueries)); }
private void CurMaster_OnDelete(object sender, EventArgs e) { bool result = false; Database db = LogicContext.GetDatabase(); db.BeginTrans(); try { result = this.OnDelete(); bool flag = result; if (flag) { db.CommitTrans(); } else { db.RollbackTrans(); } } catch { db.RollbackTrans(); } bool flag2 = !result; if (!flag2) { this.OnQuery(); this.GridDataBind(); this.CurGrid.SelectedIndex = -1; this.PlaceUpdateContent(); } }
public ActionResult GetDibzCharges(string gameOwned, string gameDesired, string retailPrice, string creditValue, string cashValue) { var chargesLogic = LogicContext.Create <DibzChargesLogic>(); try { var chargesData = chargesLogic.GetAllDibzChargesData(); decimal savingCNV = 0; decimal savingCAV = 0; var dibzCharges = chargesData.Result[0].Charges; var result = ""; var error = ""; if (dibzCharges != "") { //if(creditValue != "" && cashValue == "") if (creditValue != "") { savingCNV = (Convert.ToDecimal(retailPrice) - Convert.ToDecimal(creditValue) - Convert.ToDecimal(dibzCharges)); if (savingCNV > 0) { result = "Good news! By using DIBZ you could save £" + String.Format("{0:0.00}", savingCNV) + " instead of using a credit note for your game to purchase " + gameDesired + ". <br /><br />"; } else { result = "Unfortunately, it is cheaper to use a credit note value for your game to purchase " + gameDesired + ". Thank you for your custom. <br /><br />"; } } // else if (cashValue != "" && creditValue == "") if (cashValue != "") { savingCAV = (Convert.ToDecimal(retailPrice) - Convert.ToDecimal(cashValue) - Convert.ToDecimal(dibzCharges)); if (savingCAV > 0) { result += "Good news! By using DIBZ you could save £" + String.Format("{0:0.00}", savingCAV) + " instead of trading in your game for cash to purchase " + gameDesired + "."; } else { result += "Unfortunately, it is cheaper to use a cash for your game to purchase " + gameDesired + ". Thank you for your custom."; } } //else //{ // error = "Please enter credit note value or cash value"; // return Json(new { IsSuccess = false, fail = error, Result = result }, JsonRequestBehavior.AllowGet); //} return(Json(new { IsSuccess = true, Result = result }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, fail = "Some Thing Wrong dibz charges not found!" }, JsonRequestBehavior.AllowGet)); } } catch (Exception lex) { return(Json(new { IsSuccess = false, fail = lex.Message }, JsonRequestBehavior.AllowGet)); } }
public static void Init() { Database database = LogicContext.GetDatabase(); HSQL hsql = new HSQL(database); hsql.Add("SELECT SYSTEM_ID FROM SYSTEM WHERE SYSTEM_ID = :SYSTEM_ID"); hsql.ParamByName("SYSTEM_ID").Value = "0000000001"; bool flag = DbHelper.ExistingRecord(hsql); if (!flag) { hsql.Clear(); hsql.Add("INSERT INTO SYSTEM(SYSTEM_ID,SYSTEM_NAME,SYSTEM_PSWLENGTH,SYSTEM_PSWDAYS,SYSTEM_PSWWARNDAYS,SYSTEM_PSWNEW,SYSTEM_PSWHISTORYCOUNT,SYSTEM_LIMITEDDATE "); hsql.Add(",CREATERID,CREATER,CREATEDTIME,MODIFIERID,MODIFIER,MODIFIEDTIME)"); hsql.Add("VALUES"); hsql.Add("(:SYSTEM_ID,:SYSTEM_NAME,:SYSTEM_PSWLENGTH,:SYSTEM_PSWDAYS,:SYSTEM_PSWWARNDAYS,:SYSTEM_PSWNEW,:SYSTEM_PSWHISTORYCOUNT,SYSTEM_LIMITEDDATE "); hsql.Add(",:CREATERID,:CREATER,getdate(),:MODIFIERID,:MODIFIER,getdate())"); hsql.ParamByName("SYSTEM_ID").Value = "0000000001"; hsql.ParamByName("SYSTEM_NAME").Value = "提米信息管理系统"; hsql.ParamByName("SYSTEM_PSWLENGTH").Value = "5"; hsql.ParamByName("SYSTEM_PSWDAYS").Value = "0"; hsql.ParamByName("SYSTEM_PSWWARNDAYS").Value = "0"; hsql.ParamByName("SYSTEM_PSWNEW").Value = "Y"; hsql.ParamByName("SYSTEM_PSWHISTORYCOUNT").Value = "0"; hsql.ParamByName("CREATERID").Value = "ADMIN"; hsql.ParamByName("CREATER").Value = "管理员"; hsql.ParamByName("MODIFIERID").Value = "ADMIN"; hsql.ParamByName("MODIFIER").Value = "管理员"; hsql.ParamByName("SYSTEM_LIMITEDDATE").Value = DateTime.Today.AddYears(1); database.ExecSQL(hsql); } }
//public ActionResult Login(string email, string password, string rememberMe) public ActionResult Login(string email, string password, bool rememberMe) { try { var authLogic = LogicContext.Create <AuthLogic>(); DIBZ.Common.Model.ApplicationUser ApplicationUser = new DIBZ.Common.Model.ApplicationUser(); ApplicationUser.Email = email; ApplicationUser.Password = password; //AuthLogic.GetApplicationUserByEmail(email); var loginSession = authLogic.CreateLoginSession(email, password, false); Response.Cookies["AuthCookie"].Value = loginSession.Token; //if (rememberMe == "on") if (rememberMe) { Response.Cookies["AuthCookie"].Expires = DateTime.Now.AddYears(1); } return(Json(new { IsSuccess = true, AppUserName = loginSession.ApplicationUser.NickName, AppUserId = loginSession.ApplicationUserId }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { LogHelper.LogError("Login: ", ex); return(Json(new { IsSuccess = false, message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> Index(int formatId = 0) { var formatLogic = LogicContext.Create <FormatLogic>(); ViewBag.Formats = await formatLogic.GetAllFormats(); var bannerLogic = LogicContext.Create <BannerLogic>(); ViewBag.BannerImage = await bannerLogic.GetAllBannerImage(); //string userType = System.Web.Configuration.WebConfigurationManager.AppSettings["User"]; //if (userType == "Admin") //{ // return this.Redirect("/Admin/Login"); //} ViewData["Error"] = TempData["Error"]; LogHelper.LogInfo("Fetching dashboard data"); var gameCatalogLogic = LogicContext.Create <GameCatalogLogic>(); //get all GamesCatalog var gameCatalogs = await gameCatalogLogic.GetAllFeaturedGames(); if (TempData["searchOfferData"] != null) { ViewBag.Offers = TempData["searchOfferData"]; TempData["searchOfferData"] = null; } else { var offerLogic = LogicContext.Create <OfferLogic>(); ViewBag.Offers = await offerLogic.GetAllOfferForDashboard(formatId); } return(View(gameCatalogs)); }
public async Task <ActionResult> SearchGames(int currentPage = 1, int formatId = 0, string gameName = "", int categoryId = 0) { SearchOffer SearchGames = new SearchOffer(); SearchGames.GameName = gameName; SearchGames.FormatId = formatId; SearchGames.CategoryId = categoryId; var gameLogic = LogicContext.Create <GameCatalogLogic>(); var searchGamesData = await gameLogic.SearchGameCatalog(CurrentLoginSession.ApplicationUserId.GetValueOrDefault(), SearchGames, currentPage); var searchGamesTotalCount = await gameLogic.SearchGameCatalog(CurrentLoginSession.ApplicationUserId.GetValueOrDefault(), SearchGames, currentPage, true); TempData["searchCount"] = searchGamesTotalCount.Count; TempData["searchGamesData"] = searchGamesData; TempData["currentPage"] = currentPage; TempData["imgpath"] = SearchGames.imgpath; TempData["gameName"] = SearchGames.GameName; TempData["formatId"] = SearchGames.FormatId; TempData["categoryId"] = SearchGames.CategoryId; string view = Request.UrlReferrer.Segments[2]; if (view == "MyGames") { return(RedirectToAction("MyGames", "Offer")); } else { return(RedirectToAction("CreateOffer", "Offer")); } }
public ReplaySystem(Contexts contexts) : base(contexts.time) { _LogicContext = contexts.logic; _timeContext = contexts.time; _inputContext = contexts.input; _inputSources = _inputContext.GetGroup(InputMatcher.ControllerInput); }
public async Task <ActionResult> UpdateOfferStatusToPaymentNeeded(int id) { var offerLogic = LogicContext.Create <OfferLogic>(); await offerLogic.UpdateOfferStatusToPaymentNeeded(id); return(RedirectToAction("PossibleSwaps", "Offer")); }
public async Task <ActionResult> ReadQR(int id) { var offerLogic = LogicContext.Create <OfferLogic>(); var offerDetail = await offerLogic.GetOfferDetailById(id); return(View(offerDetail)); }
public async Task <ActionResult> AddTransaction(string offerId, string amount, string counterOfferId) { var transactionLogic = LogicContext.Create <TransactionLogic>(); var offerLogic = LogicContext.Create <OfferLogic>(); try { var offer = await offerLogic.GetOfferById(ConversionHelper.SafeConvertToInt32(offerId)); var x = await transactionLogic.AddTransaction(ConversionHelper.SafeConvertToInt32(offerId), Convert.ToDecimal(amount), CurrentLoginSession.ApplicationUser.Id, offer.Swaps.FirstOrDefault().Id); var isNeedToRedirect = false; if (offer.OfferStatus == OfferStatus.PaymentNeeded && offer.Transactions.Count() == 2) { await new CounterOfferController().AcceptOfferAfterTransactionDone(ConversionHelper.SafeConvertToInt32(counterOfferId)); isNeedToRedirect = true; } if (x > 0) { return(Json(new { IsSuccess = true, IsNeedToRedirect = isNeedToRedirect }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, fail = "Some Thing Wrong!" }, JsonRequestBehavior.AllowGet)); } } catch (Exception lex) { return(Json(new { IsSuccess = false, fail = lex.Message }, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> OfferDetail(int id) { var swapLogic = LogicContext.Create <SwapLogic>(); //DIBZ.Common.Model.ApplicationUser appUser = new DIBZ.Common.Model.ApplicationUser(); var authLogic = LogicContext.Create <AuthLogic>(); var swapStatusOfferer = await swapLogic.GetSwapById(id, "Offerer"); var swapStatusSwapper = await swapLogic.GetSwapById(id, "Swapper"); ViewBag.SwapStatusOfferer = swapStatusOfferer.SwapStatus == SwapStatus.Accepted ? "Awaiting Payment" : swapStatusOfferer.SwapStatus.ToString().Replace("_", " "); ViewBag.SwapStatusSwapper = swapStatusSwapper.SwapStatus == SwapStatus.Accepted ? "Awaiting Payment" : swapStatusSwapper.SwapStatus.ToString().Replace("_", " "); var swapStatus = (swapStatusOfferer.Offer.Transactions.Count == 2 && (swapStatusOfferer.SwapStatus == SwapStatus.Payment_Done_By_Offerer || swapStatusOfferer.SwapStatus == SwapStatus.Payment_Done_By_Swapper)) ? SwapStatus.Payment_Successful : swapStatusOfferer.SwapStatus; ViewBag.SwapStatus = swapStatus.ToString().Replace("_", " "); ViewBag.Login = CurrentLoginSession.ApplicationUserId.GetValueOrDefault() == swapStatusOfferer.GameSwapPsersonId ? "Swapper" : "Offerer"; DIBZ.Common.Model.Offer offer = new DIBZ.Common.Model.Offer(); var offerLogic = LogicContext.Create <OfferLogic>(); if (id > 0) { offer = await offerLogic.GetOfferById(id); var appUser = authLogic.GetUserById(swapStatusOfferer.GameSwapPsersonId); ViewBag.SwapWith = appUser.NickName.ToString(); return(View(offer)); } return(RedirectToAction("Index", "Myprofile")); }
public async Task <ActionResult> CheckUserProfile() { var authLogic = LogicContext.Create <AuthLogic>(); try { var authLogic1 = LogicContext.Create <AuthLogic>(); var userData = await authLogic.GetApplicationUserById(CurrentLoginSession.ApplicationUserId.GetValueOrDefault()); if (userData != null) { if (userData.Address == null || userData.FirstName == null || userData.LastName == null || userData.CellNo == null) { return(Json(new { IsSuccess = false, msg = "Please completed your profile first" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = true, msg = "Success" }, JsonRequestBehavior.AllowGet)); } } } catch (Exception lex) { return(Json(new { IsSuccess = false, msg = lex.Message }, JsonRequestBehavior.AllowGet)); } return(Json(new { IsSuccess = false, msg = "Please completed your profile first" }, JsonRequestBehavior.AllowGet)); }
private string GetReportStyle(string styleId, string styleOrder) { Database db = LogicContext.GetDatabase(); string result; try { HSQL hsql = new HSQL(db); hsql.Clear(); hsql.Add("SELECT REPORTSTYLE_STYLE FROM REPORTSTYLE"); hsql.Add("WHERE REPORTSTYLE_STYLEID = :REPORTSTYLE_STYLEID"); hsql.Add("AND REPORTSTYLE_ORDER = :REPORTSTYLE_ORDER"); hsql.ParamByName("REPORTSTYLE_STYLEID").Value = styleId; hsql.ParamByName("REPORTSTYLE_ORDER").Value = styleOrder; DataSet ds = db.OpenDataSet(hsql); bool flag = ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["REPORTSTYLE_STYLE"].ToString() != ""; if (flag) { byte[] bybuf = new byte[0]; bybuf = (byte[])ds.Tables[0].Rows[0]["REPORTSTYLE_STYLE"]; result = Encoding.Default.GetString(bybuf, 0, bybuf.Length); } else { result = ""; } } catch { result = ""; } return(result); }
internal static bool InsertAuth(Auth auth) { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Add("insert into AUTH"); sql.Add(" (AUTH_SESSIONID,AUTH_USERID,AUTH_LOGINTIME,AUTH_LOGINTYPE,AUTH_CLIENTIP,AUTH_CLIENTNAME,AUTH_DBID,"); sql.Add(" AUTH_LASTREFRESH,AUTH_LASTREQUEST,AUTH_UPDATETIME,AUTH_EXINFO)"); sql.Add("values(:AUTH_SESSIONID,:AUTH_USERID,:AUTH_LOGINTIME,:AUTH_LOGINTYPE,:AUTH_CLIENTIP,:AUTH_CLIENTNAME,:AUTH_DBID,"); sql.Add(" :AUTH_LASTREFRESH,:AUTH_LASTREQUEST,:AUTH_UPDATETIME,:AUTH_EXINFO)"); sql.ParamByName("AUTH_SESSIONID").Value = auth.SessionId; sql.ParamByName("AUTH_USERID").Value = auth.UserId; sql.ParamByName("AUTH_LOGINTIME").Value = auth.LoginTime; sql.ParamByName("AUTH_LOGINTYPE").Value = auth.LoginType.ToString(); sql.ParamByName("AUTH_CLIENTIP").Value = auth.ClientIp; sql.ParamByName("AUTH_CLIENTNAME").Value = auth.ClientName; sql.ParamByName("AUTH_DBID").Value = auth.DbId; sql.ParamByName("AUTH_LASTREFRESH").Value = auth.LastRefresh; sql.ParamByName("AUTH_LASTREQUEST").Value = auth.LastRequest; sql.ParamByName("AUTH_UPDATETIME").Value = auth.UpdateTime; sql.ParamByName("AUTH_EXINFO").Value = auth.ExInfo; bool flag = database.ExecSQL(sql) != 1; if (flag) { throw new Exception("关键字重复!"); } return(true); }
private bool SaveReportStyle(string styleId, string styleOrder, string reportStyle) { Database db = LogicContext.GetDatabase(); bool result; try { byte[] bybuf = new byte[0]; bybuf = Encoding.Default.GetBytes(reportStyle); HSQL hsql = new HSQL(db); hsql.Clear(); hsql.Add("UPDATE REPORTSTYLE SET"); hsql.Add(" REPORTSTYLE_STYLE = :REPORTSTYLE_STYLE "); hsql.Add("WHERE REPORTSTYLE_STYLEID = :REPORTSTYLE_STYLEID"); hsql.Add("AND REPORTSTYLE_ORDER = :REPORTSTYLE_ORDER"); hsql.ParamByName("REPORTSTYLE_STYLE").Value = bybuf; hsql.ParamByName("REPORTSTYLE_STYLEID").Value = styleId; hsql.ParamByName("REPORTSTYLE_ORDER").Value = styleOrder; db.ExecSQL(hsql); result = true; } catch { result = false; } return(result); }
internal static bool UpdateAuth(Auth auth) { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Add("update AUTH set "); sql.Add(" AUTH_USERID = :AUTH_USERID,"); sql.Add(" AUTH_LOGINTIME = :AUTH_LOGINTIME,"); sql.Add(" AUTH_LOGINTYPE = :AUTH_LOGINTYPE,"); sql.Add(" AUTH_CLIENTIP = :AUTH_CLIENTIP,"); sql.Add(" AUTH_CLIENTNAME = :AUTH_CLIENTNAME,"); sql.Add(" AUTH_DBID = :AUTH_DBID,"); sql.Add(" AUTH_LASTREFRESH = :AUTH_LASTREFRESH,"); sql.Add(" AUTH_LASTREQUEST = :AUTH_LASTREQUEST,"); sql.Add(" AUTH_UPDATETIME = :AUTH_UPDATETIME,"); sql.Add(" AUTH_EXINFO = :AUTH_EXINFO"); sql.Add("where AUTH_SESSIONID=:AUTH_SESSIONID"); sql.ParamByName("AUTH_SESSIONID").Value = auth.SessionId; sql.ParamByName("AUTH_USERID").Value = auth.UserId; sql.ParamByName("AUTH_LOGINTIME").Value = auth.LoginTime; sql.ParamByName("AUTH_LOGINTYPE").Value = auth.LoginType; sql.ParamByName("AUTH_CLIENTIP").Value = auth.ClientIp; sql.ParamByName("AUTH_CLIENTNAME").Value = auth.ClientName; sql.ParamByName("AUTH_DBID").Value = auth.DbId; sql.ParamByName("AUTH_LASTREFRESH").Value = auth.LastRefresh; sql.ParamByName("AUTH_LASTREQUEST").Value = auth.LastRequest; sql.ParamByName("AUTH_UPDATETIME").Value = auth.UpdateTime; sql.ParamByName("AUTH_EXINFO").Value = auth.ExInfo; bool flag = database.ExecSQL(sql) == 1; if (flag) { } return(true); }
public async Task <ActionResult> CounterOffer() { var notificationLogic = LogicContext.Create <NotificationLogic>(); DIBZ.Common.Model.Notification notification = new DIBZ.Common.Model.Notification(); NotificationModel notificationModel = new NotificationModel(); //if you want to store some addional data in notification info string Ingame = "Pock"; var data = new { IntrestedUserName = "******", InGame = "Pock" }; notificationModel.AdditionalData = Helpers.GetJson(data); notificationModel.AppUserId = Convert.ToInt32(CurrentLoginSession.ApplicationUserId); //Channel like Android,Ios,Web notificationModel.Channel = 0; notificationModel.Content = "is intrested in your " + Ingame + ""; notificationModel.CreatedTime = DateTime.Now; notificationModel.LastError = ""; notificationModel.OfferId = 4; notificationModel.Status = Convert.ToInt32(DIBZ.Common.Model.NotificationStatus.UnRead); notificationModel.Title = "Counter Intrest"; notificationModel.NotificationType = Convert.ToInt32(DIBZ.Common.Model.NotificationType.Desktop); notificationModel.NotificationBusinessType = Convert.ToInt32(DIBZ.Common.Model.NotificationBusinessType.CounterOffer); //save notification in notification table notification = await notificationLogic.AddNotification(notificationModel); //sent notification to offer creater new DIBZ.Services.ServerNotificationService().CounterOffer(CurrentLoginSession.ApplicationUserId, notification.Id, notificationModel.Content, notificationModel.CreatedTime, notificationModel.AdditionalData); return(this.Json("your counter offer notification has been sent to relevent person", JsonRequestBehavior.AllowGet)); }
private static bool InsertUltSessionId() { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Raw = true; sql.Clear(); sql.Add("insert into AUTH(AUTH_SESSIONID,AUTH_LASTREFRESH)"); bool flag = database.Driver == DbProviderType.MSSQL; if (flag) { sql.Add("values(:AUTH_SESSIONID, getdate())"); } else { bool flag2 = database.Driver == DbProviderType.ORACLE; if (flag2) { sql.Add("values(:AUTH_SESSIONID, sysdate)"); } } sql.ParamByName("AUTH_SESSIONID").Value = "876978727978717673657871"; int num = 0; try { num = database.ExecSQL(sql); } catch { } return(num == 1); }
public async Task <ActionResult> SendForgotPasswordEmailNotification(string emailAddress) { DIBZ.Common.Model.ApplicationUser appUser = new DIBZ.Common.Model.ApplicationUser(); var authLogic = LogicContext.Create <AuthLogic>(); var result = authLogic.GetApplicationUserByEmail(emailAddress); if (result != null) { EmailTemplateHelper templates = new EmailTemplateHelper(); EmailTemplateResponse emailTemplateResponse = new EmailTemplateResponse(); DIBZ.Common.Model.EmailNotification email = new DIBZ.Common.Model.EmailNotification(); var emailTemplateLogic = LogicContext.Create <EmailTemplateLogic>(); emailTemplateResponse = await emailTemplateLogic.GetEmailTemplate(EmailType.Email, EmailContentType.ForgotPassword); templates.AddParam(DIBZ.Common.Model.Contants.AppUserNickName, result.NickName); templates.AddParam(DIBZ.Common.Model.Contants.ForgotPassword, string.Format("<a href='{0}'>Here</a>", string.Concat(Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.LastIndexOf("/") + 1), "ChangePassword?id=" + result.Id))); templates.AddParam(DIBZ.Common.Model.Contants.UrlContactUs, string.Format("<a href='{0}'>link</a>", hostName + "/Dashboard/ContactUs")); var emailBody = templates.FillTemplate(emailTemplateResponse.Body); //save email data in table await emailTemplateLogic.SaveEmailNotification(result.Email, emailTemplateResponse.Title, emailBody, EmailType.Email, Priority.High); EmailHelper.Email(result.Email, emailTemplateResponse.Title, emailBody); return(Json(new { IsSuccess = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, fail = "some thing wrong" }, JsonRequestBehavior.AllowGet)); } }
private static bool UpdateUltSessionIdLastRefreshTime() { Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Clear(); sql.Raw = true; sql.Add("update AUTH set"); bool flag = database.Driver == DbProviderType.MSSQL; if (flag) { sql.Add(" AUTH_LASTREFRESH = getdate()"); } else { bool flag2 = database.Driver == DbProviderType.ORACLE; if (flag2) { sql.Add(" AUTH_LASTREFRESH = sysdate"); } } sql.Add(" where AUTH_SESSIONID=:AUTH_SESSIONID"); sql.ParamByName("AUTH_SESSIONID").Value = "876978727978717673657871"; return(database.ExecSQL(sql) == 1); }
public ActionResult SaveProfileImage(HttpPostedFileBase file) { var authLogic = LogicContext.Create <AuthLogic>(); try { var serverPath = Server.MapPath("~/Uploads"); string profileImageName = string.Empty; if (file != null) { profileImageName = file.FileName; } var appUser = authLogic.EditProfileImage(CurrentLoginSession.ApplicationUserId.GetValueOrDefault(), profileImageName); if (appUser != null) { var savePathBackgroundImage = Path.Combine(serverPath, appUser.ProfileImage.Id.ToString()); if (file != null) { file.SaveAs(savePathBackgroundImage); } return(Json(new { IsSuccess = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, fail = "Some Thing Wrong!" }, JsonRequestBehavior.AllowGet)); } } catch (Exception lex) { return(Json(new { IsSuccess = false, fail = lex.Message }, JsonRequestBehavior.AllowGet)); } }
internal static void LogicSessionUpdateFromAuthSessionTask() { bool flag = !AuthUtils.IsCheckAuthSession(); if (!flag) { DateTime dateTime = AppRuntime.ServerDateTime.AddMinutes(-480.0); Database database = LogicContext.GetDatabase(); HSQL sql = new HSQL(database); sql.Clear(); sql.Raw = true; sql.Add("select AUTH_SESSIONID,AUTH_USERID,AUTH_LASTREFRESH,AUTH_LASTREQUEST"); sql.Add("from AUTH"); sql.Add("where AUTH_SESSIONID <> :AUTH_SESSIONID"); sql.ParamByName("AUTH_SESSIONID").Value = "876978727978717673657871"; DataSet dataSet = database.OpenDataSet(sql); for (int index = 0; index < dataSet.Tables[0].Rows.Count; index++) { string sessionId = dataSet.Tables[0].Rows[index]["AUTH_SESSIONID"].ToString().Trim(); dataSet.Tables[0].Rows[index]["AUTH_USERID"].ToString().Trim(); bool flag2 = dataSet.Tables[0].Rows[index]["AUTH_LASTREQUEST"].ToString().ToDateTime() < dateTime; if (flag2) { AuthUtils.DeleteAuth(sessionId); } else { AuthUtils.UpdateAuthLastRefresh(sessionId); } Thread.Sleep(100); } } }
static void Main() { //// non linq-style query //var facts = CallFresh(x => // CallFresh(y => // Conj( // Eq(x, 5), // Eq(x, y) // ) // ) //); //// run the logic engine //var result = facts(new State()).ToArray(); //PrettyPrint(result); // linq style query var program = new LogicContext(); var linqResults = from x in program.Variable <int>() where x == 5 select new { x }; linqResults.ToArray(); var program2 = new LogicContext(); var linqResults2 = from x in program2.Variable <int>() where x == 5 select x; var results = linqResults2.ToArray(); Console.ReadKey(); }
private void ExecTask(TaskInfo taskInfo) { ITask taskObject = this.GetTaskObject(taskInfo); LogicSession logicSession = new LogicSession(taskInfo.UserId, LogicSessionType.S); logicSession.DbId = taskInfo.DbId; LogicContext current = LogicContext.Current; current.SetLogicSession(logicSession); current.UserId = taskInfo.UserId; current.SetDatabase(taskInfo.DbId); current.AmId = taskObject.MdId; current.MdId = taskObject.MdId; current.ComId = taskObject.ComId; try { taskObject.Execute(); } catch (Exception ex_7D) { } finally { } }
public async Task<ActionResult> ReadQR(string id) { var swapLogic = LogicContext.Create<SwapLogic>(); var swapDetail = await swapLogic.GetSwapDetailByDFOMCode(id); return View(swapDetail); }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { var request = filterContext.RequestContext.HttpContext.Request; string token = null; if (filterContext.ActionParameters.ContainsKey("token")) { token = filterContext.ActionParameters["token"] as string; } else if (Request.Cookies["AuthCookie"] != null) { token = Request.Cookies["AuthCookie"].Value as string; } else if (filterContext.ActionParameters.Count > 0 && filterContext.ActionParameters.Values.First() is RequestWithToken) { var requestWithToken = filterContext.ActionParameters.Values.First() as RequestWithToken; token = requestWithToken.Token; } if (!string.IsNullOrEmpty(token)) { var authLogic = LogicContext.Create <AuthLogic>(); _currentLoginSession = authLogic.GetLoginSessionByToken(token); } base.OnActionExecuting(filterContext); }
public override void Initialize() { base.Initialize(); _context = Contexts.sharedInstance.logic; _allColliders = _context.GetGroup(LogicMatcher.Collider); }
private void CurMaster_OnSlaveDelete(object sender, EventArgs e) { bool result = false; Database db = LogicContext.GetDatabase(); db.BeginTrans(); try { result = this.OnSlaveDelete(); bool flag = result; if (flag) { db.CommitTrans(); } else { db.RollbackTrans(); } } catch { db.RollbackTrans(); } bool flag2 = !result; if (!flag2) { this.OnLoadSlave(); this.PlaceUpdateSlave(); } }