Ejemplo n.º 1
0
 // Token: 0x06000428 RID: 1064 RVA: 0x0003D918 File Offset: 0x0003BB18
 private ConsumeCardEntity parseCard(bool beep)
 {
     if (this.parentForm != null)
     {
         uint[] array = this.parentForm.readCard(beep);
         if (array != null && this.parentForm.getCardType(array[0]) == 1U)
         {
             if (this.parentForm.getCardAreaId(array[0]).CompareTo(ConvertUtils.ToUInt32(this.areaId, 10)) != 0)
             {
                 WMMessageBox.Show(this, "区域ID不匹配!");
                 return(null);
             }
             ConsumeCardEntity consumeCardEntity = new ConsumeCardEntity();
             consumeCardEntity.parseEntity(array);
             DbUtil dbUtil = new DbUtil();
             dbUtil.AddParameter("userId", ConvertUtils.ToInt64(consumeCardEntity.UserId).ToString());
             DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM cardData WHERE userId=@userId");
             if (dataRow != null && (ulong)this.parentForm.getCardID() != (ulong)(Convert.ToInt64(dataRow[2])))
             {
                 WMMessageBox.Show(this, "此卡为挂失卡或者其他用户卡!");
                 return(null);
             }
             return(consumeCardEntity);
         }
         else if (array != null)
         {
             WMMessageBox.Show(this, "此卡为其他卡片类型!");
         }
     }
     return(null);
 }
 // Token: 0x060001A5 RID: 421 RVA: 0x0000629C File Offset: 0x0000449C
 private void resetDisplay(DataRow dr)
 {
     if (dr != null)
     {
         this.nameTB.Text            = dr["username"].ToString();
         this.phoneNumTB.Text        = dr["phoneNum"].ToString();
         this.identityCardNumTB.Text = dr["identityId"].ToString();
         this.addressTB.Text         = dr["address"].ToString();
         this.userAreaNumTB.Text     = dr["userArea"].ToString();
         this.usrePersonsTB.Text     = dr["userPersons"].ToString();
         string value  = dr["userTypeId"].ToString();
         string value2 = dr["userPriceConsistId"].ToString();
         DbUtil dbUtil = new DbUtil();
         dbUtil.AddParameter("userTypeId", value);
         DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM userTypeTable WHERE typeId=@userTypeId");
         if (dataRow != null)
         {
             string value3 = dataRow["userType"].ToString();
             SettingsUtils.displaySelectRow(this.userTypeCB, value3);
         }
         dbUtil.AddParameter("priceConsistId", value2);
         dataRow = dbUtil.ExecuteRow("SELECT * FROM priceConsistTable WHERE priceConsistId=@priceConsistId");
         if (dataRow != null)
         {
             string value4 = dataRow["priceConstistName"].ToString();
             SettingsUtils.displaySelectRow(this.priceTypeCB, value4);
             return;
         }
     }
     else
     {
         this.nameTB.Text            = "";
         this.phoneNumTB.Text        = "";
         this.identityCardNumTB.Text = "";
         this.addressTB.Text         = "";
         this.userAreaNumTB.Text     = "";
         this.usrePersonsTB.Text     = "";
         if (this.userTypeCB.SelectedIndex > 0)
         {
             this.userTypeCB.SelectedIndex = 0;
         }
         if (this.priceTypeCB.SelectedIndex > 0)
         {
             this.priceTypeCB.SelectedIndex = 0;
         }
     }
 }
Ejemplo n.º 3
0
        private void label4_Click_1(object sender, EventArgs e)
        {
            this.ReaderOk = true;
            ConsumeCardEntity consumeCardEntity = this.parseCard(true);

            if (consumeCardEntity != null)
            {
                if (!this.checkOtherStatus(consumeCardEntity))
                {
                    return;
                }
                DbUtil db = new DbUtil();
                db.AddParameter("userId", string.Concat(consumeCardEntity.UserId));
                DataRow dataRow = db.ExecuteRow("SELECT * FROM metersTable WHERE meterId=@userId");
                this.meters = dataRow;
                if (dataRow == null)
                {
                    WMMessageBox.Show(this, "没有找到相应的表信息!");
                    this.ReaderOk = false;
                    return;
                }
                db.AddParameter("permanentUserId", dataRow["permanentUserId"].ToString());
                DataRow dataRow2 = db.ExecuteRow("SELECT * FROM usersTable WHERE permanentUserId=@permanentUserId");
                this.users = dataRow2;
                if (dataRow2 == null)
                {
                    WMMessageBox.Show(this, "没有找到相应的用户信息!");
                    this.ReaderOk = false;
                    return;
                }
                if (dataRow2["isActive"].ToString() == "2")
                {
                    WMMessageBox.Show(this, "用户为注销状态,无法操作!");
                    this.ReaderOk = false;
                    return;
                }
                if (this.ReaderOk)
                {
                    MainForm main = new MainForm();
                    main.setWelcomeForm(this);
                    main.initData(this.meters, this.users, this.cardData, this.setting, this.arrayReadCard);
                    main.ShowDialog(this);
                }
            }
        }
Ejemplo n.º 4
0
        // Token: 0x06000383 RID: 899 RVA: 0x00028824 File Offset: 0x00026A24
        public void queryDB(Dictionary <string, QueryValue> dicts)
        {
            if (this.qb == null || dicts == null || dicts.Count < 0)
            {
                return;
            }
            string   text      = this.getSqlStr(dicts);
            DbUtil   dbUtil    = new DbUtil();
            TimeSpan timeSpan  = this.qb.getStartDT() - WMConstant.DT1970;
            TimeSpan timeSpan2 = this.qb.getEndDT() - WMConstant.DT1970;

            dbUtil.AddParameter("createTimeStart", string.Concat(timeSpan.TotalSeconds));
            dbUtil.AddParameter("createTimeEnd", string.Concat(timeSpan2.TotalSeconds));
            string sqlKeys = this.getQueryConditionEntitys()[5].SqlKeys;

            foreach (string text2 in dicts.Keys)
            {
                QueryValue queryValue = dicts[text2];
                if (text2 == sqlKeys)
                {
                    string text3;
                    if ((queryValue.Value.Equals(this.BalanceStatusList.ElementAt(0)) && queryValue.Oper.Equals("=")) || (queryValue.Value.Equals(this.BalanceStatusList.ElementAt(1)) && queryValue.Oper.Equals("<>")))
                    {
                        text3 = "userBalance like '-%'";
                    }
                    else
                    {
                        text3 = "userBalance not like '-%'";
                    }
                    dbUtil.AddParameter(text2, "'-%'");
                    text = ((text == "") ? text3 : (text + " AND " + text3));
                }
                else
                {
                    dbUtil.AddParameter(text2, queryValue.Value);
                }
            }
            DataTable dt = dbUtil.ExecuteQuery("SELECT * FROM usersTable WHERE " + ((text == "") ? "" : ("(" + text + ") AND ")) + "createTime>=@createTimeStart AND createTime<=@createTimeEnd ORDER BY createTime ASC");

            this.qb.initDGV(this.initDGV(dt));
        }
