Exemple #1
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            userName = textBox_UserName.Text.Trim();
            password = textBox_Password.Text.Trim();
            if (ValidationService.CheckNull(userName) || ValidationService.CheckNull(password))
            {
                XtraMessageBox.Show("用户名或密码不能为空!");
                return;
            }
            //CheckAdminUser();
            UserInfo userInfo = new UserInfo();

            userInfo.UserName = userName;
            userInfo.Password = EncodeHelper.DesEncrypt(password);
            if (userName == "admin" && password == "admin")
            //if (MongoHelper.GetInstance().CheckUserLogin(userInfo))
            {
                this.Hide();
                FrmStartup spScreen = new FrmStartup();

                Program.SetMainForm(spScreen);
                Program.ShowMainForm();
                //Thread.Sleep(5000);
                //Program.SetMainForm(new FrmMain());
                //Program.ShowMainForm();

                if (checkBoxRemember.Checked == true)
                {
                    string string64 = EncodeHelper.DesEncrypt(userName + "|" + password);
                    parsedData["GeneralConfiguration"]["LoginInfo"] = string64;
                    fileIniData.WriteFile(iniFilePath, parsedData);
                }
                else
                {
                    parsedData["GeneralConfiguration"]["LoginInfo"] = "";
                    fileIniData.WriteFile(iniFilePath, parsedData);
                }
                if (radioGroup1.SelectedIndex == 0)
                {
                    parsedData["GeneralConfiguration"]["Index"] = "0";
                    fileIniData.WriteFile(iniFilePath, parsedData);
                }
                else if (radioGroup1.SelectedIndex == 1)
                {
                    parsedData["GeneralConfiguration"]["Index"] = "1";
                    fileIniData.WriteFile(iniFilePath, parsedData);
                }
                else if (radioGroup1.SelectedIndex == 2)
                {
                    parsedData["GeneralConfiguration"]["Index"] = "2";
                    fileIniData.WriteFile(iniFilePath, parsedData);
                }
                this.Close();
            }
            else
            {
                XtraMessageBox.Show("用户名或密码错误!");
                return;
            }
        }
