Пример #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtName.Text == "")
            {
                errorProvider_Name.SetError(txtName, "用户名不能为空!");
                //MessageBox.Show("用户名不能为空!");
            }
            else
            {
                errorProvider_Name.Clear();
                string  strSql = "select * from tb_admin where name='" + txtName.Text + "' and pwd='" + txtPwd.Text + "'";
                DataSet ds     = DBHelper.getDs(strSql, "tb_admin");

                if (ds.Tables[0].Rows.Count > 0)
                {
                    this.Close();
                    Form frmmain = new MainFrom();
                    frmmain.Show();
                }
                else
                {
                    MessageBox.Show("用户名或密码错误!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Пример #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form frm1 = new MainFrom();

            Application.Run(frm1);
        }
Пример #3
0
        public FrmICDataShow(MainFrom parent)
        {
            InitializeComponent();
            form1 = parent;

            //label_block8.Text = form1.dgv_IcData.SelectedRows[0].Cells["Block_8"].Value.ToString();
            label_IC_Num.Text = form1.dgv_IcData.SelectedRows[0].Cells["卡号"].Value.ToString();
            label_Car_ID.Text = form1.dgv_IcData.SelectedRows[0].Cells["电梯ID"].Value.ToString();

            string b8_0 = form1.dgv_IcData.SelectedRows[0].Cells["Block_8"].Value.ToString().Substring(0, 2);
            string b8_6 = form1.dgv_IcData.SelectedRows[0].Cells["Block_8"].Value.ToString().Substring(18, 2);
            string b8_7 = form1.dgv_IcData.SelectedRows[0].Cells["Block_8"].Value.ToString().Substring(21, 2);

            if (((byte)Int32.Parse(b8_0, NumberStyles.HexNumber) & 0x01) == 1)
            //if (((byte)Convert.ToInt32(b8_0) & 0x01) ==1)
            {
                //int t_val=(int.Parse(b8_6) * 256 + int.Parse(b8_7));
                //int t_val = Convert.ToInt32(form1.dgv_IcData.SelectedRows[0].Cells["Block_8"].Value.ToString().Substring(18, 2)) ;
                //int t_val = Convert.ToInt32(form1.dgv_IcData.SelectedRows[0].Cells["Block_8"].Value.ToString().Substring(18, 2));
                label_SetCount.Text = Int32.Parse(b8_7 + b8_6, NumberStyles.HexNumber).ToString();
                //label_SetCount.Text = b8_6 + b8_7;
            }
            else
            {
                label_SetCount.Text = "无次数限制";
            }

            string b9_4 = form1.dgv_IcData.SelectedRows[0].Cells["Block_9"].Value.ToString().Substring(12, 2);

            //if (((byte)Convert.ToInt32(b8_0) & 0x04) ==4)
            if (((byte)Int32.Parse(b8_0, NumberStyles.HexNumber) & 0x04) == 4)
            {
                int  i;
                byte b_9_4 = (byte)Int32.Parse(b9_4, NumberStyles.HexNumber);
                for (i = 0; i < 7; i++)
                {
                    //label_SetWeekDay.Text += b_9_4.ToString("X2");
                    if ((b_9_4 >> i & 0x01) == 0x01)
                    {
                        if (i == 0)
                        {
                            label_SetWeekDay.Text += "星期一 ";
                        }
                        else if (i == 1)
                        {
                            label_SetWeekDay.Text += "星期二 ";
                        }
                        else if (i == 2)
                        {
                            label_SetWeekDay.Text += "星期三 ";
                        }
                        else if (i == 3)
                        {
                            label_SetWeekDay.Text += "星期四 ";
                        }
                        else if (i == 4)
                        {
                            label_SetWeekDay.Text += "星期五 ";
                        }
                        else if (i == 5)
                        {
                            label_SetWeekDay.Text += "星期六 ";
                        }
                        else if (i == 6)
                        {
                            label_SetWeekDay.Text += "星期日 ";
                        }
                    }
                }

                //label_SetWeekDay.Text ="无星期限制";
            }
            else
            {
                label_SetWeekDay.Text = "无日期限制!";
            }

            string b9_5  = form1.dgv_IcData.SelectedRows[0].Cells["Block_9"].Value.ToString().Substring(15, 2);
            string b9_6  = form1.dgv_IcData.SelectedRows[0].Cells["Block_9"].Value.ToString().Substring(18, 2);
            string b9_7  = form1.dgv_IcData.SelectedRows[0].Cells["Block_9"].Value.ToString().Substring(21, 2);
            string b9_8  = form1.dgv_IcData.SelectedRows[0].Cells["Block_9"].Value.ToString().Substring(24, 2);
            string b9_9  = form1.dgv_IcData.SelectedRows[0].Cells["Block_9"].Value.ToString().Substring(27, 2);
            string b9_10 = form1.dgv_IcData.SelectedRows[0].Cells["Block_9"].Value.ToString().Substring(30, 2);

            //if (((byte)Convert.ToInt32(b8_0) & 0x08) ==8)
            if (((byte)Int32.Parse(b8_0, NumberStyles.HexNumber) & 0x08) == 8)
            {
                label_SetDay.Text = "20" + Int32.Parse(b9_5, NumberStyles.HexNumber).ToString() + "年" +
                                    Int32.Parse(b9_6, NumberStyles.HexNumber).ToString() + "月" +
                                    Int32.Parse(b9_7, NumberStyles.HexNumber).ToString() + "日    " +
                                    "20" + Int32.Parse(b9_8, NumberStyles.HexNumber).ToString() + "年" +
                                    Int32.Parse(b9_9, NumberStyles.HexNumber).ToString() + "月" +
                                    Int32.Parse(b9_10, NumberStyles.HexNumber).ToString() + "日";
            }
            else
            {
                label_SetDay.Text = "不限定日期";
            }

            string b9_0 = form1.dgv_IcData.SelectedRows[0].Cells["Block_9"].Value.ToString().Substring(0, 2);
            string b9_1 = form1.dgv_IcData.SelectedRows[0].Cells["Block_9"].Value.ToString().Substring(3, 2);
            string b9_2 = form1.dgv_IcData.SelectedRows[0].Cells["Block_9"].Value.ToString().Substring(6, 2);
            string b9_3 = form1.dgv_IcData.SelectedRows[0].Cells["Block_9"].Value.ToString().Substring(9, 2);

            if (((byte)Int32.Parse(b8_0, NumberStyles.HexNumber) & 0x02) == 2)
            {
                label_SetTime.Text = Int32.Parse(b9_0, NumberStyles.HexNumber).ToString() + "时" +
                                     Int32.Parse(b9_1, NumberStyles.HexNumber).ToString() + "分   到    " +
                                     Int32.Parse(b9_2, NumberStyles.HexNumber).ToString() + "时" +
                                     Int32.Parse(b9_3, NumberStyles.HexNumber).ToString() + "分";
            }
            else
            {
                label_SetTime.Text = "不限定时间";
            }

            string b8_8 = form1.dgv_IcData.SelectedRows[0].Cells["Block_8"].Value.ToString().Substring(24, 2);
            string b8_9 = form1.dgv_IcData.SelectedRows[0].Cells["Block_8"].Value.ToString().Substring(27, 2);
            //label_SetTime.Text = b8_8 + " " + b8_9;
            byte _b8_8 = (byte)Int32.Parse(b8_8, NumberStyles.HexNumber);
            byte _b8_9 = (byte)Int32.Parse(b8_9, NumberStyles.HexNumber);

            //label_SetTime.Text += "----" + _b8_8.ToString("X2") + "----" + _b8_9.ToString("X2");
            label_FloorData.Text = "";

            if (_b8_8 >= 0 || _b8_9 >= 0)
            {
                int i;
                for (i = 0; i < 8; i++)
                {
                    if (((_b8_8 >> i) & 0x01) == 0x01)
                    {
                        if (i == 0)
                        {
                            label_FloorData.Text += "1 ";
                        }
                        else if (i == 1)
                        {
                            label_FloorData.Text += "2 ";
                        }
                        else if (i == 2)
                        {
                            label_FloorData.Text += "3 ";
                        }
                        else if (i == 3)
                        {
                            label_FloorData.Text += "4 ";
                        }
                        else if (i == 4)
                        {
                            label_FloorData.Text += "5 ";
                        }
                        else if (i == 5)
                        {
                            label_FloorData.Text += "6 ";
                        }
                        else if (i == 6)
                        {
                            label_FloorData.Text += "7 ";
                        }
                        else if (i == 7)
                        {
                            label_FloorData.Text += "8 ";
                        }
                    }
                }
                for (i = 0; i < 8; i++)
                {
                    if (((byte)_b8_9 >> i & 0x01) == 0x01)
                    {
                        if (i == 0)
                        {
                            label_FloorData.Text += "9 ";
                        }
                        else if (i == 1)
                        {
                            label_FloorData.Text += "10 ";
                        }
                        else if (i == 2)
                        {
                            label_FloorData.Text += "11 ";
                        }
                        else if (i == 3)
                        {
                            label_FloorData.Text += "12 ";
                        }
                        else if (i == 4)
                        {
                            label_FloorData.Text += "13 ";
                        }
                        else if (i == 5)
                        {
                            label_FloorData.Text += "14 ";
                        }
                        else if (i == 6)
                        {
                            label_FloorData.Text += "15 ";
                        }
                        else if (i == 7)
                        {
                            label_FloorData.Text += "16 ";
                        }
                    }
                }
            }
            else
            {
                label_FloorData.Text = "没有可用的楼层!";
            }
        }