public static void SetItem(LogStatisticLabelModels item) { SQLData.Database db = new SQLData.Database(WebInfo.Conn); SQLData.TableObject tableObj = db.GetTableObject("LogStatisticLabels"); tableObj.GetDataFromObject(item); bool isNew = false; string sql = "Select 1 From LogStatisticLabels Where ID = " + item.ID; isNew = db.GetFirstValue(sql) == null; if (isNew) { tableObj["Title"] = item.Title; tableObj["LabelDate"] = item.LabelDate; tableObj["LabelColor"] = item.LabelColor; tableObj["ShowStatus"] = item.ShowStatus; tableObj["Creator"] = item.Creator; tableObj["CreateTime"] = item.CreateTime; tableObj.Insert(); } else { tableObj.Remove("Creator"); tableObj.Remove("CreateTime"); tableObj["Title"] = item.Title; tableObj["LabelDate"] = item.LabelDate; tableObj["ShowStatus"] = item.ShowStatus; tableObj["LabelColor"] = item.LabelColor; tableObj["Modifier"] = item.Modifier; tableObj["ModifyTime"] = item.ModifyTime; tableObj.Update(item.ID); } }
public static void SetItemStatus(long ID, bool ShowStatus) { LogStatisticLabelModels item = new LogStatisticLabelModels(); SQLData.ParameterCollection paraList = new SQLData.ParameterCollection(); paraList.Add("@ID", ID); paraList.Add("@ShowStatus", ShowStatus); SQLData.Database db = new SQLData.Database(WebInfo.Conn); string updateSQL = " UPDATE LogStatisticLabels SET ShowStatus=@ShowStatus WHERE ID=@ID "; db.ExecuteNonQuery(updateSQL, paraList); }