Exemple #2
0
        private void simpleButtonConform_Click(object sender, EventArgs e)
        {
            userName = textBox_UserName.Text.Trim();
            password = textBox_Password.Text.Trim();
            if (ValidationService.CheckNull(userName) || ValidationService.CheckNull(password))
            {
                XtraMessageBox.Show("用户名或密码不能为空!");
                return;
            }
            if (null != mUserInfo)
            {
                MongoHelper.GetInstance().DeleteUserInfo(mUserInfo);
            }
            UserInfo userInfo = new UserInfo();

            userInfo.UserName     = userName;
            userInfo.Password     = EncodeHelper.DesEncrypt(password);
            userInfo.CreateTime   = new BsonDateTime(DateTime.Now);
            userInfo.AccountName  = textBox_AccountName.Text;
            userInfo.PhoneNumber  = textBox_Phone.Text;
            userInfo.EmailAddress = textBox_Email.Text;
            userInfo.UserRole     = "1";
            bool ret = MongoHelper.GetInstance().AddUser(userInfo);

            if (ret)
            {
                if (bModified)
                {
                    XtraMessageBox.Show("修改成功!");
                }
                else
                {
                    XtraMessageBox.Show("添加成功!");
                }
            }
            else
            {
                if (bModified)
                {
                    XtraMessageBox.Show("修改失败!");
                }
                else
                {
                    XtraMessageBox.Show("添加失败!");
                }
                return;
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
Exemple #3
0
        private void simpleButtonConform_Click(object sender, EventArgs e)
        {
            int retRst = -1;

            crossId   = textBox_CrossId.Text.Trim();
            crossName = textBox_CrossName.Text.Trim();
            if (ValidationService.CheckNull(crossId) || ValidationService.CheckNull(crossName))
            {
                XtraMessageBox.Show("通道编号和名称不能为空!");
                return;
            }
            if (bModified == false)
            {
                retRst = dal.AddCrossing(crossId, crossName);
            }
            if (bModified)
            {
                retRst = dal.UpdateCrossing(crossId, crossName, mCrossInfo.ID);
            }
            if (retRst >= 0)
            {
                if (bModified)
                {
                    XtraMessageBox.Show("修改成功!");
                }
                else
                {
                    XtraMessageBox.Show("添加成功!");
                }
            }
            else
            {
                if (bModified)
                {
                    XtraMessageBox.Show("修改失败!");
                }
                else
                {
                    XtraMessageBox.Show("添加失败!");
                }
                return;
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
Exemple #4
0
        private void FrmUserLogin_Load(object sender, EventArgs e)
        {
            iniFilePath = Application.StartupPath + "\\TIEVision.ini";
            parsedData  = fileIniData.ReadFile(iniFilePath);
            LoginInfo   = parsedData["GeneralConfiguration"]["LoginInfo"];

            if (!ValidationService.CheckNull(LoginInfo))
            {
                string[] UserPass = EncodeHelper.DesDecrypt(LoginInfo).Split('|');
                if (UserPass.Length == 2)
                {
                    textBox_UserName.Text = UserPass[0];
                    textBox_Password.Text = UserPass[1];
                }
            }
            else
            {
                checkBoxRemember.Checked = false;
            }


            string nIndex = IniInfoHelper.GetInstance().GetValueInfo("GeneralConfiguration", "Index");

            radioGroup1.SelectedIndex = Convert.ToInt32(nIndex);
            radioGroup1_SelectedIndexChanged(null, null);
            //Bitmap img = new Bitmap("D:\\images\\body.jpg");
            //FileStream fs = new FileStream("D:\\cie1931_500x500.rgb", FileMode.Open, FileAccess.Read);
            //int nBytes = (int)fs.Length;
            //byte[] byteArray = new byte[nBytes];
            //int nBytesRead = fs.Read(byteArray, 0, nBytes);
            //using (MemoryStream br = new MemoryStream(byteArray))
            //{
            //    Image image = System.Drawing.Image.FromStream(br);
            //    btn_login.Image = image;
            //}
            //Console.WriteLine(img.Size);
            //SplashScreenManager.ShowForm(typeof(WaitForm1));
        }
        private void InitializeQuery()
        {
            if (!ValidationService.CheckNull(dtpStrartTime.Text))
            {
                queryStrartTime        = Convert.ToDateTime(dtpStrartTime.EditValue.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                mTargetQuery.timeStart = queryStrartTime;
            }
            else
            {
                queryStrartTime = null;
            }
            if (!ValidationService.CheckNull(dtpEndTime.Text))
            {
                queryEndTime         = Convert.ToDateTime(dtpEndTime.EditValue.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                mTargetQuery.timeEnd = queryEndTime;
            }
            else
            {
                queryEndTime = null;
            }

            //车牌号码
            if (!ValidationService.CheckNull(textBoxCphm.Text))
            {
                queryCphm = textBoxCphm.Text.ToString();
                mTargetQuery.queryCphm = queryCphm;
            }
            else
            {
                queryCphm = null;
                mTargetQuery.queryCphm = null;
            }
            if (!ValidationService.CheckNull(cbbox_vehiclecolor.Text))
            {
                queryClys = (string)cbbox_vehiclecolor.EditValue;
                mTargetQuery.queryClys = queryClys;
            }
            else
            {
                queryClys = null;
                mTargetQuery.queryClys = null;
            }
            //行为特征
            if (!ValidationService.CheckNull(checkedComboBoxEditXwtz.Text))
            {
                queryXwtz = (string)checkedComboBoxEditXwtz.EditValue;
                queryXwtz = queryXwtz.Replace(",", "");
                mTargetQuery.queryXwtz = queryXwtz;
            }
            else
            {
                queryXwtz = null;
                mTargetQuery.queryXwtz = null;
            }

            if (!ValidationService.CheckNull(lookUpEditType.Text))
            {
                queryCllx = lookUpEditType.EditValue.ToString();
                mTargetQuery.queryCllx = queryCllx;
            }
            else
            {
                queryCllx = null;
                mTargetQuery.queryCllx = null;
            }

            if (!ValidationService.CheckNull(lookUpEditClpp.Text))
            {
                queryClpp = lookUpEditClpp.Text.ToString();
                mTargetQuery.queryClpp = queryClpp;
            }
            else
            {
                queryClpp = null;
                mTargetQuery.queryClpp = null;
            }
        }