protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ddlCategory.SelectedValue != "0")
        {
            SystemConfigInfo info = new SystemConfigInfo();
            info.sc_Class = ddlCategory.SelectedValue;
            info.sc_Name  = txtName.Text;
            info.sc_Value = rbShow.SelectedValue;
            info.sc_Desc  = txtdetail.Text;

            if (SystemConfigBLL.getDataByClassWithName(info.sc_Class, info.sc_Name) == string.Empty)
            {
                if (scBLL.Insert(info) > 0)
                {
                    ShowMessage("新增功能控制項:" + txtName.Text + " 成功");
                }
            }
            else
            {
                ShowMessage("資料表中已有此類別與功能紀錄");
            }
        }
        else
        {
            ShowMessage("請選擇主項目");
        }
    }
示例#2
0
 public async Task <IHttpActionResult> Put(SystemConfigInfo info)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     info.UpdateTime = DateTime.Now;
     GlobalApplicationObject.Current.ApplicationContext.ConfigManager.SaveConfig <SystemConfigInfo>(info);
     return(Ok(info));
 }
示例#3
0
        public async Task <IHttpActionResult> Post(SystemConfigInfo info)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            info.UpdateTime = DateTime.Now;

            ApplicationContext.ConfigManager.SaveConfig <SystemConfigInfo>(info);
            return(Created <SystemConfigInfo>("api/config/SystemConfigInfo", info));
        }
示例#4
0
        public SystemConfigInfo getAll(int id)
        {
            SystemConfigInfo info   = new SystemConfigInfo();
            IDataReader      reader = db.GetDataById(id).CreateDataReader();

            while (reader.Read())
            {
                info = SystemConfigInfo.Populate(reader);
            }
            return(info);
        }
示例#5
0
        public List <SystemConfigInfo> GetDataSelectDistinctOrderClass()
        {
            List <SystemConfigInfo> infos  = new List <SystemConfigInfo>();
            IDataReader             reader = db.GetDataSelectDistinctOrderClass().CreateDataReader();

            while (reader.Read())
            {
                infos.Add(SystemConfigInfo.Populate(reader));
            }
            return(infos);
        }
示例#6
0
        public List <SystemConfigInfo> getAll()
        {
            List <SystemConfigInfo> infos  = new List <SystemConfigInfo>();
            IDataReader             reader = db.GetData().CreateDataReader();

            while (reader.Read())
            {
                infos.Add(SystemConfigInfo.Populate(reader));
            }
            return(infos);
        }
示例#7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SystemConfigInfo DataRowToModel(DataRow row)
        {
            var model = new SystemConfigInfo();

            if (row != null)
            {
                if (row["id"] != null && row["id"].ToString() != "")
                {
                    model.id = int.Parse(row["id"].ToString());
                }
                if (row["sysCode"] != null)
                {
                    model.sysCode = row["sysCode"].ToString();
                }
                if (row["sysName"] != null)
                {
                    model.sysName = row["sysName"].ToString();
                }
                if (row["sysValue"] != null)
                {
                    model.sysValue = row["sysValue"].ToString();
                }
                if (row["sysTypeId"] != null && row["sysTypeId"].ToString() != "")
                {
                    model.sysTypeId = int.Parse(row["sysTypeId"].ToString());
                }
                if (row["sysTypeName"] != null)
                {
                    model.sysTypeName = row["sysTypeName"].ToString();
                }
                if (row["createDate"] != null && row["createDate"].ToString() != "")
                {
                    model.createDate = DateTime.Parse(row["createDate"].ToString());
                }
                if (row["parentId"] != null && row["parentId"].ToString() != "")
                {
                    model.parentId = int.Parse(row["parentId"].ToString());
                }
                if (row["remark"] != null)
                {
                    model.remark = row["remark"].ToString();
                }
                if (row["sort_id"] != null && row["sort_id"].ToString() != "")
                {
                    model.sort_id = int.Parse(row["sort_id"].ToString());
                }
            }
            return(model);
        }
示例#8
0
        public static string getDataByClassWithName(string className, string name)
        {
            SystemConfigTableAdapter db = new SystemConfigTableAdapter();
            string           result     = "";
            IDataReader      reader     = db.GetDataByClassWithName(className, name).CreateDataReader();
            SystemConfigInfo info       = new SystemConfigInfo();

            while (reader.Read())
            {
                info = SystemConfigInfo.Populate(reader);
            }
            if (info.sc_Id != 0)
            {
                result = info.sc_Value;
            }
            return(result);
        }
