Example #1
0
        private void LoadTableToSetting(string table)
        {
            button2.Enabled = button3.Enabled = false;
            DataTable dt = EditCommon.LoadTableFromDB(table);

            settingList.DataSource = dt;
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> record = settingEditor1.Result;

            if (record != null && record.Count > 0)
            {
                int id = Convert.ToInt32(record["ID"]);
                record.Remove("ID");
                decimal price = Common.GetOneTerminalTypes(id).Price;
                if (Convert.ToDecimal(record["Price"]) != price)
                {
                    List <Terminals> terms = Common.GetMoreTerminals("TypeID=" + id);
                    foreach (Terminals t in terms)
                    {
                        Users u = Common.GetOneUsers(t.UserID);
                        Common.UpdateDeadline(u);
                    }
                }
                bool flag = EditCommon.UpdateRecordDB(record, "TerminalTypes", id);
                MessageBox.Show("修改数据" + (flag ? "成功" : "失败"));
                if (flag)
                {
                    LoadTableToSetting("TerminalTypes");
                }
            }
        }
Example #3
0
 private void LoadTableToSetting(string table, string where = "(1=1)")
 {
     toolStripStatusLabel1.Text = "终端载入中,请稍候 - " + Common.GetNow();
     try
     {
         button2.Enabled = button3.Enabled = false;
         DataTable dt = EditCommon.LoadTableFromDB(table, where);
         settingList.DataSource = dt;
     }
     catch { }
     finally
     {
         toolStripStatusLabel1.Text = "终端载入完毕 - " + Common.GetNow();
     }
 }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> record = settingEditor1.Result;

            if (record != null && record.Count > 0)
            {
                int id;
                record.Remove("ID");
                bool flag = EditCommon.InsertRecordDB(record, "TerminalTypes", out id);
                MessageBox.Show("添加数据" + (flag ? "成功" : "失败"));
                if (flag)
                {
                    LoadTableToSetting("TerminalTypes");
                }
            }
        }
Example #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> record = settingEditor1.Result;

            if (record != null && record.Count > 0)
            {
                int id = Convert.ToInt32(record["ID"]);
                record.Remove("ID");
                bool flag = EditCommon.UpdateRecordDB(record, "Managers", id);
                MessageBox.Show("修改数据" + (flag ? "成功" : "失败"));
                if (flag)
                {
                    LoadTableToSetting("Managers");
                }
            }
        }
Example #6
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("确定要删除该记录吗?", "删除提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
     {
         Dictionary <string, string> record = settingEditor1.Result;
         if (record != null && record.Count > 0)
         {
             int  id   = Convert.ToInt32(record["ID"]);
             bool flag = EditCommon.DeleteRecordDB("TerminalTypes", id);
             MessageBox.Show("删除数据" + (flag ? "成功" : "失败"));
             if (flag)
             {
                 LoadTableToSetting("TerminalTypes");
             }
         }
     }
 }
Example #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> record = settingEditor1.Result;

            if (record != null && record.Count > 0)
            {
                int id;
                record.Remove("ID");
                bool  flag = EditCommon.InsertRecordDB(record, "Terminals", out id);
                Users u    = Common.GetOneUsers(Convert.ToInt32(record["UserID"]));
                Common.UpdateDeadline(u);
                MessageBox.Show("添加数据" + (flag ? "成功" : "失败"));
                if (flag)
                {
                    LoadTableToSetting("Terminals");
                }
            }
        }
Example #8
0
        private void button2_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> record = settingEditor1.Result;

            if (record != null && record.Count > 0)
            {
                int id = Convert.ToInt32(record["ID"]);
                record.Remove("ID");
                DateTime deadline = Common.GetOneUsers(id).Deadline;
                if (Convert.ToDateTime(record["Deadline"]) != deadline)
                {
                    record["Deadline"] = deadline.ToString("yyyy-MM-dd HH:mm:ss");
                    MessageBox.Show("不允许手动修改用户的截止时间!");
                }
                bool flag = EditCommon.UpdateRecordDB(record, "Users", id);
                MessageBox.Show("修改数据" + (flag ? "成功" : "失败"));
                if (flag)
                {
                    LoadTableToSetting("Users");
                }
            }
        }
Example #9
0
        private void button2_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> record = settingEditor1.Result;

            if (record != null && record.Count > 0)
            {
                bool flag = false;
                int  id   = Convert.ToInt32(record["ID"]);
                record.Remove("ID");
                bool isEnable = Common.GetOneTerminals(id).IsEnable;
                if (record["IsEnable"] != (isEnable ? "1" : "0"))
                {
                    Users u = Common.GetOneUsers(Convert.ToInt32(record["UserID"]));
                    flag = Common.UpdateDeadline(u);
                    Common.UpdateKellControl(record["IP"], isEnable);
                }
                flag = EditCommon.UpdateRecordDB(record, "Terminals", id);
                MessageBox.Show("修改数据" + (flag ? "成功" : "失败"));
                if (flag)
                {
                    LoadTableToSetting("Terminals");
                }
            }
        }
Example #10
0
        private void LoadEditor(string table)
        {
            Dictionary <string, string> record = EditCommon.GetNewRecord(table);

            settingEditor1.NewSetting(record);
        }