Ejemplo n.º 5
0
        // Token: 0x060004ED RID: 1261 RVA: 0x00050E6C File Offset: 0x0004F06C
        private void staffMdifyEnterBtn_Click(object sender, EventArgs e)
        {
            if (this.staffModifyStaffIdTB.Text == "" || this.staffModifyStaffPwdTB.Text == "" || this.staffModifyStaffRePwdTB.Text == "")
            {
                WMMessageBox.Show(this, "请输入所有信息!");
                return;
            }
            if (this.staffModifyStaffPwdTB.Text != this.staffModifyStaffRePwdTB.Text)
            {
                WMMessageBox.Show(this, "请检查确认密码,确保两次输入相同!");
                return;
            }
            DbUtil dbUtil = new DbUtil();

            dbUtil.AddParameter("staffId", this.staffModifyStaffIdTB.Text);
            DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM staffTable WHERE staffId=@staffId");

            if (dataRow == null)
            {
                WMMessageBox.Show(this, "该员工ID不存在!");
                return;
            }
            if (Convert.ToInt64(dataRow[1]) != 0L)
            {
                WMMessageBox.Show(this, "该员工账号为注销或停用状态!");
                return;
            }
            dbUtil.AddParameter("staffId", this.staffModifyStaffIdTB.Text);
            string md = SettingsUtils.GetMD5(this.staffModifyStaffRePwdTB.Text.Trim());

            dbUtil.AddParameter("staffPwd", md);
            if (WMMessageBox.Show(this, "是否重置员工" + dataRow[3] + "的登录密码?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                int num = dbUtil.ExecuteNonQuery("UPDATE staffTable SET staffPwd=@staffPwd WHERE staffId=@staffId");
                if (num > 0)
                {
                    WMMessageBox.Show(this, "密码修改成功!");
                }
            }
        }
Ejemplo n.º 6
0
        // Token: 0x060001DE RID: 478 RVA: 0x0000A20C File Offset: 0x0000840C
        public DataRow querySettings()
        {
            DbUtil dbUtil = new DbUtil();

            dbUtil.AddParameter("key", "1");
            string    queryStr  = "select * from settings where `key`=@key";
            DataTable dataTable = dbUtil.ExecuteQuery(queryStr);

            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                return(dataTable.Rows[0]);
            }
            return(null);
        }
Ejemplo n.º 7
0
        // Token: 0x060001DF RID: 479 RVA: 0x0000A25C File Offset: 0x0000845C
        public DataRow queryUser(string key, string value)
        {
            DbUtil dbUtil = new DbUtil();

            dbUtil.AddParameter(key, value ?? "");
            string    queryStr  = "SELECT * FROM usersTable where " + key + "=@" + key;
            DataTable dataTable = dbUtil.ExecuteQuery(queryStr);

            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                return(dataTable.Rows[0]);
            }
            return(null);
        }
Ejemplo n.º 8
0
        private void button1_Click(object sender, EventArgs e)
        {
            string acc = this.textBox1.Text;

            if (acc == "")
            {
                WMMessageBox.Show(this, "请输入员工号!");
                return;
            }
            string pwd = this.textBox2.Text;

            if (pwd == "")
            {
                WMMessageBox.Show(this, "请输入密码!");
                return;
            }

            DbUtil dbUtil = new DbUtil();

            dbUtil.AddParameter("userId", acc);
            DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM staffTable WHERE staffId=@userId");

            if (dataRow == null)
            {
                this.messageHintLabel.Visible = true;
                this.messageHintLabel.Text    = "员工号不存在!";
                return;
            }
            long num = Convert.ToInt64(dataRow[1]);

            if (num != 0L)
            {
                this.messageHintLabel.Visible = true;
                this.messageHintLabel.Text    = "员工号为" + WMConstant.StaffStatusList[(int)(checked ((IntPtr)num))] + "状态!";
                return;
            }
            string a  = dataRow[8].ToString();
            string md = SettingsUtils.GetMD5(pwd);

            if (a != md)
            {
                this.messageHintLabel.Visible = true;
                this.messageHintLabel.Text    = "员工号或密码错误!";
                return;
            }

            Program.loginSign = 1;
            Program.staffId   = acc;
            this.Close();
        }
        // Token: 0x060001A8 RID: 424 RVA: 0x00006660 File Offset: 0x00004860
        private void loadAllRegisterDGV()
        {
            DateTime now = DateTime.Now;
            long     num = ConvertUtils.ToInt64((now - CreateUserInNumbersForm.DT1970).TotalSeconds);

            if (this.firstCreateTime != 0L)
            {
                num = this.firstCreateTime;
            }
            DbUtil dbUtil = new DbUtil();

            dbUtil.AddParameter("createTime", string.Concat(num));
            DataTable dataTable  = dbUtil.ExecuteQuery("SELECT * FROM usersTable WHERE createTime >= @createTime ORDER BY createTime ASC");
            DataTable dataTable2 = new DataTable();

            dataTable2.Columns.AddRange(new DataColumn[]
            {
                new DataColumn("设备号"),
                new DataColumn("永久编号"),
                new DataColumn("用户姓名"),
                new DataColumn("证件号"),
                new DataColumn("联系方式"),
                new DataColumn("地址"),
                new DataColumn("人口数"),
                new DataColumn("用户面积"),
                new DataColumn("状态"),
                new DataColumn("操作员")
            });
            if (dataTable != null)
            {
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    DataRow dataRow = dataTable.Rows[i];
                    dataTable2.Rows.Add(new object[]
                    {
                        Convert.ToInt64(dataRow["userId"]),
                        Convert.ToInt64(dataRow["permanentUserId"]),
                        dataRow["username"].ToString(),
                        dataRow["identityId"].ToString(),
                        dataRow["phoneNum"].ToString(),
                        dataRow["address"].ToString(),
                        Convert.ToInt64(dataRow["userPersons"]),
                        dataRow["userArea"].ToString(),
                        WMConstant.UserStatesList[(int)(checked ((IntPtr)(Convert.ToInt64(dataRow["isActive"]))))],
                        dataRow["operator"].ToString()
                    });
                }
            }
            this.allRegisterDGV.DataSource = dataTable2;
        }
        // Token: 0x060001AC RID: 428 RVA: 0x00006CB8 File Offset: 0x00004EB8
        private void createUserInNumberModifyBtn_Click(object sender, EventArgs e)
        {
            this.isModifyData = true;
            DataGridViewRow currentRow = this.allRegisterDGV.CurrentRow;

            if (currentRow != null)
            {
                string value  = (string)currentRow.Cells[0].Value;
                DbUtil dbUtil = new DbUtil();
                dbUtil.AddParameter("userId", value);
                DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM usersTable WHERE userId=@userId");
                if (dataRow != null)
                {
                    this.originIndenty  = dataRow["identityId"].ToString();
                    this.userIdModified = value;
                    this.resetDisplay(dataRow);
                }
            }
        }