示例#9
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <SystemConfigInfo> DataTableToList(DataTable dt)
        {
            var modelList = new List <SystemConfigInfo>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                SystemConfigInfo model = null;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = this._repository.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return(modelList);
        }
示例#10
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        bool isEdit = false;

        foreach (RepeaterItem item in RepeaterSysConfig.Items)
        {
            CheckBox ckSelect = (CheckBox)item.FindControl("ckSelect");
            if (ckSelect.Checked)
            {
                Literal          lId  = (Literal)item.FindControl("lId");
                int              id   = int.Parse(lId.Text);
                SystemConfigInfo info = sysConfigBLL.getAll(id);

                TextBox txtClass = (TextBox)item.FindControl("txtCalss");
                TextBox txtName  = (TextBox)item.FindControl("txtName");
                TextBox txtValue = (TextBox)item.FindControl("txtValue");
                TextBox txtDesc  = (TextBox)item.FindControl("txtDesc");

                info.sc_Class = txtClass.Text;
                info.sc_Name  = txtName.Text;
                info.sc_Value = txtValue.Text;
                info.sc_Desc  = txtDesc.Text;

                if (sysConfigBLL.Update(info) > 0)
                {
                    isEdit = true;
                }
            }
        }
        if (isEdit)
        {
            Tools.Show(this.Page, "修改完成!");
        }
        else
        {
            Tools.Show(this.Page, "修改失敗");
        }
        Bind();
    }
示例#11
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int checkcount = 0;

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            HiddenField      hi_Id        = (HiddenField)GridView1.Rows[i].FindControl("HiddenField_Id");
            CheckBox         chkvalue     = (CheckBox)GridView1.Rows[i].FindControl("chk_value");
            TextBox          TextBox_Desc = (TextBox)GridView1.Rows[i].FindControl("TextBox_Desc");
            SystemConfigInfo info         = scBLL.getAll(int.Parse(hi_Id.Value));
            if (info.sc_Id != 0)
            {
                info.sc_Admin = uid;
                info.sc_Desc  = TextBox_Desc.Text;
                info.sc_Value = chkvalue.Checked.ToString().ToLower();
                if (scBLL.Update(info) > 0)
                {
                    checkcount++;
                }
            }
        }
        ShowMessage("資料 " + checkcount + " 筆: 修改成功");
    }
示例#12
0
        static void CreateTestData_SystemConfig()
        {
            StreamReader fileStream = new StreamReader(@"D:\TempCode\Console\ConsoleAppSqlite\ConsoleAppSqlite\file\福利待遇.txt", Encoding.Default);
            var          data       = fileStream.ReadToEnd();
            var          repo       = new Repository <SystemConfigInfo>();
            var          info       = new SystemConfigInfo()
            {
                Code  = SystemKey.WelfareKey,
                Name  = "福利待遇",
                Value = data
            };

            repo.Insert(info);
            fileStream.Close();

            info = new SystemConfigInfo()
            {
                Code  = SystemKey.Logo,
                Name  = "logo",
                Value = "/images/logo.png"
            };
            repo.Insert(info);

            List <string> qr = new List <string>();

            qr.Add("/images/QRCode/QRCode-筑加网.jpg");
            qr.Add("/images/QRCode/QRCode-筑加网.jpg");
            var value = Newtonsoft.Json.JsonConvert.SerializeObject(qr);

            info = new SystemConfigInfo()
            {
                Code  = SystemKey.QRCode,
                Name  = "QRCode",
                Value = value
            };
            repo.Insert(info);
        }
示例#13
0
 public int Update(SystemConfigInfo info)
 {
     return(db.Update(info.sc_Class, info.sc_Name, info.sc_Value, info.sc_DefaultValue, info.sc_Desc, info.sc_Admin, info.sc_enable, info.sc_adminenable, info.sc_ts, info.sc_Id));
 }
示例#14
0
 public int Insert(SystemConfigInfo info)
 {
     return(db.Insert(info.sc_Class, info.sc_Name, info.sc_Value, info.sc_DefaultValue, info.sc_Desc, info.sc_Admin, info.sc_enable, info.sc_adminenable, info.sc_ts));
 }