public SYS_AdminMod CheckAdmin(string username, string password) { SYS_AdminMod model = new SYS_AdminMod(); using (SQLData data = new SQLData()) { StringBuilder builder = new StringBuilder(); builder.Append("select SysNo from SYS_Admin where Username='******' and Password='******' and DR=").Append(0); try { model.CustomerSysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["SysNo"].ToString()); } catch (Exception exception) { //throw exception; } } if (model.CustomerSysNo != -999999) { model = this.GetModel(model.CustomerSysNo); model.LastLogin = DateTime.Now; this.Update(model); } return(model); }
/// <summary> /// 仅用于用户登录 /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <returns></returns> public USR_CustomerMod CheckUser(string username, string password) { USR_CustomerMod model = new USR_CustomerMod(); using (SQLData data = new SQLData()) { StringBuilder builder = new StringBuilder(); if (Util.IsEmailAddress(username)) { builder.Append("select SysNo from USR_Customer where Email='").Append(SQLData.SQLFilter(username)).Append("' and Password='******' and Status=").Append((int)AppEnum.State.normal); } else { builder.Append("select SysNo from USR_Customer where Phone='").Append(SQLData.SQLFilter(username)).Append("' and Password='******' and Status=").Append((int)AppEnum.State.normal); } try { model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["SysNo"].ToString()); } catch (Exception exception) { //throw exception; } } if (model.SysNo != AppConst.IntNull) { model = this.GetModel(model.SysNo); model.LastLoginTime = DateTime.Now; this.Update(model); } return(model); }
public int GetUnReadInfoNum(int sysno) { int ret = 0; using (SQLData data = new SQLData()) { StringBuilder builder = new StringBuilder(); builder.Append("select HasNewInfo from USR_Customer where sysno =").Append(sysno); try { ret = int.Parse(data.CmdtoDataRow(builder.ToString())["HasNewInfo"].ToString()); } catch (Exception exception) { //throw exception; } } return(ret); }
public int AddPoint(int point, int sysno) { int ret = 0; using (SQLData data = new SQLData()) { StringBuilder builder = new StringBuilder(); builder.Append("update USR_Customer set Point = Point+(").Append(point).Append(") where SysNo=").Append(sysno) .Append(";select Point from USR_Customer where SysNo=").Append(sysno); try { ret = int.Parse(data.CmdtoDataRow(builder.ToString())["Point"].ToString()); } catch (Exception exception) { //throw exception; } } return(ret); }
public AdvUserMod GetModel(string phonenum) { AdvUserMod model = new AdvUserMod(); using (SQLData data = new SQLData()) { StringBuilder builder = new StringBuilder(); builder.Append("select SysNo from AdvUser where CellPhone='").Append(SQLData.SQLFilter(phonenum)).Append("' and DR=").Append((int)AppEnum.State.normal); try { model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["SysNo"].ToString()); } catch (Exception exception) { //throw exception; } } if (model.SysNo != AppConst.IntNull) { model = this.GetModel(model.SysNo); } return model; }
public QQWeiBoUserMod GetRecordByName(string name) { QQWeiBoUserMod model = new QQWeiBoUserMod(); using (SQLData data = new SQLData()) { StringBuilder builder = new StringBuilder(); builder.Append("select SysNo from Apps.dbo.QQWeiBoUser where WB_Name='").Append(SQLData.SQLFilter(name) + "'"); try { model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["SysNo"].ToString()); } catch (Exception) { } } if (model.SysNo != -999999) { model = this.GetModel(model.SysNo); } return(model); }
public USR_CustomerMod GetUserByThirdID(string id) { USR_CustomerMod model = new USR_CustomerMod(); using (SQLData data = new SQLData()) { StringBuilder builder = new StringBuilder(); builder.Append("select CustomerSysNo from USR_ThirdLogin where OpenID='").Append(SQLData.SQLFilter(id)).Append("'"); try { model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["CustomerSysNo"].ToString()); } catch (Exception exception) { //throw exception; } } if (model.SysNo != AppConst.IntNull) { model = this.GetModel(model.SysNo); } return(model); }
public USR_CustomerMod CheckNickName(string nickname) { USR_CustomerMod model = new USR_CustomerMod(); using (SQLData data = new SQLData()) { StringBuilder builder = new StringBuilder(); builder.Append("select SysNo from USR_Customer where NickName='").Append(SQLData.SQLFilter(nickname)).Append("' and Status=").Append((int)AppEnum.State.normal); try { model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["SysNo"].ToString()); } catch (Exception exception) { //throw exception; } } if (model.SysNo != AppConst.IntNull) { model = this.GetModel(model.SysNo); } return(model); }
/// <summary> /// 批量导入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Unnamed2_Click(object sender, EventArgs e) { using (SQLData m_data = new SQLData()) { for (int i = 16831; i < 40965; i++) { DataRow m_dr = m_data.CmdtoDataRow("select * from [SPD_Famous] where sysno =" + i); if (m_dr["Name"].ToString() == "" || m_dr["Biography"].ToString() == "" || m_dr["Biography"].ToString() == "SameNameError") { continue; } SYS_FamousMod m_famous = new SYS_FamousMod(); if (m_dr["FamousSysNo"].ToString() != "") { m_famous = SYS_FamousBll.GetInstance().GetModel(int.Parse(m_dr["FamousSysNo"].ToString())); m_famous.Photo = m_dr["photo"].ToString(); SYS_FamousBll.GetInstance().Update(m_famous); //Console.WriteLine(m_dr["sysno"] + " update "); continue; } DataTable m_area = SYS_DistrictBll.GetInstance().GetTreeDetail(m_dr["HomeTown"].ToString().Split(new char[] { '(', ',' })[0].Trim()); if (!CommonTools.IsDataTableNoRow(m_area)) { m_famous.HomeTown = int.Parse(m_area.Rows[0]["SysNo3"].ToString()); } string[] tmp = m_dr["BirthTmp"].ToString().Split(new char[] { '-', ' ', ':' }); int month = 0; int day = 0; int hour = 0; int minute = 0; if (tmp.Length > 6) { if (m_dr["BirthTmp"].ToString().StartsWith("-")) { m_famous.BirthYear = int.Parse("-" + tmp[1]); month = int.Parse(tmp[2].Replace("January", "1").Replace("February", "2").Replace("March", "3") .Replace("April", "4").Replace("May", "5").Replace("June", "6").Replace("July", "7") .Replace("August", "8").Replace("September", "9").Replace("October", "10") .Replace("November", "11").Replace("December", "12")); day = int.Parse(tmp[3]); if (tmp[4] == "12" && tmp[5] == "00" && tmp[6] == "PM") { hour = int.Parse(tmp[4]); m_famous.TimeUnknown = 1; } else { if (tmp[6] == "PM" && tmp[4] != "12") { hour = (int.Parse(tmp[4]) + 12); } else { hour = int.Parse(tmp[4]); } m_famous.TimeUnknown = 0; } minute = int.Parse(tmp[5]); } } else { m_famous.BirthYear = int.Parse(tmp[0]); month = int.Parse(tmp[1].Replace("January", "1").Replace("February", "2").Replace("March", "3") .Replace("April", "4").Replace("May", "5").Replace("June", "6").Replace("July", "7") .Replace("August", "8").Replace("September", "9").Replace("October", "10") .Replace("November", "11").Replace("December", "12")); day = int.Parse(tmp[2]); if (tmp[3] == "12" && tmp[4] == "00" && tmp[5] == "PM") { hour = int.Parse(tmp[3]); m_famous.TimeUnknown = 1; } else { if (tmp[5] == "PM" && tmp[3] != "12") { hour = int.Parse(tmp[3]) + 12; } else { hour = int.Parse(tmp[3]); } m_famous.TimeUnknown = 0; } minute = int.Parse(tmp[4]); } m_famous.BirthTime = new DateTime(8000, month, day, hour, minute, 0); m_famous.CateSysNo = 1; m_famous.CustomerSysNo = 1; m_famous.Description = m_dr["Biography"].ToString(); m_famous.DR = 0; m_famous.FullName = m_dr["FamousName"].ToString(); m_famous.Gender = int.Parse(m_dr["Gender"].ToString()); if (m_dr["Height"].ToString() != "") { m_famous.Height = int.Parse(m_dr["Height"].ToString().Replace("m", "")); } m_famous.IsTop = 0; m_famous.Name = m_dr["Name"].ToString(); m_famous.Source = "AstroTheme"; m_famous.TS = DateTime.Now; m_famous.Photo = m_dr["photo"].ToString(); m_famous.SysNo = SYS_FamousBll.GetInstance().Add(m_famous); SPD_FamousMod m_spider = SPD_FamousBll.GetInstance().GetModel(i); m_spider.FamousSysNo = m_famous.SysNo; SPD_FamousBll.GetInstance().Update(m_spider); //Console.WriteLine(m_dr["sysno"] + " add "); } } }