Exemplo n.º 1
0
        private void btnMemberAdd_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (cmbMember.SelectedItem == null)
                {
                    throw new BusinessException("会员参数设置", "请选择会员类型");
                }
                if (cmbMemberType.SelectedItem == null)
                {
                    throw new BusinessException("会员参数设置", "请选择参数类型");
                }
                string    strSql       = "select * from tbMemberCode where cnvcMemberName ='" + cmbMember.Text + "' and cnvcMemberType='" + cmbMemberType.Text + "'";
                DataTable dtMemberCode = Helper.Query(strSql);
                if (dtMemberCode.Rows.Count > 0)
                {
                    throw new BusinessException("会员参数设置", "【会员类型+参数类型】已存在");
                }
                if (txtMemberValue.Text.Trim().Length == 0)
                {
                    throw new BusinessException("会员参数设置", "请输入参数值");
                }
                if (!txtMemberValue.Text.Equals(ConstApp.Free_Time_NoLimit))
                {
                    int.Parse(txtMemberValue.Text);
                    if (int.Parse(txtMemberValue.Text) < 0)
                    {
                        throw new BusinessException("会员参数设置", "请输入正数");
                    }
                }

                MemberCode memberCode = new MemberCode();
                memberCode.cnvcMemberName  = cmbMember.Text;
                memberCode.cnvcMemberType  = cmbMemberType.Text;
                memberCode.cnvcMemberValue = txtMemberValue.Text;
                MemberManageFacade memberManage = new MemberManageFacade();
                memberManage.AddMemberCode(memberCode);
                MessageBox.Show(this, "会员参数添加成功!", "会员参数设置", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cmbMember_ValueChanged(null, null);
                SysInit.LoadPara(Login.constApp);
            }
            catch (BusinessException bex)
            {
                MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message + "\n参数异常,请核查", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void btnDelete_Click(object sender, System.EventArgs e)
        {
            try
            {
                DialogResult strRet = MessageBox.Show(this, "是否删除?", "会员参数设置", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (strRet == DialogResult.Yes)
                {
                    UltraGridRow row = this.ultraGrid1.ActiveRow;
                    if (null == row)
                    {
                        throw new BusinessException("参数设置", "请选择参数");
                    }
                    if (cmbType.SelectedItem == null)
                    {
                        throw new BusinessException("参数设置", "请选择参数类型");
                    }
                    if (txtValue.Text.Trim().Length == 0)
                    {
                        throw new BusinessException("参数设置", "请输入参数值");
                    }
                    string    strType    = row.Cells["cnvcType"].Value.ToString();
                    DataTable dtNameCode = Helper.Query("select * from tbNameCode where cnvcType='" + strType + "'");
                    if (dtNameCode.Rows.Count < 2)
                    {
                        throw new BusinessException("会员参数设置", "【参数类型】+【参数值】必须要有");
                    }

                    NameCode nameCode = new NameCode();
                    nameCode.cnvcCodeID = int.Parse(row.Cells["cnvcCodeID"].Value.ToString());
                    MemberManageFacade memberManage = new MemberManageFacade();
                    memberManage.DeleteNameCode(nameCode);
                    MessageBox.Show(this, "参数删除成功!", "参数设置", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    BindNamecode();
                    BindMemberRight();
                    cmbMember_ValueChanged(null, null);
                    //Helper.BindMemberCode(cmbMemberType);

                    SysInit.LoadPara(Login.constApp);
                }
            }
            catch (BusinessException bex)
            {
                MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
        private void btnMemberDelete_Click(object sender, System.EventArgs e)
        {
            try
            {
                DialogResult strRet = MessageBox.Show(this, "是否删除?", "会员参数设置", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (strRet == DialogResult.Yes)
                {
                    UltraGridRow row = this.ultraGrid2.ActiveRow;
                    if (null == row)
                    {
                        throw new BusinessException("会员参数设置", "请选择会员参数");
                    }
                    if (cmbMember.SelectedItem == null)
                    {
                        throw new BusinessException("会员参数设置", "请选择会员类型");
                    }
                    if (cmbMemberType.SelectedItem == null)
                    {
                        throw new BusinessException("会员参数设置", "请选择参数类型");
                    }
                    string    strSql       = "select * from tbMemberCode where cnvcMemberName ='" + cmbMember.Text + "' and cnvcMemberType='" + cmbMemberType.Text + "'";
                    DataTable dtMemberCode = Helper.Query(strSql);
                    if (dtMemberCode.Rows.Count == 0)
                    {
                        throw new BusinessException("会员参数设置", "【会员类型+参数类型】不存在");
                    }

                    MemberCode memberCode = new MemberCode();
                    memberCode.cnnMemberCodeID = int.Parse(row.Cells["cnnMemberCodeID"].Value.ToString());
                    MemberManageFacade memberManage = new MemberManageFacade();
                    memberManage.DeleteMemberCode(memberCode);
                    MessageBox.Show(this, "会员参数删除成功!", "会员参数设置", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cmbMember_ValueChanged(null, null);
                    SysInit.LoadPara(Login.constApp);
                }
            }
            catch (BusinessException bex)
            {
                MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        private void btnMemberModify_Click(object sender, System.EventArgs e)
        {
            try
            {
                UltraGridRow row = this.ultraGrid2.ActiveRow;
                if (null == row)
                {
                    throw new BusinessException("会员参数设置", "请选择会员参数");
                }
                if (cmbMember.SelectedItem == null)
                {
                    throw new BusinessException("会员参数设置", "请选择会员类型");
                }

                if (cmbMemberType.SelectedItem == null)
                {
                    throw new BusinessException("会员参数设置", "请选择参数类型");
                }
                string strType  = row.Cells["cnvcMemberType"].Value.ToString();
                string strValue = row.Cells["cnvcMemberValue"].Value.ToString();
                if (strType != cmbMemberType.Text)
                {
                    throw new BusinessException("会员参数设置", "参数类型不能修改");
                }
                string    strSql       = "select * from tbMemberCode where cnvcMemberName ='" + cmbMember.Text + "' and cnvcMemberType='" + cmbMemberType.Text + "'";
                DataTable dtMemberCode = Helper.Query(strSql);
                if (dtMemberCode.Rows.Count == 0)
                {
                    throw new BusinessException("会员参数设置", "【会员类型+参数类型】不存在");
                }
                if (txtMemberValue.Text.Trim().Length == 0)
                {
                    throw new BusinessException("会员参数设置", "请输入参数值");
                }
                if (!txtMemberValue.Text.Equals(ConstApp.Free_Time_NoLimit))
                {
                    int.Parse(txtMemberValue.Text);
                    if (int.Parse(txtMemberValue.Text) < 0)
                    {
                        throw new BusinessException("会员参数设置", "请输入正数");
                    }
                    if (strValue == txtMemberValue.Text)
                    {
                        throw new BusinessException("会员参数设置", "请修改参数值");
                    }
                }

                strSql = "select * from tbJob where convert(varchar(100),cnvcJobTheme)='" + cmbMember.Text + "' and GETDATE() between cndBeginDate and cndEndDate";
                DataTable dtJob = Helper.Query(strSql);
                if (dtJob.Rows.Count > 0)
                {
                    throw new BusinessException("商品管理", "招聘会已开始不能修改");
                }

                MemberCode memberCode = new MemberCode(dtMemberCode);
                memberCode.cnnMemberCodeID = int.Parse(row.Cells["cnnMemberCodeID"].Value.ToString());
                memberCode.cnvcMemberType  = cmbMemberType.Text;
                memberCode.cnvcMemberValue = txtMemberValue.Text;
                MemberManageFacade memberManage = new MemberManageFacade();
                memberManage.ModifyMemberCode(memberCode);
                MessageBox.Show(this, "会员参数修改成功!", "会员参数设置", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cmbMember_ValueChanged(null, null);
                SysInit.LoadPara(Login.constApp);
            }
            catch (BusinessException bex)
            {
                MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message + "\n参数异常,请核查", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
        private void btnModify_Click(object sender, System.EventArgs e)
        {
            try
            {
                UltraGridRow row = this.ultraGrid1.ActiveRow;
                if (null == row)
                {
                    throw new BusinessException("参数设置", "请选择参数");
                }
                if (cmbType.SelectedItem == null)
                {
                    throw new BusinessException("参数设置", "请选择参数类型");
                }
                if (txtValue.Text.Trim().Length == 0)
                {
                    throw new BusinessException("参数设置", "请输入参数值");
                }
                string strType  = row.Cells["cnvcType"].Value.ToString();
                string strValue = row.Cells["cnvcValue"].Value.ToString();
                if (strType != cmbType.Text)
                {
                    throw new BusinessException("参数设置", "参数类型不能修改");
                }
                if (strValue == txtValue.Text)
                {
                    throw new BusinessException("参数设置", "请修改参数值");
                }
                DataTable dtNameCode = Helper.Query("select * from tbNameCode where cnvcType='" + cmbType.Text + "' and cnvcValue='" + txtValue.Text + "'");
                if (dtNameCode.Rows.Count > 0)
                {
                    throw new BusinessException("参数设置", "【参数类型】+【参数值】已存在");
                }
                if (cmbType.Text == ConstApp.TouchFlash)
                {
                    //JudgeOne(cmbType.Text);
                    int.Parse(txtValue.Text);
                }
                if (cmbType.Text == ConstApp.TouchBookBeginDate ||
                    cmbType.Text == ConstApp.TouchBookEndDate ||
                    cmbType.Text == ConstApp.TouchSignInBeginDate ||
                    cmbType.Text == ConstApp.TouchSignInEndDate
                    )
                {
                    //JudgeOne(cmbType.Text);
                    if (txtValue.Text.IndexOf(":") < 0)
                    {
                        throw new BusinessException("会员参数设置", "请输入时间格式,例如05:01");
                    }
                    //string strValue = txtValue.Text;
                    string[] strValues = txtValue.Text.Split(':');
//					string strHour = strValues[0];
//					string strMinute = strValues[1];
                    int.Parse(strValues[0]);
                    int.Parse(strValues[1]);
                }
                if (cmbType.Text == ConstApp.BookDate)
                {
                    int.Parse(txtValue.Text);
                }
                if (cmbType.Text == ConstApp.tishi)
                {
                    int.Parse(txtValue.Text);
                }

                string    strSql = "select * from tbJob where convert(varchar(100),cnvcJobTheme)='" + strValue + "' ";
                DataTable dtJob  = Helper.Query(strSql);
                if (dtJob.Rows.Count > 0)
                {
                    throw new BusinessException("商品管理", "招聘会已使用不能修改");
                }

                NameCode nameCode = new NameCode(dtNameCode);
                nameCode.cnvcCodeID = int.Parse(row.Cells["cnvcCodeID"].Value.ToString());
                nameCode.cnvcType   = cmbType.Text;
                nameCode.cnvcValue  = txtValue.Text;


                MemberManageFacade memberManage = new MemberManageFacade();
                memberManage.ModifyNameCode(nameCode);
                MessageBox.Show(this, "参数修改成功!", "会员参数设置", MessageBoxButtons.OK, MessageBoxIcon.Information);
                BindNamecode();
                BindMemberRight();
                cmbMember_ValueChanged(null, null);
                SysInit.LoadPara(Login.constApp);
            }
            catch (BusinessException bex)
            {
                MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message + "\n参数异常,请核查", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 6
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (cmbType.SelectedItem == null)
                {
                    throw new BusinessException("会员参数设置", "请选择参数类型");
                }
                if (txtValue.Text.Trim().Length == 0)
                {
                    throw new BusinessException("会员参数设置", "请输入参数值");
                }
                DataTable dtNameCode = Helper.Query("select * from tbNameCode where cnvcType='" + cmbType.Text + "' and cnvcValue='" + txtValue.Text + "'");
                if (dtNameCode.Rows.Count > 0)
                {
                    throw new BusinessException("会员参数设置", "【参数类型】+【参数值】已存在");
                }

                if (cmbType.Text == ConstApp.TouchFlash)
                {
                    JudgeOne(cmbType.Text);
                    int.Parse(txtValue.Text);
                }
                if (cmbType.Text == ConstApp.TouchBookBeginDate ||
                    cmbType.Text == ConstApp.TouchBookEndDate ||
                    cmbType.Text == ConstApp.TouchSignInBeginDate ||
                    cmbType.Text == ConstApp.TouchSignInEndDate
                    )
                {
                    JudgeOne(cmbType.Text);
                    if (txtValue.Text.IndexOf(":") < 0)
                    {
                        throw new BusinessException("会员参数设置", "请输入时间格式,例如05:01");
                    }
                    string   strValue  = txtValue.Text;
                    string[] strValues = strValue.Split(':');
                    string   strHour   = strValues[0];
                    string   strMinute = strValues[1];
                    int.Parse(strHour);
                    int.Parse(strMinute);
                }
                if (cmbType.Text == ConstApp.BookDate)
                {
                    JudgeOne(cmbType.Text);
                    int.Parse(txtValue.Text);
                }
                if (cmbType.Text == ConstApp.tishi)
                {
                    JudgeOne(cmbType.Text);
                    int.Parse(txtValue.Text);
                }
                NameCode nameCode = new NameCode();
                nameCode.cnvcType  = cmbType.Text;
                nameCode.cnvcValue = txtValue.Text;
                MemberManageFacade memberManage = new MemberManageFacade();
                memberManage.AddNameCode(nameCode);
                MessageBox.Show(this, "参数添加成功!", "会员参数设置", MessageBoxButtons.OK, MessageBoxIcon.Information);
                BindNamecode();
                BindMemberRight();
                cmbMember_ValueChanged(null, null);
                SysInit.LoadPara(Login.constApp);
            }
            catch (BusinessException bex)
            {
                MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 7
0
        private void btnBrushCard_Click(object sender, System.EventArgs e)
        {
            //刷卡登录
            try
            {
                //读取会员卡号
                iLoginTime += 1;
                if (iLoginTime > 3)
                {
                    Application.Exit();
                }
                else
                {
                    CardM1 m1        = new CardM1();
                    string strCardNo = "";
                    string strRet    = m1.ReadCard(out strCardNo);                 //,out dtemp,out itemp);

                    if (strRet != ConstMsg.RFOK)
                    {
                        throw new BusinessException("卡操作失败", "读取操作员卡失败!");
                    }
                    DataTable dtOper = Helper.Query("select * from tbOper where cnvcCardNo is not null and cnvcCardNo = '" + strCardNo + "'");
                    if (dtOper.Rows.Count == 0)
                    {
                        throw new BusinessException("登录", "未找到操作员");
                    }
                    if (dtOper.Rows.Count > 1)
                    {
                        throw new BusinessException("登录", "未找到操作员");
                    }

                    Oper   oper = new Oper(dtOper);
                    byte[] bIn  = Convert.FromBase64String(oper.cnvcPwd);
                    byte[] bRet = Cryptographer.DecryptSymmetric("Custom Symmetric Cryptography Provider", bIn);
                    if (bRet == null)
                    {
                        throw new BusinessException("登录", "密码错误");
                    }
                    string strpwd = Encoding.UTF8.GetString(bRet);
                    SysInit.LoadPara(Login.constApp);
                    LogIn(oper.cnvcOperName, strpwd, Login.constApp.strCardTypeL6Name, Login.constApp.strCardTypeL8Name);
                    SecurityManage security = new SecurityManage();
                    //security.OperLogin(oper.cnvcOperName);//,oper.cnvcPwd);
                    //constApp.alOperFunc = security.alOperFunc;
                    //constApp.oper = security.oper;
                    //constApp.iDiscount = security.iDiscount;
                    //SysInit.LoadPara(Login.constApp);

                    OperLogin login = new OperLogin(oper.ToTable());
                    login.cndLoginDate    = DateTime.Now;
                    login.cnvcLoginMethod = "刷卡";
                    login.cnnAgainTime    = iLoginTime;
                    security.LoginLog(login);
                    MainForm mForm = new MainForm();
                    //mForm.ll = this;
                    mForm.Owner = this;
                    mForm.Show();
                    this.Hide();                    // = false;
                }
            }
            catch (BusinessException bex)
            {
                MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            //catch (System.Exception ex)
            //{
            //    MessageBox.Show(this,ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
            //}
        }
Exemplo n.º 8
0
        private void btnLogin_Click(object sender, System.EventArgs e)
        {
            //登录
            try
            {
                if (iLoginTime > 3)
                {
                    Application.Exit();
                }
                else
                {
                    string strOperName = txtOperName.Text.Trim();
                    string strPWD      = txtPWD.Text.Trim();
                    if (strOperName.Length == 0)
                    {
                        throw new BusinessException("登录错误", "请输入用户名!");
                    }
                    if (strPWD.Length == 0)
                    {
                        throw new BusinessException("登录错误", "请输入密码!");
                    }
                    SysInit.LoadPara(Login.constApp);
                    LogIn(strOperName, strPWD, Login.constApp.strCardTypeL6Name, Login.constApp.strCardTypeL8Name);
                    SecurityManage security = new SecurityManage();

                    //security.OperLogin(strOperName);//,DataSecurity.Encrypt(strPWD);
                    //constApp.alOperFunc = security.alOperFunc;
                    //constApp.oper = security.oper;
                    //constApp.iDiscount = security.iDiscount;
                    //isLogin = true;
                    //constApp = new ConstApp();
                    //LogAdapter.WriteFeaturesException(new Exception("导入基本数据前"));


                    //LogAdapter.WriteFeaturesException(new Exception("导入基本数据后"));

                    OperLogin login = new OperLogin();
                    if (cmbDept.SelectedItem != null)
                    {
                        login.cnnDeptID = int.Parse(cmbDept.SelectedItem.DataValue.ToString());
                    }

                    login.cnvcOperName    = txtOperName.Text;
                    login.cndLoginDate    = DateTime.Now;
                    login.cnvcLoginMethod = "录入";
                    login.cnnAgainTime    = iLoginTime;
                    security.LoginLog(login);

                    //LogAdapter.WriteFeaturesException(new Exception("写登录日志"));
                    MainForm mForm = new MainForm();
                    mForm.Owner = this;
                    //mForm.ll = this;
                    //LogAdapter.WriteFeaturesException(new Exception("主窗体new完成"));
                    mForm.Show();
                    //LogAdapter.WriteFeaturesException(new Exception("主窗体show完成"));
                    this.Hide();
                    //LogAdapter.WriteFeaturesException(new Exception("主窗体打开完成"));
                }
            }
            catch (BusinessException bex)
            {
                iLoginTime += 1;
                //MessageBox.Show(this, bex.Message, bex.Type,MessageBoxButtons.OK,MessageBoxIcon.Error);
                this.txtOperName.Focus();
                throw bex;
                //isLogin = false;
            }
            //catch (System.Exception ex)
            //{
            //    MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    Application.Exit();
            //    //this.btnLogin.DialogResult = DialogResult.Cancel;
            //}
        }