protected void login(string uid, string password, int databaseId) { CUSTOMRP.Model.USER myUser = null; try { //v1.1.0 - Cheong - 2016/05/18 - Make hashkey configurable CUSTOMRP.Model.DATABASE mydb = WebHelper.bllCompany.GetModel(me.ID, databaseId); string salt = (mydb != null) ? mydb.HASHKEY : "com"; //string hash = Common.Utils.MD5NET(uid + DateTime.Now.ToString("yyyyMMdd") + "com"); string hash = Common.Utils.MD5NET(uid + DateTime.Now.ToString("yyyyMMdd") + salt); if (hash == password) { myUser = WebHelper.bllUSER.GetModel(me.ID, uid, databaseId); } } catch { // on any error, assume it's login failure } if (myUser != null) { //store user's information to cookie, CUSTOMRP.Model.DATABASE mydb = WebHelper.bllCompany.GetModel(me.ID, databaseId); HttpContext.Current.Session[AppNum.str_var_UserCookie_uid] = uid; HttpContext.Current.Session[AppNum.str_var_UserCookie_logintime] = DateTime.Now.ToString("yyyyMMddhhmm"); HttpContext.Current.Session[AppNum.str_var_UserCookie_Databaseid] = mydb.ID; HttpContext.Current.Session[AppNum.str_var_UserCookie_DatabaseName] = mydb.NAME; HttpContext.Current.Session[AppNum.str_var_UserCookie_APPLICATIONID] = mydb.APPLICATIONID; HttpContext.Current.Session[AppNum.str_var_UserSessionName] = myUser; this._me = (new QueryReport.Code.LoginUser()).CurrentUser; // update v_Security criteria } else { //Common.JScript.AlertAndRedirect(AppNum.loginerror, "~/SignIn.aspx"); Common.JScript.Alert(AppNum.ErrorMsg.loginerror); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(CUSTOMRP.Model.DATABASE model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(CUSTOMRP.Model.DATABASE model) { return(dal.Update(model)); }
//v1.8.8 2019.03.08 Alex - Don't run the view/sp to refresh public List <CUSTOMRP.Model.SOURCEVIEWCOLUMN> RefreshModelsForSourceView(int UserID, int SVID, bool showHidden = false) { List <CUSTOMRP.Model.SOURCEVIEWCOLUMN> result = dal.GetModelsForSourceView(UserID, SVID, showHidden); #region Check if there's new columns to add, and whether there are columns to hide if (showHidden) { string[] svColumns = result.Select(x => x.COLUMNNAME).ToArray(); CUSTOMRP.Model.SOURCEVIEW sv = dalSV.GetModel(UserID, SVID); //CUSTOMRP.Model.V_DATABASE db = (new V_DATABASE()).GetModel(sv.DATABASEID); CUSTOMRP.Model.DATABASE db = dalDB.GetModel(UserID, sv.DATABASEID); string[] colnames = new string[0]; switch (sv.SourceType) { case CUSTOMRP.Model.SOURCEVIEW.SourceViewType.View: case CUSTOMRP.Model.SOURCEVIEW.SourceViewType.Table: { colnames = CUSTOMRP.BLL.AppHelper.GetColumnNamesForTblView(UserID, db.NAME, sv.TBLVIEWNAME); } break; case CUSTOMRP.Model.SOURCEVIEW.SourceViewType.StoredProc: { colnames = CUSTOMRP.BLL.AppHelper.GetColumnNamesForStoredProc(UserID, db.NAME, sv.TBLVIEWNAME); } break; } for (int i = 0; i < colnames.Length; i++) { //if (!svColumns.Contains(colnames[i])) if (!svColumns.Contains(colnames[i], StringComparer.OrdinalIgnoreCase)) { // new column result.Add(new CUSTOMRP.Model.SOURCEVIEWCOLUMN() { ID = 0, SVID = SVID, COLUMNNAME = colnames[i], DISPLAYNAME = "", COLUMNTYPE = 1, COLUMNCOMMENT = "", HIDDEN = false, DEFAULTDISPLAYNAME = "", }); } else { result.Where(x => x.COLUMNNAME.ToUpper() == colnames[i].ToUpper()).ToList().ForEach(x => x.COLUMNNAME = colnames[i]); } } } #endregion #region Remove hidden records from list if hidden record is not to be included in result if (!showHidden) { result = result.Where(x => !x.HIDDEN).ToList(); } #endregion return(result); }