示例#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);
        }
示例#2
0
        public string GetName(int id)
        {
            InfoSourceInfo entity = GetModel(id, true);

            if (entity == null)
            {
                return(string.Empty);
            }
            return(entity.Name);
        }
示例#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);
        }
示例#4
0
        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;
                }
            }
        }
示例#5
0
        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);
        }
示例#6
0
 public abstract void AddInfoSource(InfoSourceInfo entity);
示例#7
0
 public void Add(InfoSourceInfo entity)
 {
     CommonDataProvider.Instance().AddInfoSource(entity);
 }
示例#8
0
 public void Update(InfoSourceInfo entity)
 {
     CommonDataProvider.Instance().UpdateInfoSource(entity);
 }
示例#9
0
 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);
 }
示例#10
0
 public abstract void AddInfoSource(InfoSourceInfo entity);
示例#11
0
 public void Add(InfoSourceInfo entity)
 {
     CommonDataProvider.Instance().AddInfoSource(entity);
 }
示例#12
0
 public void Update(InfoSourceInfo entity)
 {
     CommonDataProvider.Instance().UpdateInfoSource(entity);
 }
示例#13
0
 private void FillData(InfoSourceInfo entity)
 {
     entity.Name = txtName.Value;
     entity.CorporationID = GetInt("corpid");
 }
示例#14
0
 public abstract void UpdateInfoSource(InfoSourceInfo entity);
示例#15
0
 public abstract void UpdateInfoSource(InfoSourceInfo entity);
示例#16
0
 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);
 }
示例#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;
        }