Ejemplo n.º 11
0
        // Token: 0x060001CA RID: 458 RVA: 0x0000874C File Offset: 0x0000694C
        private void loginEnterBtn_Click(object sender, EventArgs e)
        {
            if (this.loginUserNameTB.Text.Trim() == "")
            {
                this.messageHintLabel.Visible = true;
                this.messageHintLabel.Text    = "请输入员工号!";
                return;
            }
            DbUtil dbUtil = new DbUtil();

            dbUtil.AddParameter("userId", this.loginUserNameTB.Text.Trim());
            DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM staffTable WHERE staffId=@userId");

            if (dataRow == null)
            {
                this.messageHintLabel.Visible = true;
                this.messageHintLabel.Text    = "员工号不存在!";
                return;
            }
            long num = Convert.ToInt64(dataRow[1]);

            if (num != 0L)
            {
                this.messageHintLabel.Visible = true;
                this.messageHintLabel.Text    = "员工号为" + WMConstant.StaffStatusList[(int)(checked ((IntPtr)num))] + "状态!";
                return;
            }
            string a  = dataRow[8].ToString();
            string md = SettingsUtils.GetMD5(this.loginPwdTB.Text.Trim());

            if (a != md)
            {
                this.messageHintLabel.Visible = true;
                this.messageHintLabel.Text    = "员工号或密码错误!";
                return;
            }
            if (this.form != null)
            {
                this.form.setStaffId(this.loginUserNameTB.Text.Trim());
            }
            base.Close();
        }
        // Token: 0x060001AA RID: 426 RVA: 0x00006944 File Offset: 0x00004B44
        private void createUserInNumberAddBtn_Click(object sender, EventArgs e)
        {
            if (this.identityCardNumTB.Text.Trim() == "")
            {
                WMMessageBox.Show(this, "请输入用户证件号!");
                return;
            }
            if (this.nameTB.Text.Trim() == "")
            {
                WMMessageBox.Show(this, "请输入用户名!");
                return;
            }
            if (this.phoneNumTB.Text.Trim() == "")
            {
                WMMessageBox.Show(this, "请输入用户联系方式!");
                return;
            }
            if (this.userAreaNumTB.Text.Trim() == "")
            {
                WMMessageBox.Show(this, "请输入用户面积!");
                return;
            }
            string text = this.identityCardNumTB.Text.Trim();

            if ((this.isModifyData && this.originIndenty != text) || !this.isModifyData)
            {
                DbUtil dbUtil = new DbUtil();
                dbUtil.AddParameter("identityId", text);
                DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM usersTable WHERE identityId=@identityId");
                if (dataRow != null && WMMessageBox.Show(this, "该用户证件号已开户,是否继续添加?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
                {
                    return;
                }
            }
            this.insertOrUpdateUser(!this.isModifyData);
            this.isModifyData   = false;
            this.originIndenty  = "";
            this.userIdModified = "";
            this.loadAllRegisterDGV();
        }
Ejemplo n.º 13
0
        // Token: 0x0600028A RID: 650 RVA: 0x00015AB4 File Offset: 0x00013CB4
        private void registerBtn_Click(object sender, EventArgs e)
        {
            string text = this.registerStringTB.Text.Trim();

            if (text == "")
            {
                WMMessageBox.Show(this, "请输入注册序号!");
                return;
            }
            if (!RegisterUtil.getRegisterResult(this.hardwareInfoTB.Text.Trim(), text))
            {
                WMMessageBox.Show(this, "输入有误,请检查输入注册序号!");
                return;
            }
            DbUtil dbUtil = new DbUtil();

            dbUtil.AddParameter("key", text);
            DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM histRgTable WHERE `key`=@key");

            if (dataRow != null)
            {
                WMMessageBox.Show(this, "序号已注册,请重新获取!");
                return;
            }
            string str = "1";

            string[] array = text.Split(new char[]
            {
                '-'
            });
            if (array.Length == 6)
            {
                str = array[5];
            }
            uint num = ConvertUtils.ToUInt32(str);

            dbUtil.AddParameter("key", text);
            dbUtil.AddParameter("d", RegisterUtil.GetTimeStamp().ToString());
            dbUtil.AddParameter("ivd", (RegisterUtil.GetTimeStamp() + (ulong)(num * 365U * 24U * 60U * 60U)).ToString());
            dbUtil.AddParameter("code", this.hardwareInfoTB.Text.Trim());
            dbUtil.ExecuteNonQuery("INSERT INTO rgTable(`key`, d, ivd, code) values (@key, @d, @ivd, @code) ON DUPLICATE KEY UPDATE `key`=@key,d=@d,ivd=@ivd");
            dbUtil.AddParameter("key", text);
            dbUtil.AddParameter("d", RegisterUtil.GetTimeStamp().ToString());
            dbUtil.AddParameter("code", this.hardwareInfoTB.Text.Trim());
            dbUtil.ExecuteNonQuery("INSERT INTO histRgTable(`key`, d, `code`) VALUES (@key, @d, @code)");
            dbUtil.AddParameter("key", "1");
            dataRow = dbUtil.ExecuteRow("SELECT * FROM settings WHERE `key`=@key");
            if (dataRow != null)
            {
                ulong num2 = ConvertUtils.ToUInt64(dataRow["totalRegTime"].ToString());
                dbUtil.AddParameter("key", "1");
                dbUtil.AddParameter("totalRegTime", string.Concat(num2 + 1UL));
                dbUtil.ExecuteNonQuery("UPDATE settings SET totalRegTime=@totalRegTime WHERE `key`=@key");
            }
            base.Visible = false;
        }
Ejemplo n.º 14
0
        public void queryDB(Dictionary <string, QueryValue> dicts)
        {
            if (qb == null || dicts == null || dicts.Count < 0)
            {
                return;
            }
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("userId");
            dataTable.Columns.Add("username");
            dataTable.Columns.Add("identityId");
            dataTable.Columns.Add("phoneNum");
            dataTable.Columns.Add("address");
            dataTable.Columns.Add("usertype");
            dataTable.Columns.Add("priceType");
            dataTable.Columns.Add("paytype");
            dataTable.Columns.Add("pursuitTimes");
            dataTable.Columns.Add("pursuitNum");
            dataTable.Columns.Add("paynum");
            dataTable.Columns.Add("time");
            dataTable.Columns.Add("operator");
            List <string> list = new List <string>();
            string        sqlStrForQueryUser = getSqlStrForQueryUser(dicts);
            DataTable     dataTable2;

            if (sqlStrForQueryUser != "")
            {
                foreach (string key in dicts.Keys)
                {
                    QueryValue queryValue = dicts[key];
                    db.AddParameter(key, queryValue.Value);
                }
                dataTable2 = db.ExecuteQuery("SELECT * FROM usersTable WHERE " + sqlStrForQueryUser + " ORDER BY createTime ASC");
                if (dataTable2 != null && dataTable2.Rows != null && dataTable2.Rows.Count > 0)
                {
                    foreach (DataRow row in dataTable2.Rows)
                    {
                        list.Add(row["permanentUserId"].ToString());
                    }
                }
            }
            string text = "";

            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    string text2 = list[i];
                    db.AddParameter("permanentUserId" + text2, text2);
                    if (i != 0)
                    {
                        text += " OR ";
                    }
                    text = text + "permanentUserId=@permanentUserId" + text2;
                }
            }
            else if (list.Count == 0 && dicts.Count != 0 && sqlStrForQueryUser != "")
            {
                qb.initDGV(initDGV(dataTable));
                return;
            }
            TimeSpan timeSpan  = qb.getStartDT() - WMConstant.DT1970;
            TimeSpan timeSpan2 = qb.getEndDT() - WMConstant.DT1970;

            db.AddParameter("createTimeStart", string.Concat(timeSpan.TotalSeconds));
            db.AddParameter("createTimeEnd", string.Concat(timeSpan2.TotalSeconds));
            db.AddParameter("lastReadInfo", "0");
            string sqlKeys = getQueryConditionEntitys()[7].SqlKeys;

            if (dicts.ContainsKey(sqlKeys))
            {
                QueryValue queryValue2 = dicts[sqlKeys];
                db.AddParameter(sqlKeys, queryValue2.Value);
                string text3 = text;
                text = text3 + ((text == "") ? "" : (" " + queryValue2.AndOr + " ")) + sqlKeys + queryValue2.Oper + "@" + sqlKeys;
            }
            string sqlKeys2 = getQueryConditionEntitys()[8].SqlKeys;

            if (dicts.ContainsKey(sqlKeys2))
            {
                QueryValue queryValue3 = dicts[sqlKeys2];
                db.AddParameter(sqlKeys2, queryValue3.Value);
                string text4 = text;
                text = text4 + ((text == "") ? "" : (" " + queryValue3.AndOr + " ")) + sqlKeys2 + queryValue3.Oper + "@" + sqlKeys2;
            }
            dataTable2 = db.ExecuteQuery("SELECT * FROM userCardLog WHERE " + ((text == "") ? "" : ("(" + text + ") AND ")) + "time>=@createTimeStart AND time<=@createTimeEnd AND lastReadInfo=@lastReadInfo ORDER BY operationId ASC");
            if (dataTable2 != null && dataTable2.Rows != null && dataTable2.Rows.Count > 0)
            {
                foreach (DataRow row2 in dataTable2.Rows)
                {
                    db.AddParameter("permanentUserId", row2["permanentUserId"].ToString());
                    DataRow dataRow3 = db.ExecuteRow("SELECT * FROM usersTable WHERE permanentUserId=@permanentUserId");
                    if (dataRow3 == null)
                    {
                        continue;
                    }
                    db.AddParameter("typeId", dataRow3["userTypeId"].ToString());
                    DataRow dataRow4 = db.ExecuteRow("SELECT * FROM userTypeTable WHERE typeId=@typeId");
                    db.AddParameter("priceConsistId", dataRow3["userPriceConsistId"].ToString());
                    DataRow dataRow5 = db.ExecuteRow("SELECT * FROM priceConsistTable WHERE priceConsistId=@priceConsistId");
                    text = "";
                    db.AddParameter("userCardLogId", row2["operationId"].ToString());
                    string sqlKeys3 = getQueryConditionEntitys()[7].SqlKeys;
                    if (dicts.ContainsKey(sqlKeys3))
                    {
                        QueryValue queryValue4 = dicts[sqlKeys3];
                        string     text5       = "0";
                        switch (queryValue4.Value)
                        {
                        default:
                            text5 = queryValue4.Value;
                            break;

                        case "3":
                            text5 = "5";
                            break;

                        case "5":
                            text5 = "7";
                            break;
                        }
                        db.AddParameter("payType", text5);
                        text = text + "payType" + queryValue4.Oper + "@payType";
                    }
                    string sqlKeys4 = getQueryConditionEntitys()[8].SqlKeys;
                    if (dicts.ContainsKey(sqlKeys4))
                    {
                        QueryValue queryValue5 = dicts[sqlKeys4];
                        db.AddParameter(sqlKeys4, queryValue5.Value);
                        string text6 = text;
                        text = text6 + ((text == "") ? "" : (" " + queryValue5.AndOr + " ")) + sqlKeys4 + queryValue5.Oper + "@" + sqlKeys4;
                    }
                    DataTable dataTable3 = db.ExecuteQuery("SELECT * FROM payLogTable WHERE " + ((text == "") ? "" : (text + " AND ")) + "userCardLogId=@userCardLogId");
                    if (dataTable3 == null || dataTable3.Rows == null || dataTable3.Rows.Count <= 0)
                    {
                        continue;
                    }
                    foreach (DataRow row3 in dataTable3.Rows)
                    {
                        DataRow dataRow7 = dataTable.NewRow();
                        dataRow7["userId"]       = dataRow3["userId"].ToString();
                        dataRow7["username"]     = dataRow3["username"].ToString();
                        dataRow7["identityId"]   = dataRow3["identityId"].ToString();
                        dataRow7["phoneNum"]     = dataRow3["phoneNum"].ToString();
                        dataRow7["address"]      = dataRow3["address"].ToString();
                        dataRow7["usertype"]     = ((dataRow4 == null) ? "" : dataRow4["userType"].ToString());
                        dataRow7["priceType"]    = ((dataRow5 == null) ? "" : dataRow5["priceConstistName"].ToString());
                        dataRow7["paytype"]      = WMConstant.PayTypeList[Convert.ToInt64(row3["payType"])];
                        dataRow7["pursuitTimes"] = row2["consumeTimes"].ToString();
                        dataRow7["pursuitNum"]   = row3["pursuitNum"].ToString();
                        dataRow7["paynum"]       = row3["totalPrice"].ToString();
                        dataRow7["time"]         = WMConstant.DT1970.AddSeconds(ConvertUtils.ToDouble(row2["time"].ToString())).ToString("yyyy-MM-dd HH:mm:ss");
                        dataRow7["operator"]     = row2["operator"].ToString();
                        dataTable.Rows.Add(dataRow7);
                        dataTable.AcceptChanges();
                    }
                }
            }
            qb.initDGV(initDGV(dataTable));
        }
