protected void rbl_RelationType_SelectedIndexChanged(object sender, EventArgs e) { switch (rbl_RelationType.SelectedValue) { case "1": tr_1.Visible = true; tr_2.Visible = false; ddl_RelationTableName.DataTextField = "Name"; ddl_RelationTableName.DataValueField = "TableName"; ddl_RelationTableName.DataSource = DictionaryBLL.Dictionary_Type_GetAllList(); ddl_RelationTableName.DataBind(); break; case "2": tr_1.Visible = true; tr_2.Visible = true; ddl_RelationTableName.DataTextField = "DisplayName"; ddl_RelationTableName.DataValueField = "Name"; ddl_RelationTableName.DataSource = UD_TableListBLL.GetModelList(""); ddl_RelationTableName.DataBind(); ddl_RelationTableName_SelectedIndexChanged(null, null); break; case "3": tr_1.Visible = false; tr_2.Visible = false; break; } }
private void BindDropDown() { ddl_TableName.DataSource = UD_TableListBLL.GetModelList ("ID IN(SELECT TableID FROM MCS_Reports.dbo.Rpt_DataSetTables WHERE DataSet='" + ViewState["ID"].ToString() + "')"); ddl_TableName.DataBind(); if (ddl_TableName.Items.Count > 0) { ddl_TableName_SelectedIndexChanged(null, null); } }
private void BindDropDown() { ddl_TableName.DataSource = UD_TableListBLL.GetModelList ("ID IN(SELECT TableID FROM MCS_Reports.dbo.Rpt_DataSetTables WHERE DataSet='" + ViewState["ID"].ToString() + "')"); ddl_TableName.DataBind(); ddl_TableName_SelectedIndexChanged(null, null); ddl_Param.DataSource = new Rpt_DataSetBLL((Guid)ViewState["ID"]).GetParams(); ddl_Param.DataBind(); if (ddl_Param.Items.Count == 0) { rbl_ValueFrom.SelectedValue = "M"; rbl_ValueFrom.Enabled = false; } }
private void BindGrid() { string condition = ""; if (tbx_Find.Text != "") { condition = "UD_TableList.Name like '%" + tbx_Find.Text + "%' OR UD_TableList.DisplayName like '%" + tbx_Find.Text + "%' OR UD_TableList.ModelName like '%" + tbx_Find.Text + "%'"; } IList <UD_TableList> source = UD_TableListBLL.GetModelList(condition); gv_List.PageIndex = (int)ViewState["PageIndex"]; gv_List.TotalRecordCount = source.Count; gv_List.BindGrid <UD_TableList>(source); }
private void BindDropDown() { if (ViewState["TableName"] != null) { IList <UD_TableList> tablelist = UD_TableListBLL.GetModelList("Name='" + ViewState["TableName"].ToString() + "'"); if (tablelist.Count > 0) { ViewState["TableID"] = tablelist[0].ID; IList <UD_ModelFields> fieldlist = UD_ModelFieldsBLL.GetModelList("Tableid='" + tablelist[0].ID + "'"); ddl_FieldName.DataSource = fieldlist; ddl_FieldName.DataTextField = "DisplayName"; ddl_FieldName.DataValueField = "ID"; ddl_FieldName.DataBind(); ddl_FieldName.Items.Insert(0, new ListItem("所有", "0")); } } }
private void BindDropDown() { ddl_TableName.DataSource = UD_TableListBLL.GetModelList(""); ddl_TableName.DataBind(); }
/// <summary> /// 用户登录 /// </summary> /// <param name="UserName">用户名</param> /// <param name="EncryptPassword">加密后的登录密码</param> /// <param name="DeviceCode">设备识别号</param> /// <param name="AuthKey">输出:授权码</param> /// <param name="ExtParams">扩展登录参数Json格式,包括AppCode、AppVersion、DeviceModel、DeviceOS、OSVersion、NetworkType /// 如:{"AppCode":"YSLRMAPP","AppVersion":43,"DeviceModel":"SM-G7108V","DeviceOS":"Android","OSVersion":"4.3","NetworkType":"ChinaMobile TD-SCDMA"} /// </param> /// <returns>0:登录成功 /// -1001:用户名或密码错误,登录失败 /// -1002:未能获取到对称加密密钥 /// -1003:设备号未在可登录的列表中登记 /// -1004:当前用户不允许从该设备号登录 /// -1005:登录失败 /// -1009:APP版本过低必须更新 /// </returns> public static int Login(string UserName, string EncryptPassword, string DeviceCode, string ExtParams, out string AuthKey) { LogWriter.WriteLog("UserLogin.LoginEx2:UserName="******",EncryptPassword="******",DeviceCode=" + DeviceCode + ",ExtParams=" + ExtParams); AuthKey = ""; Hashtable hs = string.IsNullOrEmpty(ExtParams) ? new Hashtable() : JsonConvert.DeserializeObject <Hashtable>(ExtParams); #region 判断是否符合最新版本要求 if (hs["AppCode"] != null) { int MinAppVersion = 0; if (hs["AppCode"].ToString() == "PBMSAPP") { MinAppVersion = ConfigHelper.GetConfigInt("MinAppVersion"); } else if (hs["AppCode"].ToString() == "PBMSAPP-iOS") { MinAppVersion = ConfigHelper.GetConfigInt("MinAppVersion-iOS"); } if (MinAppVersion > 0 && hs["AppVersion"] != null) { int AppVersion = 0; if (int.TryParse(hs["AppVersion"].ToString(), out AppVersion) && AppVersion < MinAppVersion) { LogWriter.WriteLog("UserLogin.LoginEx2: AppVersion too lower! UserName="******",DeviceCode=" + DeviceCode + ",AppVersion=" + AppVersion.ToString()); return(-1009); //APP版本过低必须更新 } } } #endregion #region 组织登录扩展属性 string ExtPropertys = ""; try { IList <UD_TableList> tables = UD_TableListBLL.GetModelList("Name='MCS_SYS.dbo.User_Online'"); if (tables.Count > 0) { IList <UD_ModelFields> models = UD_ModelFieldsBLL.GetModelList("Tableid='" + tables[0].ID.ToString() + "' AND Flag='N'"); foreach (UD_ModelFields item in models.OrderBy(p => p.Position)) { if (hs.ContainsKey(item.FieldName)) { ExtPropertys += hs[item.FieldName].ToString(); } ExtPropertys += "|"; } } } catch { } #endregion string cachekey = "EBMIF_DeviceCryptKey-" + DeviceCode; DeviceCryptKey key = null; #region 从数据库中加载保存的密钥 if (key == null) { string _keystr = ""; if (UserBLL.AppCryptKey_LoadKey(DeviceCode, out _keystr) == 0 && !string.IsNullOrEmpty(_keystr)) { try { key = JsonConvert.DeserializeObject <DeviceCryptKey>(_keystr); if (key != null) { DataCache.SetCache(cachekey, key, DateTime.Now.AddMinutes(5), System.Web.Caching.Cache.NoSlidingExpiration); } } catch { } } } #endregion int ret = 0; string Password = EncryptPassword; if (key == null) { LogWriter.WriteLog("UserLogin.LoginEx: Get DeviceCrytKey Null! UserName="******",DeviceCode=" + DeviceCode); return(-1002); //未能获取到对称加密密钥 } else { ret = AESProvider.DecryptText(EncryptPassword, key.AESKey, key.AESIV, out Password); if (ret < 0) { LogWriter.WriteLog("UserLogin.LoginEx! AESProvider.DecryptText Ret=" + ret.ToString() + ",DeviceCode=" + DeviceCode + ",EncryptPassword="******",AESKey=" + key.AESKey + ",AESIV=" + key.AESIV); return(-1002); } } ret = userlogin(UserName, Password, DeviceCode, ExtPropertys, out AuthKey); if (ConfigHelper.GetConfigBool("DebugMode") && key != null) { LogWriter.WriteLog("UserLogin.LoginEx:Login Return ret=" + ret.ToString() + ",DeviceCode=" + DeviceCode + ",AESKey=" + key.AESKey + ",AESIV=" + key.AESIV + ",AuthKey=" + AuthKey); } switch (ret) { case -1003: //设备号未在可登录的列表中登记 return(-1003); case -3: case -5: case -10: //当前用户不允许从该设备号登录 return(-1004); case -2: case -11: case -12: case -13: //用户名或密码错误,登录失败 return(-1001); case 1: //登录成功 return(0); default: //登录失败 return(-1005); } }