示例#1
0
        private void LoadData()
        {
            int id = GetInt("id");
            if (id > 0)
            {
                CurrentModule = Modules.Instance.GetModel(id, true);

                txtModuleName.Value = CurrentModule.ModuleName;
                txtParentName.Value = CurrentModule.ParentName;
            }
        }
示例#2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ModuleInfo entity = new ModuleInfo();
            int id = GetInt("id");
            if (id > 0) entity = Modules.Instance.GetModel(id, true);
            FillData(entity);

            if (id > 0) Modules.Instance.Update(entity);
            else Modules.Instance.Add(entity);

            Modules.Instance.ReloadModuleListCache();
            Response.Redirect("modulemg.aspx");
        }
示例#3
0
 public override void AddModule(ModuleInfo entity)
 {
     string sql = @"INSERT INTO ComOpp_Module(
         [ModuleName]
         ,[ParentName]
         ,[Sort]
     )VALUES(
         @ModuleName
         ,@ParentName
         ,(SELECT ISNULL(MAX([Sort]),0) + 1 FROM ComOpp_Module)
     )";
     SqlParameter[] p =
     {
         new SqlParameter("@ModuleName",entity.ModuleName),
         new SqlParameter("@ParentName",entity.ParentName)
     };
     SqlHelper.ExecuteNonQuery(_con, CommandType.Text, sql, p);
 }
示例#4
0
 public override void UpdateModule(ModuleInfo entity)
 {
     string sql = @"
     UPDATE ComOpp_Module set
         ModuleName = @ModuleName
         ,ParentName = @ParentName
     WHERE ID=@ID";
     SqlParameter[] parameters =
     {
         new SqlParameter("@ID", entity.ID),
         new SqlParameter("@ModuleName", entity.ModuleName),
         new SqlParameter("@ParentName", entity.ParentName)
     };
     SqlHelper.ExecuteNonQuery(_con, CommandType.Text, sql, parameters);
 }
示例#5
0
 private void FillData(ModuleInfo entity)
 {
     entity.ModuleName = txtModuleName.Value;
     entity.ParentName = txtParentName.Value;
 }
示例#6
0
 public void Update(ModuleInfo entity)
 {
     CommonDataProvider.Instance().UpdateModule(entity);
 }
示例#7
0
 public void Add(ModuleInfo entity)
 {
     CommonDataProvider.Instance().AddModule(entity);
 }
示例#8
0
 public abstract void UpdateModule(ModuleInfo entity);
示例#9
0
 public abstract void AddModule(ModuleInfo entity);
示例#10
0
        public static ModuleInfo PopulateModuleInfo(IDataReader reader)
        {
            ModuleInfo entity = new ModuleInfo()
            {
                ID = (int)reader["ID"],
                ModuleName = reader["ModuleName"] as string,
                ParentName = reader["ParentName"] as string,
                Sort = DataConvert.SafeInt(reader["Sort"])
            };

            return entity;
        }