Ejemplo n.º 15
0
        public void PaySucceed(string result, JObject retQueryObj, JObject retQueryDetailObj, string out_order_no, string create_time)
        {
            this.timer1.Enabled = true;
            this.TimeOut        = this.MainFormTimeOut;
            this.timer1.Start();

            // 支付成功
            dbUtil.AddParameter("out_order_no", out_order_no);
            dbUtil.AddParameter("status", "2");
            dbUtil.AddParameter("query", result);
            dbUtil.ExecuteNonQuery("UPDATE he_ma_pay SET query=@query,status=@status WHERE out_order_no=@out_order_no");


            long num = 0L;
            ConsumeCardEntity consumeCardEntity = null;
            int num5 = isValidCard();

            double buyer_pay_amount = ConvertUtils.ToDouble(retQueryDetailObj["buyer_pay_amount"].ToString().Trim());

            if (num5 == 2)
            {
                consumeCardEntity = this.parseCard(false);
                if (consumeCardEntity == null)
                {
                    bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount);
                    if (!refund_status)
                    {
                        WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!");
                    }
                    return;
                }
            }
            if (consumeCardEntity == null)
            {
                bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount);
                if (!refund_status)
                {
                    WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!");
                }
                return;
            }
            if (consumeCardEntity != null)
            {
                if (consumeCardEntity != null && consumeCardEntity.DeviceHead.DeviceIdFlag == 0U)
                {
                    bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount);
                    if (!refund_status)
                    {
                        WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!");
                    }
                    WMMessageBox.Show(this, "此卡未开户,不能写入数据!");
                    return;
                }
                if (consumeCardEntity != null && consumeCardEntity.DeviceHead.ConsumeFlag == 0U)
                {
                    bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount);
                    if (!refund_status)
                    {
                        WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!");
                    }
                    WMMessageBox.Show(this, "此卡未刷卡,不能写入数据!");
                    return;
                }
            }
            string tagUserId = this.userIdTB.Text.Trim();

            if (!tagUserId.Equals(consumeCardEntity.UserId.ToString()))
            {
                bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount);
                if (!refund_status)
                {
                    WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!");
                }
                WMMessageBox.Show(this, "卡片与用户信息错误!");
                return;
            }
            ConsumeCardEntity consumeCardEntity2 = this.getConsumeCardEntity();

            consumeCardEntity2.DeviceHead.ConsumeFlag = 0U;
            consumeCardEntity2.ConsumeTimes          += 1U;
            if (consumeCardEntity != null)
            {
                consumeCardEntity2.DeviceHead.RefundFlag           = consumeCardEntity.DeviceHead.RefundFlag;
                consumeCardEntity2.DeviceHead.ValveCloseStatusFlag = consumeCardEntity.DeviceHead.ValveCloseStatusFlag;
                consumeCardEntity2.DeviceHead.ReplaceCardFlag      = consumeCardEntity.DeviceHead.ReplaceCardFlag;
                consumeCardEntity2.DeviceHead.SurplusNumH          = consumeCardEntity.DeviceHead.SurplusNumH;
                consumeCardEntity2.DeviceHead.SurplusNumL          = consumeCardEntity.DeviceHead.SurplusNumL;
            }
            // 开启非阻塞
            Program.MsgBoxNonBlocking = true;
            // 阻塞标记置为空
            Program.MsgBoxMessage = "";
            num = (long)this.writeCard(consumeCardEntity2.getEntity());
            // 关闭非阻塞
            Program.MsgBoxNonBlocking = false;
            // 阻塞标记不为空 执行响应的后续操作并提醒用户
            if (!string.IsNullOrWhiteSpace(Program.MsgBoxMessage))
            {
                bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount);
                if (!refund_status)
                {
                    WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!");
                }
                WMMessageBox.Show(this, Program.MsgBoxMessage);
                Program.MsgBoxMessage = "";
                return;
            }

            if (num == 0L)
            {
                dbUtil.AddParameter("userId", ConvertUtils.ToInt64(consumeCardEntity2.UserId).ToString());
                DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM metersTable WHERE meterId=@userId");

                dbUtil.AddParameter("permanentUserId", dataRow["permanentUserId"].ToString());
                DataRow dataRow2 = dbUtil.ExecuteRow("SELECT * FROM usersTable WHERE permanentUserId=@permanentUserId");

                ulong num12 = ConvertUtils.ToUInt64(dataRow2["totalPursuitNum"].ToString());
                num12 += (ulong)consumeCardEntity2.TotalRechargeNumber;

                List <string> list = new List <string>();
                Dictionary <string, string> usersTableUpdate = new Dictionary <string, string>();
                usersTableUpdate.Add("totalPursuitNum", string.Concat(num12));
                usersTableUpdate.Add("userBalance", "0");
                // 用户信息更新语句拼接
                string usersUpdate = DictToMySqlUpdate(usersTableUpdate, "usersTable", "permanentUserId='" + dataRow["permanentUserId"].ToString() + "'");
                list.Add(usersUpdate);

                TimeSpan timeSpan = DateTime.Now - DT1970;
                Dictionary <string, string> userCardLogParam = new Dictionary <string, string>();
                userCardLogParam.Add("time", ConvertUtils.ToInt64(timeSpan.TotalSeconds).ToString());
                userCardLogParam.Add("userHead", ConvertUtils.ToInt64(consumeCardEntity2.CardHead.getEntity()).ToString());
                userCardLogParam.Add("deviceHead", ConvertUtils.ToInt64(consumeCardEntity2.DeviceHead.getEntity()).ToString());
                userCardLogParam.Add("userId", ConvertUtils.ToInt64(consumeCardEntity2.UserId).ToString());
                userCardLogParam.Add("pursuitNum", ConvertUtils.ToInt64(consumeCardEntity2.TotalRechargeNumber).ToString());
                userCardLogParam.Add("totalNum", ConvertUtils.ToInt64(consumeCardEntity2.TotalReadNum).ToString());
                userCardLogParam.Add("consumeTimes", ConvertUtils.ToInt64(consumeCardEntity2.ConsumeTimes).ToString());
                userCardLogParam.Add("operator", Program.staffId);
                userCardLogParam.Add("operateType", "1");
                userCardLogParam.Add("totalPayNum", string.Concat(buyer_pay_amount));
                userCardLogParam.Add("unitPrice", this.getPriceConsistValue().ToString("0.00"));
                userCardLogParam.Add("permanentUserId", dataRow["permanentUserId"].ToString());
                // 用户卡日志插入语句拼接
                string userCardLog = DictToMySqlInsert(userCardLogParam, "userCardLog");
                list.Add(userCardLog);

                // 用户卡日志插入的ID
                string selectNum2 = $"(SELECT MAX(operationId) FROM `usercardlog` WHERE userId = '{ConvertUtils.ToInt64(consumeCardEntity2.UserId).ToString()}' )";

                Dictionary <string, string> operationLogParam = new Dictionary <string, string>();
                operationLogParam.Add("userId", ConvertUtils.ToInt64(consumeCardEntity2.UserId).ToString());
                operationLogParam.Add("cardType", ConvertUtils.ToInt64(1.0).ToString());
                operationLogParam.Add("operationId", "operationIdParam123");
                operationLogParam.Add("operator", Program.staffId);
                operationLogParam.Add("time", ConvertUtils.ToInt64(timeSpan.TotalSeconds).ToString());

                // 用户操作日志插入语句拼接
                string operationLog = DictToMySqlInsert(operationLogParam, "operationLog");
                operationLog = operationLog.Replace("'operationIdParam123'", selectNum2);
                list.Add(operationLog);

                Dictionary <string, string> payLogTableParam = new Dictionary <string, string>();
                payLogTableParam.Add("userId", ConvertUtils.ToInt64(consumeCardEntity2.UserId).ToString());
                payLogTableParam.Add("userName", dataRow2["username"].ToString());
                payLogTableParam.Add("pursuitNum", ConvertUtils.ToInt64(consumeCardEntity2.TotalRechargeNumber).ToString());
                payLogTableParam.Add("unitPrice", this.getPriceConsistValue().ToString("0.00"));
                payLogTableParam.Add("totalPrice", string.Concat(buyer_pay_amount));
                payLogTableParam.Add("payType", string.Concat(1));
                payLogTableParam.Add("dealType", "0");
                payLogTableParam.Add("operator", Program.staffId);
                payLogTableParam.Add("operateTime", ConvertUtils.ToInt64(timeSpan.TotalSeconds).ToString() ?? "");
                payLogTableParam.Add("userCardLogId", "userCardLogIdParam123");
                payLogTableParam.Add("permanentUserId", dataRow["permanentUserId"].ToString());
                payLogTableParam.Add("realPayNum", string.Concat(buyer_pay_amount));
                // 支付日志插入语句拼接
                string payLogTable = DictToMySqlInsert(payLogTableParam, "payLogTable");
                payLogTable = payLogTable.Replace("'userCardLogIdParam123'", selectNum2);
                list.Add(payLogTable);
                // 执行SQL语句 -- 事务
                int count = dbUtil.ExecuteSqlTran(list);
                // 执行SQL语句失败
                if (count == 0)
                {
                    bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount);
                    if (!refund_status)
                    {
                        WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!");
                    }
                    // 取消写卡
                    long numx = (long)this.writeCard(consumeCardEntity.getEntity());
                    Console.WriteLine(numx + "数据存储失败! 写卡的数据恢复到写卡之前");
                    WMMessageBox.Show(this, "数据存储失败!");
                    return;
                }

                // 重新加载充值信息
                this.loadAllRegisterDGV(string.Concat(consumeCardEntity2.UserId));

                showPaySucceed();
            }
            else
            {
                bool refund_status = RefundRequest(out_order_no, create_time, buyer_pay_amount);
                if (!refund_status)
                {
                    WMMessageBox.Show(this, "退款失败,后台程序会继续尝试退款操作,如1天内还未退款,请按照本软件首页提示的方式联系管理员!");
                }
                return;
            }
        }
