Beispiel #1
0
        public InfoSourceInfo GetModel(int id, bool fromCache = false)
        {
            InfoSourceInfo entity = null;

            List <InfoSourceInfo> list = GetList(fromCache);

            entity = list.Find(c => c.ID == id);

            return(entity);
        }
Beispiel #2
0
        public string GetName(int id)
        {
            InfoSourceInfo entity = GetModel(id, true);

            if (entity == null)
            {
                return(string.Empty);
            }
            return(entity.Name);
        }
Beispiel #3
0
        public static InfoSourceInfo PopulateInfoSourceInfo(IDataReader reader)
        {
            InfoSourceInfo entity = new InfoSourceInfo()
            {
                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)
            {
                CurrentInfoSource = InfoSources.Instance.GetModel(id);
                if (CurrentInfoSource == null)
                    WriteMessage("/message.aspx", "系统提示", "无效信息来源!", "", "/index.aspx");
                else
                {
                    if (!Admin.Administrator && Admin.CorporationID != CurrentInfoSource.CorporationID)
                        WriteMessage("/message.aspx", "系统提示", "没有权限!", "", "/index.aspx");
                    if (!Admin.Administrator && CurrentInfoSource.DataLevel == 0)
                        WriteMessage("/message.aspx", "系统提示", "没有权限!", "", "/index.aspx");

                    txtName.Value = CurrentInfoSource.Name;
                }
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            InfoSourceInfo entity = new InfoSourceInfo();
            int id = GetInt("id");

            if (id > 0)
            {
                entity = InfoSources.Instance.GetModel(id, true);
                FillData(entity);
                InfoSources.Instance.Update(entity);
            }
            else
            {
                FillData(entity);
                entity.DataLevel = GetInt("corpid") == 0 ? 0 : 1;
                InfoSources.Instance.Add(entity);
            }

            InfoSources.Instance.ReloadInfoSourceListCache();

            Response.Redirect(string.IsNullOrEmpty(FromUrl) ? "infotypemg.aspx" : FromUrl);
        }
Beispiel #6
0
 public abstract void AddInfoSource(InfoSourceInfo entity);
Beispiel #7
0
 public void Add(InfoSourceInfo entity)
 {
     CommonDataProvider.Instance().AddInfoSource(entity);
 }
Beispiel #8
0
 public void Update(InfoSourceInfo entity)
 {
     CommonDataProvider.Instance().UpdateInfoSource(entity);
 }
 public override void AddInfoSource(InfoSourceInfo entity)
 {
     string sql = @"INSERT INTO ComOpp_InfoSource(
         [Name]
         ,[CorporationID]
         ,[DataLevel]
         ,[Sort]
     )VALUES(
         @Name
         ,@CorporationID
         ,@DataLevel
         ,(SELECT ISNULL(MAX([Sort]),0) + 1 FROM ComOpp_InfoSource 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);
 }
Beispiel #10
0
 public abstract void AddInfoSource(InfoSourceInfo entity);
Beispiel #11
0
 public void Add(InfoSourceInfo entity)
 {
     CommonDataProvider.Instance().AddInfoSource(entity);
 }
Beispiel #12
0
 public void Update(InfoSourceInfo entity)
 {
     CommonDataProvider.Instance().UpdateInfoSource(entity);
 }
Beispiel #13
0
 private void FillData(InfoSourceInfo entity)
 {
     entity.Name = txtName.Value;
     entity.CorporationID = GetInt("corpid");
 }
Beispiel #14
0
 public abstract void UpdateInfoSource(InfoSourceInfo entity);
Beispiel #15
0
 public abstract void UpdateInfoSource(InfoSourceInfo entity);
 public override void UpdateInfoSource(InfoSourceInfo entity)
 {
     string sql = @"
     UPDATE ComOpp_InfoSource 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);
 }
Beispiel #17
0
        public static InfoSourceInfo PopulateInfoSourceInfo(IDataReader reader)
        {
            InfoSourceInfo entity = new InfoSourceInfo()
            {
                ID = (int)reader["ID"],
                Name = reader["Name"] as string,
                DataLevel = (int)reader["DataLevel"],
                CorporationID = (int)reader["CorporationID"],
                Sort = DataConvert.SafeInt(reader["Sort"])
            };

            return entity;
        }