Пример #1
0
        public string GetName(int id)
        {
            TracktagInfo entity = GetModel(id, true);

            if (entity == null)
            {
                return(string.Empty);
            }
            return(entity.Name);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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;
                }
            }
        }
Пример #5
0
        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);
        }
Пример #6
0
 private void FillData(TracktagInfo entity)
 {
     entity.Name = txtName.Value;
     entity.CorporationID = GetInt("corpid");
 }
Пример #7
0
 public abstract void UpdateTracktag(TracktagInfo entity);
Пример #8
0
 public abstract void AddTracktag(TracktagInfo entity);
Пример #9
0
 public abstract void AddTracktag(TracktagInfo entity);
Пример #10
0
 public void Update(TracktagInfo entity)
 {
     CommonDataProvider.Instance().UpdateTracktag(entity);
 }
Пример #11
0
 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);
 }
Пример #12
0
 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);
 }
Пример #13
0
 public abstract void UpdateTracktag(TracktagInfo entity);
Пример #14
0
 public void Update(TracktagInfo entity)
 {
     CommonDataProvider.Instance().UpdateTracktag(entity);
 }
Пример #15
0
 public void Add(TracktagInfo entity)
 {
     CommonDataProvider.Instance().AddTracktag(entity);
 }
Пример #16
0
 public void Add(TracktagInfo entity)
 {
     CommonDataProvider.Instance().AddTracktag(entity);
 }
Пример #17
0
        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;
        }