Ejemplo n.º 16
0
        private void showPayForm(object sender, EventArgs e, string amount = null)
        {
            this.resetTimeOut();
            if (!this.payWaySelect)
            {
                WMMessageBox.Show(this, "请选择支付方式!");
                return;
            }
            if (string.IsNullOrWhiteSpace(amount))
            {
                // 计算支付金额以及购买量
                calculateFee(((Button)sender).Text.Trim());
            }
            else
            {
                calculateFee(amount);
            }

            // 验证
            double num3 = ConvertUtils.ToDouble(this.limitPursuitTB.Text);
            double num4 = ConvertUtils.ToDouble(this.payNumTBText.Trim());

            if (num4 < 0.0)
            {
                WMMessageBox.Show(this, "购买量不得小于0!");
                return;
            }
            if (num4 > num3 && num3 != 0.0)
            {
                WMMessageBox.Show(this, "超出该用户类型限购量!");
                return;
            }
            ConsumeCardEntity consumeCardEntity = null;

            int num5 = isValidCard(false);

            if (num5 == 2)
            {
                consumeCardEntity = this.parseCard(false);
                if (consumeCardEntity == null)
                {
                    return;
                }
            }
            if (consumeCardEntity == null)
            {
                return;
            }
            if (consumeCardEntity != null)
            {
                if (consumeCardEntity != null && consumeCardEntity.DeviceHead.DeviceIdFlag == 0U)
                {
                    WMMessageBox.Show(this, "此卡未开户,不能写入数据!");
                    return;
                }
                if (consumeCardEntity != null && consumeCardEntity.DeviceHead.ConsumeFlag == 0U)
                {
                    WMMessageBox.Show(this, "此卡未刷卡,不能写入数据!");
                    return;
                }
            }

            PayForm payForm = new PayForm();

            payForm.setMainForm(this);
            payForm.setWelcomeForm(this.welcomeForm);

            string time      = DateTime.Now.ToLocalTime().ToString();
            string timestamp = DateTime.Parse(time).ToString("yyyyMMddHHmmss");
            string body      = $"购买热量:{this.payNumTBText}kWh";
            string ip        = HeMaPay.GetLocalIp();
            DbUtil db        = new DbUtil();

            db.AddParameter("pay", this.payWay.ToString());
            db.AddParameter("total_amount", this.dueNumTBText);
            db.AddParameter("body", body);
            db.AddParameter("create_time", timestamp);
            db.AddParameter("create_ip", ip);
            long out_order_no = db.ExecuteNonQueryAndReturnLastInsertRowId("INSERT INTO he_ma_pay(pay, total_amount, body, create_time, create_ip) values (@pay, @total_amount, @body, @create_time, @create_ip)");

            string payRequest = HeMaPay.Percreate(this.payWay, out_order_no.ToString(), this.dueNumTBText, body, timestamp, ip);

            if (!string.IsNullOrWhiteSpace(payRequest))
            {
                JObject retPayObJ = JObject.Parse(payRequest.ToString());
                if (retPayObJ["code"].ToString().Equals("200"))
                {
                    JObject data = JObject.Parse(retPayObJ["data"].ToString());
                    if (data["sub_code"].ToString().Equals("SUCCESS"))
                    {
                        // 下单成功, 数据入库
                        updatePayResult(db, out_order_no, payRequest, 0);

                        string qr_code = data["qr_code"].ToString().Trim();

                        string way = "";
                        if (payWay == PayWay.WECHAT)
                        {
                            way = "微信";
                        }
                        else if (payWay == PayWay.ALIPAY)
                        {
                            way = "支付宝";
                        }

                        this.timer1.Stop();
                        this.timer1.Enabled = false;

                        /****
                         * dueNum 金额
                         * payNum 购买量
                         * */
                        payForm.setInit(this.dueNumTBText, this.payNumTBText, qr_code, out_order_no, way, timestamp);
                        payForm.ShowDialog(this);
                    }
                    else
                    {
                        WMMessageBox.Show(this, data["sub_msg"].ToString() + "!");
                        return;
                    }
                }
                else
                {
                    WMMessageBox.Show(this, "下单失败!");
                    return;
                }
            }
            else
            {
                WMMessageBox.Show(this, "网络异常,请稍后再试!");
                return;
            }
        }
