Exemplo n.º 1
0
        private void okBtn_Click(object sender, EventArgs e)
        {
            mode.shop  = shopTxt.Text;
            mode.phone = phoneTxt.Text;
            mode.money = moneyTxt.Text;
            mode.time  = DateTime.Parse(timeTxt.Text);
            mode.mark  = markTxt.Text;

            if (act == "新增")
            {
                if (YctOrm.insertYctMode(mode) == 1)
                {
                    Const.info = "添加成功! " + Const.info;
                }
                else
                {
                    Const.info = "添加失败!" + Const.info;
                }
            }
            else
            {
                if (YctOrm.updateYctMode(mode) == 1)
                {
                    Const.info = "修改成功! " + Const.info;
                }
                else
                {
                    Const.info = "修改失败!" + Const.info;
                }
            }

            this.Close();
            this.Dispose();
        }
Exemplo n.º 2
0
        private void searchBtn_Click(object sender, EventArgs e)
        {
            string sql = "select [id] as 编号,[shop] as 商户,[phone] as 电话,[money] as 金额,[time] as 时间, [mark] as 备注 from yct ";

            if (startTimeTxt.Text != "" || endTimeTxt.Text != "")
            {
                sql += " where ";
                if (startTimeTxt.Text != "")
                {
                    sql += " [time] > #" + startTimeTxt.Text + "#";
                    if (endTimeTxt.Text != "")
                    {
                        sql += " and [time] < #" + endTimeTxt.Text + "#";
                    }
                }
                else if (endTimeTxt.Text != "")
                {
                    sql += " [time] < #" + endTimeTxt.Text + "#";
                }
            }

            DataTable dt = YctOrm.getDataTable(sql);

            dataGridView.DataSource = dt;
            showStatus(Const.info);
        }
Exemplo n.º 3
0
        public static bool logIn(string usr, string pwd)
        {
            usr = usr.Replace("'", "__").Replace("◇", "'");
            pwd = pwd.Replace("'", "__").Replace("◇", "'");
            string sql = "select * from log where [user] = '" + usr + "' and [pwd] = '" + pwd + "'";

            logOk = false;
            if (YctOrm.getRsCount(sql) > 0)
            {
                logOk = true;
            }

            return(logOk);
        }
Exemplo n.º 4
0
        public static void updatePwd(string usr, string pwd)
        {
            usr = usr.Replace("'", "__").Replace("◇", "'");
            pwd = pwd.Replace("'", "__").Replace("◇", "'");

            string sql = "update log set [pwd] = '" + pwd + "', [time] = #" + DateTime.Now.ToString() + "# where [user] = '" + usr + "'";

            if (YctOrm.exeSql(sql) > 0)
            {
                Const.info = "修改密码成功";
            }
            else
            {
                Const.info = "修改密码失败";
            }
        }
Exemplo n.º 5
0
        public static void insertPwd(string usr, string pwd)
        {
            usr = usr.Replace("'", "__").Replace("◇", "'");
            pwd = pwd.Replace("'", "__").Replace("◇", "'");

            string sql = "insert into log([user], [pwd], [time]) values('" + usr + "','" + pwd + "',#" + DateTime.Now.ToString() + "#)";

            if (YctOrm.exeSql(sql) > 0)
            {
                Const.info = "新增用户成功";
            }
            else
            {
                Const.info = "新增用户失败";
            }
        }
Exemplo n.º 6
0
        private void delToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("删除后不可恢复,确定删除?", "删除提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
            {
                YctMode mode = getModeFromNowRow();
                if (mode == null)
                {
                    MessageBox.Show("请选中一行进行删除操作。");
                    return;
                }

                string sql = "delete * from yct where id = " + mode.id;
                YctOrm.exeSql(sql);
                showStatus(Const.info);
            }
        }