/// <summary> /// 首页置顶 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SetTop(bool input) { try { int sysno = 0; if (input) { sysno = int.Parse(Request.QueryString["top"]); } else { sysno = int.Parse(Request.QueryString["notop"]); } SYS_FamousMod m_famous = SYS_FamousBll.GetInstance().GetModel(sysno); if (input) { m_famous.IsTop = (int)AppEnum.BOOL.True; } else { m_famous.IsTop = (int)AppEnum.BOOL.False; } SYS_FamousBll.GetInstance().Update(m_famous); ltrNotice.Text = "该记录已置顶!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true); } catch { ltrError.Text = "系统错误,置顶失败!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';", true); } }
protected void BindFamous() { this.m_famous = SYS_FamousBll.GetInstance().GetModel(this.sysno); if (this.m_famous.Photo == "") { this.m_famous.Photo = ""; } else if (!this.m_famous.Photo.Contains("//")) { this.m_famous.Photo = AppCmn.AppConfig.WebResourcesPath() + "FamousPhoto/" + this.m_famous.Photo; } this.DataBind(); }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Delete() { try { SYS_FamousMod m_famous = SYS_FamousBll.GetInstance().GetModel(int.Parse(Request.QueryString["delete"])); m_famous.DR = (int)AppEnum.State.deleted; SYS_FamousBll.GetInstance().Update(m_famous); if (m_famous.Source != "") { SPD_FamousBll.GetInstance().InputReturn(m_famous.SysNo); } ltrNotice.Text = "该记录已删除!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true); } catch { ltrError.Text = "系统错误,删除失败!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';", true); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SYS_FamousMod model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into SYS_Famous("); strSql.Append("Name,Description,BirthYear,BirthTime,Death,CateSysNo,Level,CustomerSysNo,DR,TS,Source,Gender,HomeTown,Height,FullName,TimeUnknown,IsTop,Photo,CollectCount)"); strSql.Append(" values ("); strSql.Append("@Name,@Description,@BirthYear,@BirthTime,@Death,@CateSysNo,@Level,@CustomerSysNo,@DR,@TS,@Source,@Gender,@HomeTown,@Height,@FullName,@TimeUnknown,@IsTop,@Photo,@CollectCount)"); strSql.Append(";select @@IDENTITY"); SqlCommand cmd = new SqlCommand(strSql.ToString()); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar, 200), new SqlParameter("@Description", SqlDbType.NText, 2147483646), new SqlParameter("@BirthYear", SqlDbType.Int, 4), new SqlParameter("@BirthTime", SqlDbType.DateTime), new SqlParameter("@Death", SqlDbType.DateTime), new SqlParameter("@CateSysNo", SqlDbType.Int, 4), new SqlParameter("@Level", SqlDbType.Int, 4), new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4), new SqlParameter("@DR", SqlDbType.TinyInt, 1), new SqlParameter("@TS", SqlDbType.DateTime), new SqlParameter("@Source", SqlDbType.VarChar, 50), new SqlParameter("@Gender", SqlDbType.TinyInt, 1), new SqlParameter("@HomeTown", SqlDbType.Int, 4), new SqlParameter("@Height", SqlDbType.Int, 4), new SqlParameter("@FullName", SqlDbType.VarChar, 100), new SqlParameter("@TimeUnknown", SqlDbType.TinyInt, 1), new SqlParameter("@IsTop", SqlDbType.Int, 4), new SqlParameter("@Photo", SqlDbType.VarChar, 500), new SqlParameter("@CollectCount", SqlDbType.Int, 4), }; if (model.Name != AppConst.StringNull) { parameters[0].Value = model.Name; } else { parameters[0].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[0]); if (model.Description != AppConst.StringNull) { parameters[1].Value = model.Description; } else { parameters[1].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[1]); if (model.BirthYear != AppConst.IntNull) { parameters[2].Value = model.BirthYear; } else { parameters[2].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[2]); if (model.BirthTime != AppConst.DateTimeNull) { parameters[3].Value = model.BirthTime; } else { parameters[3].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[3]); if (model.Death != AppConst.DateTimeNull) { parameters[4].Value = model.Death; } else { parameters[4].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[4]); if (model.CateSysNo != AppConst.IntNull) { parameters[5].Value = model.CateSysNo; } else { parameters[5].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[5]); if (model.Level != AppConst.IntNull) { parameters[6].Value = model.Level; } else { parameters[6].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[6]); if (model.CustomerSysNo != AppConst.IntNull) { parameters[7].Value = model.CustomerSysNo; } else { parameters[7].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[7]); if (model.DR != AppConst.IntNull) { parameters[8].Value = model.DR; } else { parameters[8].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[8]); if (model.TS != AppConst.DateTimeNull) { parameters[9].Value = model.TS; } else { parameters[9].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[9]); if (model.Source != AppConst.StringNull) { parameters[10].Value = model.Source; } else { parameters[10].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[10]); if (model.Gender != AppConst.IntNull) { parameters[11].Value = model.Gender; } else { parameters[11].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[11]); if (model.HomeTown != AppConst.IntNull) { parameters[12].Value = model.HomeTown; } else { parameters[12].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[12]); if (model.Height != AppConst.IntNull) { parameters[13].Value = model.Height; } else { parameters[13].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[13]); if (model.FullName != AppConst.StringNull) { parameters[14].Value = model.FullName; } else { parameters[14].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[14]); if (model.TimeUnknown != AppConst.IntNull) { parameters[15].Value = model.TimeUnknown; } else { parameters[15].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[15]); if (model.IsTop != AppConst.IntNull) { parameters[16].Value = model.IsTop; } else { parameters[16].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[16]); if (model.Photo != AppConst.StringNull) { parameters[17].Value = model.Photo; } else { parameters[17].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[17]); if (model.CollectCount != AppConst.IntNull) { parameters[18].Value = model.CollectCount; } else { parameters[18].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[18]); return(Convert.ToInt32(SqlHelper.ExecuteScalar(cmd, parameters))); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(SYS_FamousMod model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update SYS_Famous set "); strSql.Append("Name=@Name,"); strSql.Append("Description=@Description,"); strSql.Append("BirthYear=@BirthYear,"); strSql.Append("BirthTime=@BirthTime,"); strSql.Append("Death=@Death,"); strSql.Append("CateSysNo=@CateSysNo,"); strSql.Append("Level=@Level,"); strSql.Append("CustomerSysNo=@CustomerSysNo,"); strSql.Append("DR=@DR,"); strSql.Append("TS=@TS,"); strSql.Append("Source=@Source,"); strSql.Append("Gender=@Gender,"); strSql.Append("HomeTown=@HomeTown,"); strSql.Append("Height=@Height,"); strSql.Append("FullName=@FullName,"); strSql.Append("TimeUnknown=@TimeUnknown,"); strSql.Append("IsTop=@IsTop,"); strSql.Append("Photo=@Photo,"); strSql.Append("CollectCount=@CollectCount"); strSql.Append(" where SysNo=@SysNo "); SqlCommand cmd = new SqlCommand(strSql.ToString()); SqlParameter[] parameters = { new SqlParameter("@SysNo", SqlDbType.Int, 4), new SqlParameter("@Name", SqlDbType.NVarChar, 200), new SqlParameter("@Description", SqlDbType.NText, 2147483646), new SqlParameter("@BirthYear", SqlDbType.Int, 4), new SqlParameter("@BirthTime", SqlDbType.DateTime), new SqlParameter("@Death", SqlDbType.DateTime), new SqlParameter("@CateSysNo", SqlDbType.Int, 4), new SqlParameter("@Level", SqlDbType.Int, 4), new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4), new SqlParameter("@DR", SqlDbType.TinyInt, 1), new SqlParameter("@TS", SqlDbType.DateTime), new SqlParameter("@Source", SqlDbType.VarChar, 50), new SqlParameter("@Gender", SqlDbType.TinyInt, 1), new SqlParameter("@HomeTown", SqlDbType.Int, 4), new SqlParameter("@Height", SqlDbType.Int, 4), new SqlParameter("@FullName", SqlDbType.VarChar, 100), new SqlParameter("@TimeUnknown", SqlDbType.TinyInt, 1), new SqlParameter("@IsTop", SqlDbType.Int, 4), new SqlParameter("@Photo", SqlDbType.VarChar, 500), new SqlParameter("@CollectCount", SqlDbType.Int, 4) }; if (model.SysNo != AppConst.IntNull) { parameters[0].Value = model.SysNo; } else { parameters[0].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[0]); if (model.Name != AppConst.StringNull) { parameters[1].Value = model.Name; } else { parameters[1].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[1]); if (model.Description != AppConst.StringNull) { parameters[2].Value = model.Description; } else { parameters[2].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[2]); if (model.BirthYear != AppConst.IntNull) { parameters[3].Value = model.BirthYear; } else { parameters[3].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[3]); if (model.BirthTime != AppConst.DateTimeNull) { parameters[4].Value = model.BirthTime; } else { parameters[4].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[4]); if (model.Death != AppConst.DateTimeNull) { parameters[5].Value = model.Death; } else { parameters[5].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[5]); if (model.CateSysNo != AppConst.IntNull) { parameters[6].Value = model.CateSysNo; } else { parameters[6].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[6]); if (model.Level != AppConst.IntNull) { parameters[7].Value = model.Level; } else { parameters[7].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[7]); if (model.CustomerSysNo != AppConst.IntNull) { parameters[8].Value = model.CustomerSysNo; } else { parameters[8].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[8]); if (model.DR != AppConst.IntNull) { parameters[9].Value = model.DR; } else { parameters[9].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[9]); if (model.TS != AppConst.DateTimeNull) { parameters[10].Value = model.TS; } else { parameters[10].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[10]); if (model.Source != AppConst.StringNull) { parameters[11].Value = model.Source; } else { parameters[11].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[11]); if (model.Gender != AppConst.IntNull) { parameters[12].Value = model.Gender; } else { parameters[12].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[12]); if (model.HomeTown != AppConst.IntNull) { parameters[13].Value = model.HomeTown; } else { parameters[13].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[13]); if (model.Height != AppConst.IntNull) { parameters[14].Value = model.Height; } else { parameters[14].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[14]); if (model.FullName != AppConst.StringNull) { parameters[15].Value = model.FullName; } else { parameters[15].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[15]); if (model.TimeUnknown != AppConst.IntNull) { parameters[16].Value = model.TimeUnknown; } else { parameters[16].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[16]); if (model.IsTop != AppConst.IntNull) { parameters[17].Value = model.IsTop; } else { parameters[17].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[17]); if (model.Photo != AppConst.StringNull) { parameters[18].Value = model.Photo; } else { parameters[18].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[18]); if (model.CollectCount != AppConst.IntNull) { parameters[19].Value = model.CollectCount; } else { parameters[19].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[19]); return(SqlHelper.ExecuteNonQuery(cmd, parameters)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SYS_FamousMod model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into SYS_Famous("); strSql.Append("Name,Description,BirthYear,BirthTime,Death,CateSysNo,Level,CustomerSysNo,DR,TS,Source,Gender,HomeTown,Height,FullName,TimeUnknown,IsTop,Photo,CollectCount)"); strSql.Append(" values ("); strSql.Append("@Name,@Description,@BirthYear,@BirthTime,@Death,@CateSysNo,@Level,@CustomerSysNo,@DR,@TS,@Source,@Gender,@HomeTown,@Height,@FullName,@TimeUnknown,@IsTop,@Photo,@CollectCount)"); strSql.Append(";select @@IDENTITY"); SqlCommand cmd = new SqlCommand(strSql.ToString()); SqlParameter[] parameters = { new SqlParameter("@Name",SqlDbType.NVarChar,200), new SqlParameter("@Description",SqlDbType.NText,2147483646), new SqlParameter("@BirthYear",SqlDbType.Int,4), new SqlParameter("@BirthTime",SqlDbType.DateTime), new SqlParameter("@Death",SqlDbType.DateTime), new SqlParameter("@CateSysNo",SqlDbType.Int,4), new SqlParameter("@Level",SqlDbType.Int,4), new SqlParameter("@CustomerSysNo",SqlDbType.Int,4), new SqlParameter("@DR",SqlDbType.TinyInt,1), new SqlParameter("@TS",SqlDbType.DateTime), new SqlParameter("@Source",SqlDbType.VarChar,50), new SqlParameter("@Gender",SqlDbType.TinyInt,1), new SqlParameter("@HomeTown",SqlDbType.Int,4), new SqlParameter("@Height",SqlDbType.Int,4), new SqlParameter("@FullName",SqlDbType.VarChar,100), new SqlParameter("@TimeUnknown",SqlDbType.TinyInt,1), new SqlParameter("@IsTop",SqlDbType.Int,4), new SqlParameter("@Photo",SqlDbType.VarChar,500), new SqlParameter("@CollectCount",SqlDbType.Int,4), }; if (model.Name != AppConst.StringNull) parameters[0].Value = model.Name; else parameters[0].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[0]); if (model.Description != AppConst.StringNull) parameters[1].Value = model.Description; else parameters[1].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[1]); if (model.BirthYear != AppConst.IntNull) parameters[2].Value = model.BirthYear; else parameters[2].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[2]); if (model.BirthTime != AppConst.DateTimeNull) parameters[3].Value = model.BirthTime; else parameters[3].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[3]); if (model.Death != AppConst.DateTimeNull) parameters[4].Value = model.Death; else parameters[4].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[4]); if (model.CateSysNo != AppConst.IntNull) parameters[5].Value = model.CateSysNo; else parameters[5].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[5]); if (model.Level != AppConst.IntNull) parameters[6].Value = model.Level; else parameters[6].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[6]); if (model.CustomerSysNo != AppConst.IntNull) parameters[7].Value = model.CustomerSysNo; else parameters[7].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[7]); if (model.DR != AppConst.IntNull) parameters[8].Value = model.DR; else parameters[8].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[8]); if (model.TS != AppConst.DateTimeNull) parameters[9].Value = model.TS; else parameters[9].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[9]); if (model.Source != AppConst.StringNull) parameters[10].Value = model.Source; else parameters[10].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[10]); if (model.Gender != AppConst.IntNull) parameters[11].Value = model.Gender; else parameters[11].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[11]); if (model.HomeTown != AppConst.IntNull) parameters[12].Value = model.HomeTown; else parameters[12].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[12]); if (model.Height != AppConst.IntNull) parameters[13].Value = model.Height; else parameters[13].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[13]); if (model.FullName != AppConst.StringNull) parameters[14].Value = model.FullName; else parameters[14].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[14]); if (model.TimeUnknown != AppConst.IntNull) parameters[15].Value = model.TimeUnknown; else parameters[15].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[15]); if (model.IsTop != AppConst.IntNull) parameters[16].Value = model.IsTop; else parameters[16].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[16]); if (model.Photo != AppConst.StringNull) parameters[17].Value = model.Photo; else parameters[17].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[17]); if (model.CollectCount != AppConst.IntNull) parameters[18].Value = model.CollectCount; else parameters[18].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[18]); return Convert.ToInt32(SqlHelper.ExecuteScalar(cmd, parameters)); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(SYS_FamousMod model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update SYS_Famous set "); strSql.Append("Name=@Name,"); strSql.Append("Description=@Description,"); strSql.Append("BirthYear=@BirthYear,"); strSql.Append("BirthTime=@BirthTime,"); strSql.Append("Death=@Death,"); strSql.Append("CateSysNo=@CateSysNo,"); strSql.Append("Level=@Level,"); strSql.Append("CustomerSysNo=@CustomerSysNo,"); strSql.Append("DR=@DR,"); strSql.Append("TS=@TS,"); strSql.Append("Source=@Source,"); strSql.Append("Gender=@Gender,"); strSql.Append("HomeTown=@HomeTown,"); strSql.Append("Height=@Height,"); strSql.Append("FullName=@FullName,"); strSql.Append("TimeUnknown=@TimeUnknown,"); strSql.Append("IsTop=@IsTop,"); strSql.Append("Photo=@Photo,"); strSql.Append("CollectCount=@CollectCount"); strSql.Append(" where SysNo=@SysNo "); SqlCommand cmd = new SqlCommand(strSql.ToString()); SqlParameter[] parameters = { new SqlParameter("@SysNo",SqlDbType.Int,4), new SqlParameter("@Name",SqlDbType.NVarChar,200), new SqlParameter("@Description",SqlDbType.NText,2147483646), new SqlParameter("@BirthYear",SqlDbType.Int,4), new SqlParameter("@BirthTime",SqlDbType.DateTime), new SqlParameter("@Death",SqlDbType.DateTime), new SqlParameter("@CateSysNo",SqlDbType.Int,4), new SqlParameter("@Level",SqlDbType.Int,4), new SqlParameter("@CustomerSysNo",SqlDbType.Int,4), new SqlParameter("@DR",SqlDbType.TinyInt,1), new SqlParameter("@TS",SqlDbType.DateTime), new SqlParameter("@Source",SqlDbType.VarChar,50), new SqlParameter("@Gender",SqlDbType.TinyInt,1), new SqlParameter("@HomeTown",SqlDbType.Int,4), new SqlParameter("@Height",SqlDbType.Int,4), new SqlParameter("@FullName",SqlDbType.VarChar,100), new SqlParameter("@TimeUnknown",SqlDbType.TinyInt,1), new SqlParameter("@IsTop",SqlDbType.Int,4), new SqlParameter("@Photo",SqlDbType.VarChar,500), new SqlParameter("@CollectCount",SqlDbType.Int,4) }; if (model.SysNo != AppConst.IntNull) parameters[0].Value = model.SysNo; else parameters[0].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[0]); if (model.Name != AppConst.StringNull) parameters[1].Value = model.Name; else parameters[1].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[1]); if (model.Description != AppConst.StringNull) parameters[2].Value = model.Description; else parameters[2].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[2]); if (model.BirthYear != AppConst.IntNull) parameters[3].Value = model.BirthYear; else parameters[3].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[3]); if (model.BirthTime != AppConst.DateTimeNull) parameters[4].Value = model.BirthTime; else parameters[4].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[4]); if (model.Death != AppConst.DateTimeNull) parameters[5].Value = model.Death; else parameters[5].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[5]); if (model.CateSysNo != AppConst.IntNull) parameters[6].Value = model.CateSysNo; else parameters[6].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[6]); if (model.Level != AppConst.IntNull) parameters[7].Value = model.Level; else parameters[7].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[7]); if (model.CustomerSysNo != AppConst.IntNull) parameters[8].Value = model.CustomerSysNo; else parameters[8].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[8]); if (model.DR != AppConst.IntNull) parameters[9].Value = model.DR; else parameters[9].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[9]); if (model.TS != AppConst.DateTimeNull) parameters[10].Value = model.TS; else parameters[10].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[10]); if (model.Source != AppConst.StringNull) parameters[11].Value = model.Source; else parameters[11].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[11]); if (model.Gender != AppConst.IntNull) parameters[12].Value = model.Gender; else parameters[12].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[12]); if (model.HomeTown != AppConst.IntNull) parameters[13].Value = model.HomeTown; else parameters[13].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[13]); if (model.Height != AppConst.IntNull) parameters[14].Value = model.Height; else parameters[14].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[14]); if (model.FullName != AppConst.StringNull) parameters[15].Value = model.FullName; else parameters[15].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[15]); if (model.TimeUnknown != AppConst.IntNull) parameters[16].Value = model.TimeUnknown; else parameters[16].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[16]); if (model.IsTop != AppConst.IntNull) parameters[17].Value = model.IsTop; else parameters[17].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[17]); if (model.Photo != AppConst.StringNull) parameters[18].Value = model.Photo; else parameters[18].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[18]); if (model.CollectCount != AppConst.IntNull) parameters[19].Value = model.CollectCount; else parameters[19].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[19]); return SqlHelper.ExecuteNonQuery(cmd, parameters); }
/// <summary> /// 得到一个对象实体 /// </summary> public SYS_FamousMod GetModel(int SysNo) { StringBuilder strSql = new StringBuilder(); strSql.Append("select SysNo, Name, Description, BirthYear, BirthTime, Death, CateSysNo, Level, CustomerSysNo, DR, TS, Source, Gender, HomeTown, Height, FullName, TimeUnknown, IsTop, Photo, CollectCount from SYS_Famous"); strSql.Append(" where SysNo=@SysNo "); SqlParameter[] parameters = { new SqlParameter("@SysNo", SqlDbType.Int,4 ) }; parameters[0].Value = SysNo; SYS_FamousMod model = new SYS_FamousMod(); DataSet ds = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["SysNo"].ToString() != "") { model.SysNo = int.Parse(ds.Tables[0].Rows[0]["SysNo"].ToString()); } model.Name = ds.Tables[0].Rows[0]["Name"].ToString(); model.Description = ds.Tables[0].Rows[0]["Description"].ToString(); if (ds.Tables[0].Rows[0]["BirthYear"].ToString() != "") { model.BirthYear = int.Parse(ds.Tables[0].Rows[0]["BirthYear"].ToString()); } if (ds.Tables[0].Rows[0]["BirthTime"].ToString() != "") { model.BirthTime = DateTime.Parse(ds.Tables[0].Rows[0]["BirthTime"].ToString()); } if (ds.Tables[0].Rows[0]["Death"].ToString() != "") { model.Death = DateTime.Parse(ds.Tables[0].Rows[0]["Death"].ToString()); } if (ds.Tables[0].Rows[0]["CateSysNo"].ToString() != "") { model.CateSysNo = int.Parse(ds.Tables[0].Rows[0]["CateSysNo"].ToString()); } if (ds.Tables[0].Rows[0]["Level"].ToString() != "") { model.Level = int.Parse(ds.Tables[0].Rows[0]["Level"].ToString()); } if (ds.Tables[0].Rows[0]["CustomerSysNo"].ToString() != "") { model.CustomerSysNo = int.Parse(ds.Tables[0].Rows[0]["CustomerSysNo"].ToString()); } if (ds.Tables[0].Rows[0]["DR"].ToString() != "") { model.DR = int.Parse(ds.Tables[0].Rows[0]["DR"].ToString()); } if (ds.Tables[0].Rows[0]["TS"].ToString() != "") { model.TS = DateTime.Parse(ds.Tables[0].Rows[0]["TS"].ToString()); } model.Source = ds.Tables[0].Rows[0]["Source"].ToString(); if (ds.Tables[0].Rows[0]["Gender"].ToString() != "") { model.Gender = int.Parse(ds.Tables[0].Rows[0]["Gender"].ToString()); } if (ds.Tables[0].Rows[0]["HomeTown"].ToString() != "") { model.HomeTown = int.Parse(ds.Tables[0].Rows[0]["HomeTown"].ToString()); } if (ds.Tables[0].Rows[0]["Height"].ToString() != "") { model.Height = int.Parse(ds.Tables[0].Rows[0]["Height"].ToString()); } model.FullName = ds.Tables[0].Rows[0]["FullName"].ToString(); if (ds.Tables[0].Rows[0]["TimeUnknown"].ToString() != "") { model.TimeUnknown = int.Parse(ds.Tables[0].Rows[0]["TimeUnknown"].ToString()); } if (ds.Tables[0].Rows[0]["IsTop"].ToString() != "") { model.IsTop = int.Parse(ds.Tables[0].Rows[0]["IsTop"].ToString()); } model.Photo = ds.Tables[0].Rows[0]["Photo"].ToString(); if (ds.Tables[0].Rows[0]["CollectCount"].ToString() != "") { model.CollectCount = int.Parse(ds.Tables[0].Rows[0]["CollectCount"].ToString()); } return model; } else { return null; } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(SYS_FamousMod model) { dal.Update(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 "); } } }
protected void PrepareForm() { #region 项绑定 drpCate.DataSource = SYS_Famous_CategoryBll.GetInstance().GetList(); drpCate.DataTextField = "Name"; drpCate.DataValueField = "SysNo"; drpCate.DataBind(); drpDistrict1.DataSource = SYS_DistrictBll.GetInstance().GetFirstLevel(0); drpDistrict1.DataTextField = "Name"; drpDistrict1.DataValueField = "SysNo"; drpDistrict1.DataBind(); drpDistrict1.Items.Insert(0, new ListItem("请选择", "0")); chkTime.DataSource = AppEnum.GetTimeUnknown(); chkTime.DataTextField = "Value"; chkTime.DataValueField = "Key"; chkTime.DataBind(); #endregion if (type == "ADD") { } else if (type == "EDIT") { if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { try { SysNo = int.Parse(Request.QueryString["id"]); SYS_FamousMod m_famous = SYS_FamousBll.GetInstance().GetModel(SysNo); txtSysNo.Text = m_famous.SysNo.ToString(); txtName.Text = m_famous.Name; txtFullName.Text = m_famous.FullName; txtDesc.Text = m_famous.Description; txtYear.Text = m_famous.BirthYear.ToString(); txtMonth.Text = m_famous.BirthTime.Month.ToString(); txtDay.Text = m_famous.BirthTime.Day.ToString(); txtHour.Text = m_famous.BirthTime.Hour.ToString(); txtMinute.Text = m_famous.BirthTime.Minute.ToString(); if (m_famous.Height != AppConst.IntNull) { txtHeight.Text = m_famous.Height.ToString(); } chkTime.SelectedIndex = chkTime.Items.IndexOf(chkTime.Items.FindByValue(m_famous.TimeUnknown.ToString())); drpCate.SelectedIndex = drpCate.Items.IndexOf(drpCate.Items.FindByValue(m_famous.CateSysNo.ToString())); drpGender.SelectedIndex = drpGender.Items.IndexOf(drpGender.Items.FindByValue(m_famous.Gender.ToString())); DataTable m_area = SYS_DistrictBll.GetInstance().GetTreeDetail(m_famous.HomeTown); if (!CommonTools.IsDataTableNoRow(m_area)) { drpDistrict1.SelectedIndex = drpDistrict1.Items.IndexOf(drpDistrict1.Items.FindByValue(m_area.Rows[0]["SysNo1"].ToString())); drpDistrict1_SelectedIndexChanged(new object(), new EventArgs()); drpDistrict2.SelectedIndex = drpDistrict2.Items.IndexOf(drpDistrict2.Items.FindByValue(m_area.Rows[0]["SysNo2"].ToString())); drpDistrict2_SelectedIndexChanged(new object(), new EventArgs()); drpDistrict3.SelectedIndex = drpDistrict3.Items.IndexOf(drpDistrict3.Items.FindByValue(m_area.Rows[0]["SysNo3"].ToString())); drpDistrict3_SelectedIndexChanged(new object(), new EventArgs()); } DataTable m_keydt = REL_Famous_KeyWordBll.GetInstance().GetFamousList(SysNo); if (!AppCmn.CommonTools.IsDataTableNoRow(m_keydt)) { for (int i = 0; i < m_keydt.Rows.Count; i++) { txtKey.Text += m_keydt.Rows[i]["KeyWords"].ToString() + " "; } txtKey.Text = txtKey.Text.Trim(); } } catch { Response.Redirect("../Error.aspx?msg="); return; } } } else if (type == "INPUT") { if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { try { int spider = int.Parse(Request.QueryString["id"]); SPD_FamousMod m_spider = SPD_FamousBll.GetInstance().GetModel(spider); txtSysNo.Text = "自动生成"; txtFullName.Text = m_spider.FamousName; string[] tmp = m_spider.BirthTmp.Split(new char[] { '-', ' ', ':' }); if (tmp.Length > 6) { if (m_spider.BirthTmp.StartsWith("-")) { txtYear.Text = "-" + tmp[1]; txtMonth.Text = 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"); txtDay.Text = tmp[3]; if (tmp[4] == "12" && tmp[5] == "00" && tmp[6] == "PM") { txtHour.Text = tmp[4]; chkTime.SelectedIndex = 0; } else { if (tmp[6] == "PM") { txtHour.Text = (int.Parse(tmp[4]) + 12).ToString(); } else { txtHour.Text = tmp[4]; } chkTime.SelectedIndex = 1; } txtMinute.Text = tmp[5]; } } else { txtYear.Text = tmp[0]; txtMonth.Text = 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"); txtDay.Text = tmp[2]; if (tmp[3] == "12" && tmp[4] == "00" && tmp[5] == "PM") { txtHour.Text = tmp[3]; chkTime.SelectedIndex = 0; } else { if (tmp[5] == "PM") { txtHour.Text = (int.Parse(tmp[3]) + 12).ToString(); } else { txtHour.Text = tmp[3]; } chkTime.SelectedIndex = 1; } txtMinute.Text = tmp[4]; } txtHeight.Text = m_spider.Height.Replace("m", ""); drpGender.SelectedIndex = drpGender.Items.IndexOf(drpGender.Items.FindByValue(m_spider.Gender.ToString())); DataTable m_area = SYS_DistrictBll.GetInstance().GetTreeDetail(m_spider.HomeTown.Split(new char[] { '(', ',' })[0].Trim()); if (!CommonTools.IsDataTableNoRow(m_area)) { drpDistrict1.SelectedIndex = drpDistrict1.Items.IndexOf(drpDistrict1.Items.FindByValue(m_area.Rows[0]["SysNo1"].ToString())); drpDistrict1_SelectedIndexChanged(new object(), new EventArgs()); drpDistrict2.SelectedIndex = drpDistrict2.Items.IndexOf(drpDistrict2.Items.FindByValue(m_area.Rows[0]["SysNo2"].ToString())); drpDistrict2_SelectedIndexChanged(new object(), new EventArgs()); drpDistrict3.SelectedIndex = drpDistrict3.Items.IndexOf(drpDistrict3.Items.FindByValue(m_area.Rows[0]["SysNo3"].ToString())); drpDistrict3_SelectedIndexChanged(new object(), new EventArgs()); } } catch { } } } }
protected void Unnamed3_Click(object sender, EventArgs e) { string[] keys = this.txtKey.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); DataTable m_keys = new DataTable(); SYS_FamousMod m_famous = new SYS_FamousMod(); if (type == "EDIT") { if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { SysNo = int.Parse(Request.QueryString["id"]); } m_famous = SYS_FamousBll.GetInstance().GetModel(SysNo); m_keys = REL_Famous_KeyWordBll.GetInstance().GetFamousList(SysNo); } try { m_famous.BirthYear = int.Parse(txtYear.Text); m_famous.BirthTime = new DateTime(AppConst.DateTimeNull.Year, int.Parse(txtMonth.Text), int.Parse(txtDay.Text), int.Parse(txtHour.Text), int.Parse(txtMinute.Text), 0); m_famous.CateSysNo = int.Parse(drpCate.SelectedValue); m_famous.CustomerSysNo = GetSession().AdminEntity.CustomerSysNo; m_famous.Description = txtDesc.Text; m_famous.FullName = txtFullName.Text; m_famous.Gender = int.Parse(drpGender.SelectedValue); if (txtHeight.Text != AppConst.StringNull) { m_famous.Height = int.Parse(txtHeight.Text); } if (drpDistrict3.SelectedValue == "0") { ltrError.Text = "请选择第三级地区!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); } m_famous.HomeTown = int.Parse(drpDistrict3.SelectedValue); m_famous.Name = txtName.Text; if (type == "INPUT") { m_famous.Source = "AstroTheme"; } else { m_famous.Source = "手动添加"; } m_famous.TimeUnknown = int.Parse(chkTime.SelectedValue); } catch { ltrError.Text = "输入资料格式有误,请检查!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } try { if (type == "ADD") { m_famous.SysNo = SYS_FamousBll.GetInstance().Add(m_famous); for (int i = 0; i < keys.Length; i++) { SYS_Famous_KeyWordsMod tmp_key = new SYS_Famous_KeyWordsMod(); tmp_key.SysNo = SYS_Famous_KeyWordsBll.GetInstance().GetSysNoByName(keys[i]); if (tmp_key.SysNo == AppConst.IntNull) { tmp_key.KeyWords = keys[i]; tmp_key.SysNo = SYS_Famous_KeyWordsBll.GetInstance().Add(tmp_key); } REL_Famous_KeyWordMod tmp_rel = new REL_Famous_KeyWordMod(); tmp_rel.Famous_SysNo = m_famous.SysNo; tmp_rel.KeyWord_SysNo = tmp_key.SysNo; REL_Famous_KeyWordBll.GetInstance().Add(tmp_rel); } LogManagement.getInstance().WriteTrace(m_famous.SysNo, "Celebrity.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); } else if (type == "EDIT") { SYS_FamousBll.GetInstance().Update(m_famous); REL_Famous_KeyWordBll.GetInstance().RemoveAllKeyByFamous(m_famous.SysNo); for (int i = 0; i < keys.Length; i++) { SYS_Famous_KeyWordsMod tmp_key = new SYS_Famous_KeyWordsMod(); tmp_key.SysNo = SYS_Famous_KeyWordsBll.GetInstance().GetSysNoByName(keys[i]); if (tmp_key.SysNo == AppConst.IntNull) { tmp_key.KeyWords = keys[i]; tmp_key.SysNo = SYS_Famous_KeyWordsBll.GetInstance().Add(tmp_key); } REL_Famous_KeyWordMod tmp_rel = new REL_Famous_KeyWordMod(); tmp_rel.Famous_SysNo = m_famous.SysNo; tmp_rel.KeyWord_SysNo = tmp_key.SysNo; REL_Famous_KeyWordBll.GetInstance().Add(tmp_rel); } LogManagement.getInstance().WriteTrace(m_famous.SysNo, "Celebrity.Edit", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); } else if (type == "INPUT") { m_famous.SysNo = SYS_FamousBll.GetInstance().Add(m_famous); int spider = int.Parse(Request.QueryString["id"]); SPD_FamousMod m_spider = SPD_FamousBll.GetInstance().GetModel(spider); m_spider.FamousSysNo = m_famous.SysNo; SPD_FamousBll.GetInstance().Update(m_spider); for (int i = 0; i < keys.Length; i++) { SYS_Famous_KeyWordsMod tmp_key = new SYS_Famous_KeyWordsMod(); tmp_key.SysNo = SYS_Famous_KeyWordsBll.GetInstance().GetSysNoByName(keys[i]); if (tmp_key.SysNo == AppConst.IntNull) { tmp_key.KeyWords = keys[i]; tmp_key.SysNo = SYS_Famous_KeyWordsBll.GetInstance().Add(tmp_key); } REL_Famous_KeyWordMod tmp_rel = new REL_Famous_KeyWordMod(); tmp_rel.Famous_SysNo = m_famous.SysNo; tmp_rel.KeyWord_SysNo = tmp_key.SysNo; REL_Famous_KeyWordBll.GetInstance().Add(tmp_rel); } LogManagement.getInstance().WriteTrace(m_famous.SysNo, "Celebrity.Input", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); } ltrNotice.Text = "该记录已保存成功!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true); } catch (Exception ex) { ltrError.Text = "系统错误,保存失败!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); LogManagement.getInstance().WriteException(ex, "Celebrity.Save", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); } }
/// <summary> /// 得到一个对象实体 /// </summary> public SYS_FamousMod GetModel(int SysNo) { StringBuilder strSql = new StringBuilder(); strSql.Append("select SysNo, Name, Description, BirthYear, BirthTime, Death, CateSysNo, Level, CustomerSysNo, DR, TS, Source, Gender, HomeTown, Height, FullName, TimeUnknown, IsTop, Photo, CollectCount from SYS_Famous"); strSql.Append(" where SysNo=@SysNo "); SqlParameter[] parameters = { new SqlParameter("@SysNo", SqlDbType.Int, 4) }; parameters[0].Value = SysNo; SYS_FamousMod model = new SYS_FamousMod(); DataSet ds = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["SysNo"].ToString() != "") { model.SysNo = int.Parse(ds.Tables[0].Rows[0]["SysNo"].ToString()); } model.Name = ds.Tables[0].Rows[0]["Name"].ToString(); model.Description = ds.Tables[0].Rows[0]["Description"].ToString(); if (ds.Tables[0].Rows[0]["BirthYear"].ToString() != "") { model.BirthYear = int.Parse(ds.Tables[0].Rows[0]["BirthYear"].ToString()); } if (ds.Tables[0].Rows[0]["BirthTime"].ToString() != "") { model.BirthTime = DateTime.Parse(ds.Tables[0].Rows[0]["BirthTime"].ToString()); } if (ds.Tables[0].Rows[0]["Death"].ToString() != "") { model.Death = DateTime.Parse(ds.Tables[0].Rows[0]["Death"].ToString()); } if (ds.Tables[0].Rows[0]["CateSysNo"].ToString() != "") { model.CateSysNo = int.Parse(ds.Tables[0].Rows[0]["CateSysNo"].ToString()); } if (ds.Tables[0].Rows[0]["Level"].ToString() != "") { model.Level = int.Parse(ds.Tables[0].Rows[0]["Level"].ToString()); } if (ds.Tables[0].Rows[0]["CustomerSysNo"].ToString() != "") { model.CustomerSysNo = int.Parse(ds.Tables[0].Rows[0]["CustomerSysNo"].ToString()); } if (ds.Tables[0].Rows[0]["DR"].ToString() != "") { model.DR = int.Parse(ds.Tables[0].Rows[0]["DR"].ToString()); } if (ds.Tables[0].Rows[0]["TS"].ToString() != "") { model.TS = DateTime.Parse(ds.Tables[0].Rows[0]["TS"].ToString()); } model.Source = ds.Tables[0].Rows[0]["Source"].ToString(); if (ds.Tables[0].Rows[0]["Gender"].ToString() != "") { model.Gender = int.Parse(ds.Tables[0].Rows[0]["Gender"].ToString()); } if (ds.Tables[0].Rows[0]["HomeTown"].ToString() != "") { model.HomeTown = int.Parse(ds.Tables[0].Rows[0]["HomeTown"].ToString()); } if (ds.Tables[0].Rows[0]["Height"].ToString() != "") { model.Height = int.Parse(ds.Tables[0].Rows[0]["Height"].ToString()); } model.FullName = ds.Tables[0].Rows[0]["FullName"].ToString(); if (ds.Tables[0].Rows[0]["TimeUnknown"].ToString() != "") { model.TimeUnknown = int.Parse(ds.Tables[0].Rows[0]["TimeUnknown"].ToString()); } if (ds.Tables[0].Rows[0]["IsTop"].ToString() != "") { model.IsTop = int.Parse(ds.Tables[0].Rows[0]["IsTop"].ToString()); } model.Photo = ds.Tables[0].Rows[0]["Photo"].ToString(); if (ds.Tables[0].Rows[0]["CollectCount"].ToString() != "") { model.CollectCount = int.Parse(ds.Tables[0].Rows[0]["CollectCount"].ToString()); } return(model); } else { return(null); } }
protected void BindFamous() { this.m_famous = SYS_FamousBll.GetInstance().GetModel(this.sysno); if (this.m_famous.Photo == "") { this.m_famous.Photo = ""; } else if (!this.m_famous.Photo.Contains("//")) { this.m_famous.Photo = AppCmn.AppConfig.WebResourcesPath()+"FamousPhoto/" + this.m_famous.Photo; } this.DataBind(); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SYS_FamousMod model) { return dal.Add(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SYS_FamousMod model) { return(dal.Add(model)); }