Ejemplo n.º 17
0
        // Token: 0x060001CD RID: 461 RVA: 0x000088C0 File Offset: 0x00006AC0
        private void LoginForm_Load(object sender, EventArgs e)
        {
            string text;

            try
            {
                text = AtapiDevice.GetHddInfo(0).SerialNumber.Trim();
            }
            catch (ApplicationException)
            {
                Hardware hardware = new Hardware();
                text = hardware.GetHardDiskID();
            }
            if (text == "")
            {
                DialogResult dialogResult = WMMessageBox.Show(this, "无法读取硬盘信息!");
                if (dialogResult == DialogResult.OK)
                {
                    Application.Exit();
                }
                return;
            }
            DbUtil  dbUtil  = new DbUtil();
            DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM settings");

            if (dataRow == null)
            {
                this.readRegisterInfofailed("无法读取系统配置!");
                return;
            }
            uint num = ConvertUtils.ToUInt32(dataRow["totalRegTime"].ToString());

            if (num == 0U)
            {
                RegisterForm registerForm = new RegisterForm();
                registerForm.ShowDialog();
                base.Visible = false;
                return;
            }
            DataTable dataTable = dbUtil.ExecuteQuery("SELECT * FROM histRgTable");

            if (dataTable != null && dataTable.Rows != null && (long)dataTable.Rows.Count != (long)((ulong)num))
            {
                DialogResult dialogResult2 = WMMessageBox.Show(this, "历史注册信息不符!");
                if (dialogResult2 == DialogResult.OK)
                {
                    Application.Exit();
                }
                return;
            }
            dbUtil.AddParameter("code", text);
            DataRow dataRow2 = dbUtil.ExecuteRow("SELECT * FROM rgTable where code=@code");
            ulong   num2     = (dataRow2 != null) ? ConvertUtils.ToUInt64(dataRow2["ivd"].ToString()) : RegisterUtil.GetTimeStamp();
            long    num3     = (long)(num2 - RegisterUtil.GetTimeStamp());

            if (num3 <= 2592000L)
            {
                if (num3 > 0L)
                {
                    DialogResult dialogResult3 = WMMessageBox.Show(this, "软件即将过期,是否重新注册?", "卡表管理软件", MessageBoxButtons.OKCancel);
                    if (dialogResult3 == DialogResult.OK)
                    {
                        RegisterForm registerForm2 = new RegisterForm();
                        registerForm2.ShowDialog();
                        base.Visible = false;
                    }
                }
                else
                {
                    DialogResult dialogResult4 = WMMessageBox.Show(this, "软件已经过期,是否重新注册?", "卡表管理软件", MessageBoxButtons.OKCancel);
                    if (dialogResult4 == DialogResult.OK)
                    {
                        RegisterForm registerForm3 = new RegisterForm();
                        registerForm3.ShowDialog();
                        base.Visible = false;
                        return;
                    }
                    Application.Exit();
                    return;
                }
            }
            ulong num4 = ConvertUtils.ToUInt64(dataRow2["d"].ToString());

            if (num4 > RegisterUtil.GetTimeStamp())
            {
                this.readRegisterInfofailed("请检查时间设置是否正确!");
                return;
            }
            ulong num5 = ConvertUtils.ToUInt64(dataRow2["lud"].ToString());

            if (num5 >= RegisterUtil.GetTimeStamp())
            {
                this.readRegisterInfofailed("请检查时间设置是否正确!");
                return;
            }
            string keyString = (dataRow2 == null) ? "" : dataRow2["key"].ToString();

            if (!RegisterUtil.getRegisterResult(text, keyString))
            {
                DialogResult dialogResult5 = WMMessageBox.Show(this, "注册号码不正确,需要重新注册?", "卡表管理软件", MessageBoxButtons.OKCancel);
                if (dialogResult5 == DialogResult.OK)
                {
                    RegisterForm registerForm4 = new RegisterForm();
                    registerForm4.ShowDialog();
                    base.Visible = false;
                    return;
                }
                Application.Exit();
            }
        }
Ejemplo n.º 18
0
        // Token: 0x0600038B RID: 907 RVA: 0x00028DDC File Offset: 0x00026FDC
        private void readCardBtn_Click(object sender, EventArgs e)
        {
            if (this.parentForm.isEmptyCard())
            {
                this.messageRichTextBox.Text = "空白卡";
                return;
            }
            uint[] array = this.parentForm.readCard();
            if (array != null)
            {
                string text     = "";
                uint   cardType = this.parentForm.getCardType(array[0]);
                uint   num      = cardType;
                switch (num)
                {
                case 1U:
                {
                    ConsumeCardEntity consumeCardEntity = new ConsumeCardEntity();
                    consumeCardEntity.parseEntity(array);
                    string value  = string.Concat(consumeCardEntity.UserId);
                    DbUtil dbUtil = new DbUtil();
                    dbUtil.AddParameter("userId", value);
                    DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM metersTable WHERE meterId=@userId");
                    if (dataRow == null)
                    {
                        WMMessageBox.Show(this, "没有找到相应的表信息!");
                    }
                    else
                    {
                        dbUtil.AddParameter("permanentUserId", dataRow["permanentUserId"].ToString());
                        DataRow dataRow2 = dbUtil.ExecuteRow("SELECT * FROM usersTable WHERE permanentUserId=@permanentUserId");
                        if (dataRow2 != null)
                        {
                            text = string.Concat(new string[]
                                {
                                    "设备号:",
                                    dataRow2["userId"].ToString(),
                                    "\n姓名:",
                                    dataRow2["username"].ToString(),
                                    "\n联系方式:",
                                    dataRow2["phoneNum"].ToString(),
                                    "\n证件号码:",
                                    dataRow2["identityId"].ToString(),
                                    "\n地址:",
                                    dataRow2["address"].ToString(),
                                    "\n用户面积:",
                                    dataRow2["userArea"].ToString(),
                                    "\n人口数:",
                                    dataRow2["userPersons"].ToString()
                                });
                        }
                    }
                    text = text + "\n\n" + consumeCardEntity.ToString();
                    goto IL_2A5;
                }

                case 2U:
                {
                    TransCardEntity transCardEntity = new TransCardEntity();
                    transCardEntity.parseEntity(array);
                    text = transCardEntity.ToString();
                    goto IL_2A5;
                }

                case 3U:
                {
                    RefundCardEntity refundCardEntity = new RefundCardEntity();
                    refundCardEntity.parseEntity(array);
                    text = refundCardEntity.ToString();
                    goto IL_2A5;
                }

                case 4U:
                {
                    SettingCardEntity settingCardEntity = new SettingCardEntity();
                    settingCardEntity.parseEntity(array);
                    text = settingCardEntity.ToString();
                    goto IL_2A5;
                }

                case 5U:
                {
                    ClearCardEntity clearCardEntity = new ClearCardEntity();
                    clearCardEntity.parseEntity(array);
                    text = clearCardEntity.ToString();
                    goto IL_2A5;
                }

                case 6U:
                    break;

                case 7U:
                case 8U:
                {
                    ForceValveOperationCardEntity forceValveOperationCardEntity = new ForceValveOperationCardEntity();
                    forceValveOperationCardEntity.parseEntity(array);
                    text = forceValveOperationCardEntity.ToString();
                    goto IL_2A5;
                }

                default:
                    if (num != 31U)
                    {
                        goto IL_2A5;
                    }
                    break;
                }
                CheckCardEntityV3 checkCardEntityV = new CheckCardEntityV3();
                checkCardEntityV.parseEntity(array);
                text = checkCardEntityV.ToString();
IL_2A5:
                this.messageRichTextBox.Text = text;
            }
        }
