private void checkUserAvailable() { int times = 0; HttpCookie co = System.Web.HttpContext.Current.Request.Cookies["ccUserTimes"]; if (co != null) { times = CFun.ParseInt(co.Value); times++; if (times > 10) { times = 0; } } else { co = new HttpCookie("ccUserTimes"); } co.Value = times.ToString(); System.Web.HttpContext.Current.Response.Cookies.Add(co); if (times == 0) { if (ExecSql.GetDataSet("select ld from AdmUser where Ld=" + CurrentUId + " and CheckCode<>" + CurrentCheckCode).Tables[0].Rows.Count > 0) { new BllAdmUser().LogOut(); return; } } }
/// <summary> /// 新增或修改一条信息 /// </summary> /// <param name="_UserModule">实体类</param> /// <param name="Expired">返回是否过期</param> /// <returns></returns> public bool InsertOrUpdate(T _UserModule, out bool Expired) { Expired = false; string idStr = ""; PropertyInfo p = typeof(T).GetProperty("LastDate"); if (p != null) { try { object obj = p.GetValue(_UserModule, null); if (obj != null) { DateTime lastDate = (DateTime)obj; if (lastDate != null) { PropertyInfo p1 = typeof(T).GetProperty("Ld"); if (p1 != null) { object obj1 = p1.GetValue(_UserModule, null); if (obj1 != null) { idStr = ((Int32)obj1).ToString(); string dataLastDate = ExecSql.GetDataSet("select LastDate from " + tableName + " where Ld=" + idStr).Tables[0].Rows[0][0].ToString(); if (dataLastDate != "") { DateTime nDate = Convert.ToDateTime(dataLastDate); if (nDate > lastDate) { Expired = true; return(false); } } } } } } } catch { } } return(ExecSqlConn.InsertOrUpdateData <T>(_UserModule, sqlConn)); }