private void BindData() { if (this.Action == "Edit") { this.CurrentEntity = new LinkInfoBLL().GetSingle(this.Id); if (CurrentEntity != null) { this.SiteName.Text = this.CurrentEntity.LinkName; this.ShowName.Text = this.CurrentEntity.ShowName; this.DevID.Value = this.CurrentEntity.CPID.ToString(); this.DevName.Text = this.CurrentEntity.DevName.ToString(); this.CPName.Value = this.CurrentEntity.DevName.ToString(); this.LinkUrl.Text = this.CurrentEntity.LinkUrl; this.CoopType.SelectedValue = this.CurrentEntity.CoopType.ToString(); this.LinkTag.SelectedValue = this.CurrentEntity.LinkTag.ToString(); this.LinkDesc.Text = this.CurrentEntity.LinkDesc.ToString(); this.Remarks.Text = this.CurrentEntity.Remarks; this.Status.SelectedValue = this.CurrentEntity.Status.ToString(); this.IconPicUrl.Value = this.CurrentEntity.IconUrl; } else { this.Alert("参数非法"); } } }
private List <MySqlParameter> GetMySqlParameters(LinkInfoEntity entity) { List <MySqlParameter> paramsList = new List <MySqlParameter>(); paramsList.Add(new MySqlParameter("@LinkID", entity.LinkID)); paramsList.Add(new MySqlParameter("@CPID", entity.CPID)); paramsList.Add(new MySqlParameter("@DevName", entity.DevName)); paramsList.Add(new MySqlParameter("@LinkName", entity.LinkName)); paramsList.Add(new MySqlParameter("@ShowName", entity.ShowName)); paramsList.Add(new MySqlParameter("@LinkUrl", entity.LinkUrl)); paramsList.Add(new MySqlParameter("@IconUrl", entity.IconUrl)); paramsList.Add(new MySqlParameter("@CoopType", entity.CoopType)); paramsList.Add(new MySqlParameter("@LinkTag", entity.LinkTag)); paramsList.Add(new MySqlParameter("@LinkDesc", entity.LinkDesc)); paramsList.Add(new MySqlParameter("@Remarks", entity.Remarks)); paramsList.Add(new MySqlParameter("@CreateTime", DateTime.Now)); paramsList.Add(new MySqlParameter("@UpdateTime", DateTime.Now)); paramsList.Add(new MySqlParameter("@Status", entity.Status)); //paramsList.Add(new MySqlParameter("@OpCreateTime", DateTime.Now)); //paramsList.Add(new MySqlParameter("@OpUpdateTime", DateTime.Now)); //paramsList.Add(new MySqlParameter("@OpStatus", entity.OpStatus)); paramsList.Add(new MySqlParameter("@StartIndex", entity.StartIndex)); paramsList.Add(new MySqlParameter("@EndIndex", entity.EndIndex)); return(paramsList); }
public bool Update(LinkInfoEntity entity) { #region CommandText string commandText = @"UPDATE LinkInfo SET CPID = @CPID, DevName = @DevName, LinkName = @LinkName, ShowName = @ShowName, LinkUrl = @LinkUrl, IconUrl = @IconUrl, CoopType = @CoopType, LinkTag = @LinkTag, LinkDesc = @LinkDesc, Remarks = @Remarks, UpdateTime = @UpdateTime, Status = @Status, OpUpdateTime = @OpUpdateTime, OpStatus = @OpStatus WHERE LinkID =@LinkID ;"; #endregion return(this.ExecuteNonQuery(commandText, entity)); }
private bool ExecuteNonQuery(string commandText, LinkInfoEntity entity) { List <MySqlParameter> paramsList = GetMySqlParameters(entity); int result = MySqlHelper.ExecuteNonQuery(this.ConnectionString, commandText, paramsList.ToArray()); return(base.ExecuteStatus(result)); }
public bool Delete(LinkInfoEntity entity) { #region CommandText string commandText = @"UPDATE LinkInfo SET UpdateTime =@UpdateTime, Status =@Status, WHERE LinkID =@LinkID ; "; #endregion return(this.ExecuteNonQuery(commandText, entity)); }
public bool Insert(LinkInfoEntity entity) { #region CommandText string commandText = @"INSERT INTO LinkInfo ( CPID, DevName, LinkName, ShowName, LinkUrl, IconUrl, CoopType, LinkTag, LinkDesc, Remarks, CreateTime, UpdateTime, Status ) VALUES ( @CPID, @DevName, @LinkName, @ShowName, @LinkUrl, @IconUrl, @CoopType, @LinkTag, @LinkDesc, @Remarks, @CreateTime, @UpdateTime, @Status ) ;"; #endregion return(this.ExecuteNonQuery(commandText, entity)); }
private void Edit() { LinkInfoEntity entity = new LinkInfoEntity() { LinkID = this.Id, //站点名称 LinkName = this.SiteName.Text.Trim(), //显示名称 ShowName = this.ShowName.Text.Trim(), //开发者ID CPID = this.DevID.Value.Trim().Convert <int>(1), //开发者名称 DevName = this.CPName.Value.Trim(), //实际URL地址 LinkUrl = this.LinkUrl.Text.Trim(), //合作类型,例如:1=CPC,2=CPL... CoopType = this.CoopType.SelectedValue.Convert <int>(0), //外链标签,例如:1=独家,2=首发,4=...位运算 LinkTag = this.LinkTag.SelectedValue.Convert <int>(0), //外链描述 LinkDesc = this.LinkDesc.Text.Trim(), //ICON URL IconUrl = this.IconPicUrl.Value.Trim(), //状态,定义:1=正常,2=禁用 Status = this.Status.SelectedValue.Convert <int>(0), //备注 Remarks = this.Remarks.Text.Trim(), //运营状态,定义:1=正常,2=禁用 //OpStatus = this.Status.SelectedValue.Convert<int>(0) }; if (new LinkInfoBLL().Update(entity)) { Response.Redirect("LinkInfoList.aspx"); } else { this.Alert("修改失败"); } }
public bool Delete(LinkInfoEntity entity) { return(new LinkInfoDAL().Delete(entity)); }
public bool Update(LinkInfoEntity entity) { return(new LinkInfoDAL().Update(entity)); }
public bool Insert(LinkInfoEntity entity) { return(new LinkInfoDAL().Insert(entity)); }