Ejemplo n.º 19
0
        // Token: 0x060001D8 RID: 472 RVA: 0x000093C8 File Offset: 0x000075C8
        private void initializePages()
        {
            this.createNewUserPage      = new CreateNewUserPage();
            this.userCardPage           = new UserCardPage();
            this.welcomePage            = new WelcomePage();
            this.checkCardPage          = new CheckCardPage();
            this.checkCardPage1         = new CheckCardPage();
            this.forceCloseOpenCardPage = new ForceCloseOrOpenCardPage();
            this.refundCardPage         = new RefundCardPage();
            this.settingCardPage        = new SettingCardPage();
            this.transCardPage          = new TransCardPage();
            this.clearCardPage          = new ClearCardPage();
            this.emptyCardPage          = new EmptyCardPage();
            this.settingsPage           = new SettingsPage();
            this.readCardPage           = new ReadCardPage();
            this.receiptPrintPage       = new ReceiptPrintPage();
            this.accountDailyPayPage    = new AccountDailyPayPage();
            DbUtil dbUtil = new DbUtil();

            dbUtil.AddParameter("staffId", MainForm.staffId);
            DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM staffTable WHERE staffId=@staffId");

            if (dataRow != null)
            {
                this.permissions = ConvertUtils.ToUInt64(dataRow["permissions"].ToString());
            }
            else
            {
                this.permissions = 0UL;
            }
            if (PermissionFlags.hasDailyOperation(this.permissions))
            {
                SbGroup sbGroup = new SbGroup();
                sbGroup.Tag  = 0;
                sbGroup.Text = "日常业务";
                this.sideBar1.AddGroup(sbGroup);
                this.sideBar1.VisibleGroup = sbGroup;
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.xinhukaihu_flag))
                {
                    SbItem sbItem = new SbItem("新户开户", 0);
                    sbItem.Tag = 0;
                    this.sideBar1.Groups[0].Items.Add(sbItem);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.richanggoumai_flag))
                {
                    SbItem sbItem2 = new SbItem("日常购买", 0);
                    sbItem2.Tag = 1;
                    this.sideBar1.Groups[0].Items.Add(sbItem2);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.yingyezhazhang_flag))
                {
                    SbItem sbItem3 = new SbItem("营业扎帐", 0);
                    sbItem3.Tag = 2;
                    this.sideBar1.Groups[0].Items.Add(sbItem3);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.duka_flag))
                {
                    SbItem sbItem4 = new SbItem("读   卡", 0);
                    sbItem4.Tag = 3;
                    this.sideBar1.Groups[0].Items.Add(sbItem4);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.qingka_flag))
                {
                    SbItem sbItem5 = new SbItem("清   卡", 0);
                    sbItem5.Tag = 4;
                    this.sideBar1.Groups[0].Items.Add(sbItem5);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.budafapiao_flag))
                {
                    SbItem sbItem6 = new SbItem("补打发票", 0);
                    sbItem6.Tag = 5;
                    this.sideBar1.Groups[0].Items.Add(sbItem6);
                }
            }
            if (PermissionFlags.hasMakeFunctionCard(this.permissions))
            {
                int     count    = this.sideBar1.Groups.Count;
                SbGroup sbGroup2 = new SbGroup();
                sbGroup2.Tag  = 1;
                sbGroup2.Text = "功能卡制作";
                this.sideBar1.AddGroup(sbGroup2);
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zhizuochaxunka_flag))
                {
                    SbItem sbItem7 = new SbItem("制作查询卡", 0);
                    sbItem7.Tag = 0;
                    this.sideBar1.Groups[count].Items.Add(sbItem7);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zhizuoqinglingka_flag))
                {
                    SbItem sbItem8 = new SbItem("制作清零卡", 0);
                    sbItem8.Tag = 1;
                    this.sideBar1.Groups[count].Items.Add(sbItem8);
                }
                PermissionFlags.hasPermission(this.permissions, PermissionFlags.zhizuotuigouka_flag);
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zhizuoshezhika_flag))
                {
                    SbItem sbItem9 = new SbItem("制作设置卡", 0);
                    sbItem9.Tag = 3;
                    this.sideBar1.Groups[count].Items.Add(sbItem9);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zhizuozhuanyika_flag))
                {
                    SbItem sbItem10 = new SbItem("制作转移卡", 0);
                    sbItem10.Tag = 4;
                    this.sideBar1.Groups[count].Items.Add(sbItem10);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zhizuoqiangzhikaguanfaka_flag))
                {
                    SbItem sbItem11 = new SbItem("制作工程卡", 0);
                    sbItem11.Tag = 5;
                    this.sideBar1.Groups[count].Items.Add(sbItem11);
                }
                if (this.bHasFactoryMode)
                {
                    SbItem sbItem12 = new SbItem("制作工厂卡", 0);
                    sbItem12.Tag = 6;
                    this.sideBar1.Groups[count].Items.Add(sbItem12);
                }
            }
            if (PermissionFlags.hasQueryTableFunction(this.permissions))
            {
                int     count2   = this.sideBar1.Groups.Count;
                SbGroup sbGroup3 = new SbGroup();
                sbGroup3.Tag  = 2;
                sbGroup3.Text = "报表管理";
                this.sideBar1.AddGroup(sbGroup3);
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.kehuxinxichaxun_flag))
                {
                    SbItem sbItem13 = new SbItem("客户信息查询", 0);
                    sbItem13.Tag = 0;
                    this.sideBar1.Groups[count2].Items.Add(sbItem13);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.goumaimingxichaxun_flag))
                {
                    SbItem sbItem14 = new SbItem("购买明细查询", 0);
                    sbItem14.Tag = 1;
                    this.sideBar1.Groups[count2].Items.Add(sbItem14);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.shouchumingxichaxun_flag))
                {
                    SbItem sbItem15 = new SbItem("售出明细查询", 0);
                    sbItem15.Tag = 2;
                    this.sideBar1.Groups[count2].Items.Add(sbItem15);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.tuigoumingxichaxun_flag))
                {
                    SbItem sbItem16 = new SbItem("退购明细查询", 0);
                    sbItem16.Tag = 3;
                    this.sideBar1.Groups[count2].Items.Add(sbItem16);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.bukamingxichaxun_flag))
                {
                    SbItem sbItem17 = new SbItem("补卡明细查询", 0);
                    sbItem17.Tag = 4;
                    this.sideBar1.Groups[count2].Items.Add(sbItem17);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.jiaoyimingxichaxun_flag))
                {
                    SbItem sbItem18 = new SbItem("交易明细查询", 0);
                    sbItem18.Tag = 5;
                    this.sideBar1.Groups[count2].Items.Add(sbItem18);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.ribaoyuebaonianbao_flag))
                {
                    SbItem sbItem19 = new SbItem("日报月报年报", 0);
                    sbItem19.Tag = 6;
                    this.sideBar1.Groups[count2].Items.Add(sbItem19);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.yibiaoweixiuchaxun_flag))
                {
                    SbItem sbItem20 = new SbItem("维修换表查询", 0);
                    sbItem20.Tag = 7;
                    this.sideBar1.Groups[count2].Items.Add(sbItem20);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zonghejiaoyichaxun_flag))
                {
                    SbItem sbItem21 = new SbItem("综合统计查询", 0);
                    sbItem21.Tag = 8;
                    this.sideBar1.Groups[count2].Items.Add(sbItem21);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.quxiaojiaoyichaxun_flag))
                {
                    SbItem sbItem22 = new SbItem("取消交易查询", 0);
                    sbItem22.Tag = 9;
                    this.sideBar1.Groups[count2].Items.Add(sbItem22);
                }
            }
            if (PermissionFlags.hasUnusualOperationFunction(this.permissions))
            {
                int     count3   = this.sideBar1.Groups.Count;
                SbGroup sbGroup4 = new SbGroup();
                sbGroup4.Tag  = 3;
                sbGroup4.Text = "异常业务";
                this.sideBar1.AddGroup(sbGroup4);
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.weixiuhuanbiao_flag))
                {
                    SbItem sbItem23 = new SbItem("维修换表", 0);
                    sbItem23.Tag = 0;
                    this.sideBar1.Groups[count3].Items.Add(sbItem23);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.yonghubuka_flag))
                {
                    SbItem sbItem24 = new SbItem("用户补卡", 0);
                    sbItem24.Tag = 1;
                    this.sideBar1.Groups[count3].Items.Add(sbItem24);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.xinxixiugai_flag))
                {
                    SbItem sbItem25 = new SbItem("信息修改", 0);
                    sbItem25.Tag = 2;
                    this.sideBar1.Groups[count3].Items.Add(sbItem25);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.yonghutuigou_flag))
                {
                    SbItem sbItem26 = new SbItem("用户退购", 0);
                    sbItem26.Tag = 3;
                    this.sideBar1.Groups[count3].Items.Add(sbItem26);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.yonghufenxi_flag))
                {
                    SbItem sbItem27 = new SbItem("可疑用户分析", 0);
                    sbItem27.Tag = 4;
                    this.sideBar1.Groups[count3].Items.Add(sbItem27);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.quxiaojiaoyi_flag))
                {
                    SbItem sbItem28 = new SbItem("取消交易", 0);
                    sbItem28.Tag = 5;
                    this.sideBar1.Groups[count3].Items.Add(sbItem28);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.cuowushuakachongzhi_flag))
                {
                    SbItem sbItem29 = new SbItem("错误刷卡重置", 0);
                    sbItem29.Tag = 6;
                    this.sideBar1.Groups[count3].Items.Add(sbItem29);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.guohu_flag))
                {
                    SbItem sbItem30 = new SbItem("用户过户", 0);
                    sbItem30.Tag = 7;
                    this.sideBar1.Groups[count3].Items.Add(sbItem30);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zizhutuikuanshibai_flag))
                {
                    SbItem sbItem30 = new SbItem("自助退款失败", 0);
                    sbItem30.Tag = 8;
                    this.sideBar1.Groups[count3].Items.Add(sbItem30);
                }
            }
            if (PermissionFlags.hasSystemSettingOperation(this.permissions))
            {
                int     count4   = this.sideBar1.Groups.Count;
                SbGroup sbGroup5 = new SbGroup();
                sbGroup5.Tag  = 4;
                sbGroup5.Text = "系统设置";
                this.sideBar1.AddGroup(sbGroup5);
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.xitongshezhi_flag))
                {
                    SbItem sbItem31 = new SbItem("系统设置", 0);
                    sbItem31.Tag = 0;
                    this.sideBar1.Groups[count4].Items.Add(sbItem31);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.renyuanguanli_flag))
                {
                    SbItem sbItem32 = new SbItem("人员管理", 0);
                    sbItem32.Tag = 1;
                    this.sideBar1.Groups[count4].Items.Add(sbItem32);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.quanxianfenpei_flag))
                {
                    SbItem sbItem33 = new SbItem("权限管理", 0);
                    sbItem33.Tag = 2;
                    this.sideBar1.Groups[count4].Items.Add(sbItem33);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.mimachongzhi_flag))
                {
                    SbItem sbItem34 = new SbItem("密码重置", 0);
                    sbItem34.Tag = 3;
                    this.sideBar1.Groups[count4].Items.Add(sbItem34);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.jiageguanli_flag))
                {
                    SbItem sbItem35 = new SbItem("价格管理", 0);
                    sbItem35.Tag = 4;
                    this.sideBar1.Groups[count4].Items.Add(sbItem35);
                }
                //注释 菜单 数据备份
                //if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.shujubeifen_flag))
                //{
                //	SbItem sbItem36 = new SbItem("数据备份", 0);
                //	sbItem36.Tag = 5;
                //	this.sideBar1.Groups[count4].Items.Add(sbItem36);
                //}
            }
            this.sideBar1.Invalidate();
            this.switchPage(this.welcomePage);
        }
        // Token: 0x060001AB RID: 427 RVA: 0x00006A90 File Offset: 0x00004C90
        private void insertOrUpdateUser(bool insertOrUpdate)
        {
            string   text   = this.nameTB.Text;
            string   value  = this.identityCardNumTB.Text.Trim();
            string   text2  = this.phoneNumTB.Text;
            string   text3  = this.addressTB.Text;
            string   value2 = string.Concat(this.getSelectUserTypeId());
            string   value3 = string.Concat(this.getSelectPriceConsistId());
            DateTime now    = DateTime.Now;
            long     num    = (long)(now - CreateUserInNumbersForm.DT1970).TotalSeconds;

            if (this.firstCreateTime == 0L)
            {
                this.firstCreateTime = num;
            }
            DbUtil    dbUtil    = new DbUtil();
            DataTable dataTable = dbUtil.ExecuteQuery("SELECT userId+1 AS newID FROM usersTable WHERE userId+1 NOT IN (SELECT userId FROM usersTable) AND userId+1 BETWEEN 1 AND 4294967295 ORDER BY newID ASC");

            if (dataTable == null || dataTable.Rows.Count <= 0)
            {
                WMMessageBox.Show("无可用设备号!");
                return;
            }
            DataRow dataRow = dataTable.Rows[0];
            long    num2    = Convert.ToInt64(dataRow["newID"]);

            dbUtil.AddParameter("userId", insertOrUpdate ? string.Concat(num2) : this.userIdModified);
            dbUtil.AddParameter("username", text);
            dbUtil.AddParameter("phoneNum", text2);
            dbUtil.AddParameter("identityId", value);
            dbUtil.AddParameter("address", text3);
            dbUtil.AddParameter("isActive", "0");
            dbUtil.AddParameter("opeartor", MainForm.getStaffId());
            dbUtil.AddParameter("userArea", this.userAreaNumTB.Text.Trim());
            dbUtil.AddParameter("userPersons", this.usrePersonsTB.Text.Trim());
            dbUtil.AddParameter("userTypeId", value2);
            dbUtil.AddParameter("userPriceConsistId", value3);
            dbUtil.AddParameter("userBalance", "0");
            dbUtil.AddParameter("createTime", string.Concat(num));
            dbUtil.AddParameter("permanentUserId", string.Concat(SettingsUtils.getLatestId("usersTable", "permanentUserId", 1L)));
            if (insertOrUpdate)
            {
                dbUtil.ExecuteNonQuery("INSERT INTO usersTable(userId, username, phoneNum, identityId, address, isActive, operator, permanentUserId, userArea, userPersons, userTypeId,userPriceConsistId, userBalance,createTime) VALUES (@userId, @username, @phoneNum, @identityId, @address, @isActive, @opeartor,@permanentUserId, @userArea, @userPersons, @userTypeId,@userPriceConsistId, @userBalance,@createTime)");
                return;
            }
            dbUtil.ExecuteNonQuery("UPDATE usersTable SET username=@username, phoneNum=@phoneNum, identityId=@identityId, address=@address, userArea=@userArea, userPersons=@userPersons, userTypeId=@userTypeId, userPriceConsistId=@userPriceConsistId, createTime=@createTime WHERE userId=@userId");
        }