public string GetName(int id) { TracktagInfo entity = GetModel(id, true); if (entity == null) { return(string.Empty); } return(entity.Name); }
public TracktagInfo GetModel(int id, bool fromCache = false) { TracktagInfo entity = null; List <TracktagInfo> list = GetList(fromCache); entity = list.Find(c => c.ID == id); return(entity); }
public static TracktagInfo PopulateTracktagInfo(IDataReader reader) { TracktagInfo entity = new TracktagInfo() { ID = (int)reader["ID"], Name = reader["Name"] as string, DataLevel = (int)reader["DataLevel"], CorporationID = (int)reader["CorporationID"], Sort = DataConvert.SafeInt(reader["Sort"]) }; return(entity); }
private void LoadData() { int id = GetInt("id"); if (id > 0) { CurrentTracktag = Tracktags.Instance.GetModel(id); if (CurrentTracktag == null) WriteMessage("/message.aspx", "系统提示", "无效线索标签!", "", "/index.aspx"); else { if (!Admin.Administrator && Admin.CorporationID != CurrentTracktag.CorporationID) WriteMessage("/message.aspx", "系统提示", "没有权限!", "", "/index.aspx"); if (!Admin.Administrator && CurrentTracktag.DataLevel == 0) WriteMessage("/message.aspx", "系统提示", "没有权限!", "", "/index.aspx"); txtName.Value = CurrentTracktag.Name; } } }
protected void btnSubmit_Click(object sender, EventArgs e) { TracktagInfo entity = new TracktagInfo(); int id = GetInt("id"); if (id > 0) { entity = Tracktags.Instance.GetModel(id, true); FillData(entity); Tracktags.Instance.Update(entity); } else { FillData(entity); entity.DataLevel = GetInt("corpid") == 0 ? 0 : 1; Tracktags.Instance.Add(entity); } Tracktags.Instance.ReloadTracktagListCache(); Response.Redirect(string.IsNullOrEmpty(FromUrl) ? "tracktagmg.aspx" : FromUrl); }
private void FillData(TracktagInfo entity) { entity.Name = txtName.Value; entity.CorporationID = GetInt("corpid"); }
public abstract void UpdateTracktag(TracktagInfo entity);
public abstract void AddTracktag(TracktagInfo entity);
public void Update(TracktagInfo entity) { CommonDataProvider.Instance().UpdateTracktag(entity); }
public override void AddTracktag(TracktagInfo entity) { string sql = @"INSERT INTO ComOpp_Tracktag( [Name] ,[CorporationID] ,[DataLevel] ,[Sort] )VALUES( @Name ,@CorporationID ,@DataLevel ,(SELECT ISNULL(MAX([Sort]),0) + 1 FROM ComOpp_Tracktag WHERE [CorporationID] = @CorporationID) )"; SqlParameter[] p = { new SqlParameter("@Name",entity.Name), new SqlParameter("@CorporationID",entity.CorporationID), new SqlParameter("@DataLevel",entity.DataLevel) }; SqlHelper.ExecuteNonQuery(_con, CommandType.Text, sql, p); }
public override void UpdateTracktag(TracktagInfo entity) { string sql = @" UPDATE ComOpp_Tracktag set Name = @Name WHERE ID=@ID"; SqlParameter[] parameters = { new SqlParameter("@ID", entity.ID), new SqlParameter("@Name", entity.Name) }; SqlHelper.ExecuteNonQuery(_con, CommandType.Text, sql, parameters); }
public void Add(TracktagInfo entity) { CommonDataProvider.Instance().AddTracktag(entity); }
public static TracktagInfo PopulateTracktagInfo(IDataReader reader) { TracktagInfo entity = new TracktagInfo() { ID = (int)reader["ID"], Name = reader["Name"] as string, DataLevel = (int)reader["DataLevel"], CorporationID = (int)reader["CorporationID"], Sort = DataConvert.SafeInt(reader["Sort"]) }; return entity; }