//点击更新 protected void ColorViews_RowUpdating(object sender, GridViewUpdateEventArgs e) { Model.Colors color = new Model.Colors(); color.ColorId = int.Parse(ColorViews.DataKeys[e.RowIndex].Values[0].ToString()); color.ColorCode = ((TextBox)ColorViews.Rows[e.RowIndex].FindControl("TextColorCode")).Text; color.Name = ((TextBox)ColorViews.Rows[e.RowIndex].FindControl("TextName")).Text; color.Matching = ((TextBox)ColorViews.Rows[e.RowIndex].FindControl("TextMatch")).Text; if (BLL.ColorsBLL.UpdateColor(color) > 0) { ColorViews.EditIndex = -1; ColorDataBind(); } }
/// <summary> /// 修改单个颜色信息 /// </summary> /// <param name="colors">修改之后的颜色信息</param> /// <returns>是否修改成功 1 = 成功 0 = 失败</returns> public static int UpdateColor(Model.Colors colors) { string sql = "update Colors set ColorCode = @code, Name = @name , Matching =@match where ColorId = @id "; SqlParameter[] parameter = { new SqlParameter("@code", colors.ColorCode), new SqlParameter("@name", colors.Name), new SqlParameter("@match", colors.Matching), new SqlParameter("@id", colors.ColorId), }; return(SQLHelper.ExecuteNonQurery(sql, CommandType.Text, parameter)); }
public NewDiscoveryVM() { Colors = new Model.Colors(); BlueCommand = new Command(ChangeColorBlue); WetAsphaltCommand = new Command(ChangeColorWetAsphalt); PinkCommand = new Command(ChangeColorPink); RedCommand = new Command(ChangeColorRed); YellowCommand = new Command(ChangeColorYellow); OrangeCommand = new Command(ChangeColorOrange); GreenCommand = new Command(ChangeColorGreen); WisteriaCommand = new Command(ChangeColorWisteria); CloudsCommand = new Command(ChangeColorClouds); AsbestosCommand = new Command(ChangeColorAsbestos); }
/// <summary> /// 修改单个颜色信息 /// </summary> /// <param name="colors">修改之后的颜色信息</param> /// <returns>是否修改成功 1 = 成功 0 = 失败</returns> public static int UpdateColor(Model.Colors colors) { return(DAL.ColorsDAL.UpdateColor(colors)); }