Example #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;
            }
        }
Example #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");
        }
 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);
 }
 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);
 }
Example #5
0
 private void FillData(ModuleInfo entity)
 {
     entity.ModuleName = txtModuleName.Value;
     entity.ParentName = txtParentName.Value;
 }
Example #6
0
 public void Update(ModuleInfo entity)
 {
     CommonDataProvider.Instance().UpdateModule(entity);
 }
Example #7
0
 public void Add(ModuleInfo entity)
 {
     CommonDataProvider.Instance().AddModule(entity);
 }
Example #8
0
 public abstract void UpdateModule(ModuleInfo entity);
Example #9
0
 public abstract void AddModule(ModuleInfo entity);
Example #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;
        }