//Tam thoi khong luu tru thong tin cookie public DataRow LoginUser_Cookie(Dictionary <string, object> args) { FnCommon.ThrowInfoIsEmpty(args, "email", "Nhập vào thông tin Email!!!"); FnCommon.ThrowInfoIsEmpty(args, "pwd", "Nhập vào mật khẩu!!!"); bool saveCookie = false; #region RememberPwd if (FnCommon.TryGetValue(args, "isrememberpwd").ToLower() == "true") //Get pwd from cookie.Pwd is config empty in sql file { CookieAuthenticateModule cookieUser = new CookieAuthenticateModule(); Dictionary <string, object> dicUser = new Dictionary <string, object>(); try { dicUser = Tool.ToDic(cookieUser.GetUserMemoryUser()); args["pwd"] = dicUser["pwd"].ToString(); } catch { args["pwd"] = ""; } } else { args["pwd"] = FnSecurity.GeneratePassword(args["pwd"].ToString()); CookieAuthenticateModule cookieUser = new CookieAuthenticateModule(); cookieUser.ClearRememberUserMemory(); } //Save Cookie if (FnCommon.TryGetValue(args, "rememberpwd").ToLower() == "true") //Get pwd from cookie.Pwd is config empty in sql file { saveCookie = true; } #endregion DataRow dr = Tool.ToRow(DBHelper.Instance.Query("Apps.Manage.Base.Users.LoginUser", args)); if (dr == null) { CookieAuthenticateModule cookieUser = new CookieAuthenticateModule(); cookieUser.ClearUserMemory(); throw new NService.NSInfoException("Tài khoản đăng nhập hoặc mật khẩu không hợp lệ!!!"); } else { #region AutoLogin if (FnCommon.TryGetValue(args, "autologin").ToLower() == "true") //Load pwd from cookie { CookieAuthenticateModule cookieUser = new CookieAuthenticateModule(); cookieUser.SetAutoLogin(dr["user_id"].ToString()); } #endregion } NService.AuthenticateHelper.Instance.Login(dr["user_id"].ToString(), saveCookie); return(dr); }
public string insertMenu(Dictionary <string, object> args) { if (!args.ContainsKey("link")) { args["link"] = ""; } if (!string.IsNullOrEmpty(args["link"].ToString())) { FnCommon.ThrowInfoIsEmpty(args, "link_kind", "Nhập vào link_kind!!!"); } if (!args.ContainsKey("link_kind")) { args["link_kind"] = ""; } FnCommon.ThrowInfoIsEmpty(args, "group_type", "Nhập vào group_type!!!"); //Check parentID hop le string up_menu_id = FnCommon.TryGetValue(args, "up_menu_id"); if (up_menu_id != "0" && up_menu_id != "-1") { DataTable dtMenuParent = DBHelper.Instance.Query("Apps.Manage.Base.Menu.getMenuByCond", Tool.ToDic("menu_id", up_menu_id)).Tables[0]; if (dtMenuParent.Rows.Count < 1) { throw new NService.NSErrorException("Không tồn UP_MENU_ID"); } } /*string stop_mk = FnCommon.TryGetValue(args, "disabled_mk").ToLower() == "true" ? "Y" : "N"; * args = FnCommon.TryUpdateValue(args, "stop_mk", stop_mk); */ //Thread.Sleep(10000); DBHelper.Instance.Execute("Apps.Manage.Base.Menu.insertMenu", args); return("1"); }