Beispiel #1
0
        /// <summary>
        /// 激活卡号
        /// </summary>
        /// <param name="Cardno">卡号</param>
        /// <param name="form">操作员窗体</param>
        /// <returns>返回是否激活成功!</returns>
        public string ActicateCardnoInfo(string Cardno, Form form)
        {
            //用于返回信息
            string strMsger = "";
            //接受判空返回值,判断文本框是否为空。
            string isNull = IsNull.isNull(form);
            //接受是不是数字的判断返回值
            bool isNumber = IsNull.IsNumber(Cardno);

            //判断卡号是否为空
            if (isNull == "")//没有返回值,说明不为空。
            {
                //判断卡号是否位数字
                if (isNumber == true)//是数字
                {
                    #region 激活卡号
                    //调用激活卡号的数据层接口和创建DAL层工厂,实例化具体的DAL层类
                    ActivateCardIDAL activaIDAL = (ActivateCardIDAL)fact.CreateUser("ActivateCardDAL");
                    //转换为实体
                    RegistrationCardno registCardno = new RegistrationCardno();
                    registCardno.StudentCardno = int.Parse(Cardno);//给实体卡号赋值
                    //获取卡号信息
                    DataTable CardnoInfoTable = activaIDAL.SelectRegistartCardnoInfo(registCardno);
                    //判断卡号是否存在
                    if (CardnoInfoTable.Rows.Count != 0)//说明卡号存在
                    {
                        //判断卡号目前的使用状态,是否已经被激活。
                        if (CardnoInfoTable.Rows[0][4].ToString() == "已激活")
                        {
                            strMsger = "此卡号已经被激活,请勿重复操作!";
                        }
                        else
                        {
                            //更新卡号状态为,已激活。
                            registCardno.State = "已激活";                 //给卡号状态从新赋值
                            activaIDAL.UpdateCardnoState(registCardno); //更新卡号状态
                            strMsger = "卡号激活成功!";
                        }
                    }
                    else
                    {
                        //说明卡号不存在
                        strMsger = "卡号不存在,请从新输入!";
                    }
                    #endregion
                }
                else
                {
                    strMsger = "卡号请输入数字!";
                }
            }
            else
            {
                //否则为空
                strMsger = isNull;
            }
            return(strMsger);
        }
        /// <summary>
        /// 重置学生密码
        /// </summary>
        /// <param name="cardno">卡号</param>
        /// <param name="newpwd">新密码</param>
        /// <param name="newpwdok">确认密码</param>
        /// <param name="form">重置学生密码窗体</param>
        /// <returns></returns>
        public string StudentPwdOpertion(string cardno, string newpwd, string newpwdok, Form form)
        {
            //用于返回信息
            string StrMsg = "";
            //接受判空返回值,判断文本框是否为空。
            string isNull = IsNull.isNull(form);
            //接受是不是数字的判断返回值
            bool isNumber = IsNull.IsNumber(cardno);

            //判断文本框是否为空
            if (isNull == "")//没有返回值,说明不为空。
            {
                //判断卡号是否是数字
                if (isNumber == true)//返回true说明输入的是数字!
                {
                    //判断密码和确认密码是否一致
                    if (newpwd == newpwdok)
                    {
                        //调用重置学生密码的数据层接口和创建DAL层的功能实例化具体的DAL层类
                        StudentPwdOpertionIDAL studentpwdopertion = (StudentPwdOpertionIDAL)fact.CreateUser("StudentPwdOpertionDAL");
                        //实例化userlevel实体
                        UserLevel user = new UserLevel();
                        user.UserID    = int.Parse(cardno);
                        user.Userlevel = "学生";
                        //调用修改密码的方法,获取用户信息!
                        DataTable userTable = studentpwdopertion.SelectUserLoginCardnoInfo(user);
                        //判断用户是否存在
                        if (userTable.Rows.Count != 0) //说明用户存在
                        {
                            user.UserPwd = newpwd;     //更新密码
                            studentpwdopertion.UpdateLoginPWD(user);
                            StrMsg = "重置成功!";
                        }
                        else
                        {
                            //用户不存在
                            StrMsg = "用户不存在,请从新输入!";
                        }
                    }
                    else
                    {
                        StrMsg = "新密码和确认密码不一致,请重新输入!";
                    }
                }
                else
                {
                    StrMsg = "卡号请输入数字!";
                }
            }
            else
            {
                StrMsg = isNull; //返回错误信息
            }
            return(StrMsg);      //返回是否成功的信息!
        }
        /// <summary>
        /// 向报表插入信息
        /// </summary>
        /// <param name="SellCash">售卡金额</param>
        /// <param name="CanCash">退卡金额</param>
        /// <param name="RecCAsh">充值金额</param>
        /// <param name="NowCash">本期金额</param>
        /// <param name="Opertion">操作员</param>
        /// <param name="Date">结账日期</param>
        /// <returns></returns>
        public string InsertRecheck(string SellCash, string CanCash, string RecCAsh, string NowCash, string Opertion, string Date, Form form, string admin)
        {
            string Strms         = "";
            string isnull        = IsNull.isNull(form);//判断文本框是否为空
            string isGroupNumber = IsNull.GroupIsNumber(form);

            //判断文本框是否为空
            if (isnull == "") //没有返回值说明不为空
            {
                //判断文本内容是否是数字
                if (isGroupNumber == "")//没有返回值,说明都是数字
                {
                    SettleAccountsIDAL settAccoutIDAL = (SettleAccountsIDAL)fact.CreateUser("SettleAccountsDAL");
                    //转成售卡实体
                    RegistrationCardno regist = new RegistrationCardno();
                    regist.OpertionID    = int.Parse(Opertion);
                    regist.AccountsState = "已结账";
                    settAccoutIDAL.UpdateRegistrationCardno(regist);//更新售卡结账状态

                    //转成充值实体
                    Recharge recharge = new Recharge();
                    recharge.OpertionID = int.Parse(Opertion);
                    recharge.State      = "已结账";
                    settAccoutIDAL.UpdateRecharge(recharge);//更新充值结账状态

                    //转成退卡实体
                    CanceCard cancardno = new CanceCard();
                    cancardno.OperationID = int.Parse(Opertion);
                    cancardno.State       = "已结账";
                    settAccoutIDAL.UpdateCancelCard(cancardno);//更新退卡结账状态

                    //向报表插入信息
                    //转成报表实体
                    Recheck recheck = new Recheck();
                    recheck.SallCash      = double.Parse(SellCash);
                    recheck.RechargeCash  = double.Parse(RecCAsh);
                    recheck.CanCash       = double.Parse(CanCash);
                    recheck.Currentincome = double.Parse(NowCash);
                    recheck.Opertion      = int.Parse(admin);
                    recheck.CheckDate     = DateTime.Parse(Date);
                    settAccoutIDAL.InsertRecheck(recheck);
                    Strms = "结账成功!";
                }
                else
                {
                    Strms = isGroupNumber;
                }
            }
            else
            {
                Strms = isnull;
            }
            return(Strms);
        }
Beispiel #4
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="UserID">用户ID</param>
        /// <param name="OldPwd">旧密码</param>
        /// <param name="NewPwd">新密码</param>
        /// <param name="NewPwdOk">确认密码</param>
        /// <param name="form">窗体</param>
        /// <returns>是否修改成功!</returns>
        public string RestUserPwd(string UserID, string OldPwd, string NewPwd, string NewPwdOk, Form form)
        {
            //用于返回信息
            string strMsger = "";
            //接受判空返回值,判断文本框是否为空。
            string isNull = IsNull.isNull(form);

            if (isNull == "")//没有返回值说明文本框不为空!
            {
                //判断新密码和确认密码是否一致
                if (NewPwd == NewPwdOk)
                {
                    //转化为实体
                    UserLevel userID = new UserLevel();
                    userID.UserID  = int.Parse(UserID);
                    userID.UserPwd = OldPwd;
                    //利用反射,实例化D层登录查询类
                    RestUserInfoPwdIDAL idal = (RestUserInfoPwdIDAL)fact.CreateUser("RestUserInfoPwdDAL");
                    //获取登录表信息
                    DataTable UserPwdTable = idal.SelectUserInfPwd(userID);
                    //查询旧密码是否正确
                    if (UserPwdTable.Rows.Count != 0)//密码正确
                    {
                        //判断新密码是否和上次的一样
                        if (NewPwd == UserPwdTable.Rows[0][2].ToString())
                        {
                            strMsger = "不能和上次密码一致!";
                        }
                        else
                        {
                            //修改用户密码
                            userID.UserPwd = NewPwd;//给新密码赋值
                            idal.UpdateUserInfoPwd(userID);
                            strMsger = "恭喜,密码修改成!";
                        }
                    }
                    else
                    {
                        //密码错误
                        strMsger = "旧密码错误,请从新输入!";
                    }//end if
                }
                else
                {
                    strMsger = "新密码和确认密码不一致,请检查下!";
                }
            }
            else
            {
                strMsger = isNull; //返回信息
            }//end if
            return(strMsger);      //返回信息
        }
Beispiel #5
0
        /// <summary>
        /// 查询上机记录
        /// </summary>
        /// <param name="studentCardno">卡号</param>
        /// <param name="form">上机记录窗体</param>
        /// <returns>上机记录信息</returns>
        public DataTable SelectLineStudent(string studentCardno, Form form, ref string StrMsg)
        {
            //用于返回信息
            StrMsg = "";
            //接受判空返回值,判断文本框是否为空。
            string isNull = IsNull.isNull(form);
            //接受是不是数字的判断返回值
            bool isNumber = IsNull.IsNumber(studentCardno);
            //获取上机记录
            DataTable LineStudentTable = new DataTable();

            //判断文本是否为空
            if (isNull == "")//没有返回值说明文本框不为空!
            {
                //判断输入的卡号是否是数字
                if (isNumber == true)//返回true说明是数字
                {
                    #region  获取上机记录
                    //转换成对应的实体
                    StudentLien studentline = new StudentLien();
                    studentline.StudentCardno = int.Parse(studentCardno);
                    //调用数据层接口和创建DAL层的工厂创建DAL层类
                    LineStudentIDAL LineStudentIDAL = (LineStudentIDAL)fact.CreateUser("LineStudentDAL");
                    //获取上机记录
                    LineStudentTable = LineStudentIDAL.SelectLineStudent(studentline);
                    #endregion
                    #region 判断卡号是否存在,或者有没有上机记录
                    if (LineStudentTable.Rows.Count == 0)//用户不存在或者没有上机记录
                    {
                        StrMsg = "用户不存在或者没有上机记录";
                    }
                    else
                    {
                        StrMsg = "查询完毕!";
                    }
                    #endregion
                }
                else
                {
                    StrMsg = "卡号请输入数字!";
                }
            }
            else
            {
                StrMsg = isNull; //把返回结果赋值给strMsger返回给U层
            }

            return(LineStudentTable); //返回处理结果
        }
Beispiel #6
0
        /// <summary>
        /// 查询充值记录
        /// </summary>
        /// <param name="Cardno">卡号</param>
        /// <param name="form">充值窗体</param>
        /// <returns>查询到的记录</returns>
        DataTable SelectRechargeIBLL.Selectrechar(string Cardno, Form form, ref string StrMsg)
        {
            //用于返回信息
            StrMsg = "";
            //接受判空返回值,判断文本框是否为空。
            string isNull = IsNull.isNull(form);
            //接受是不是数字的判断返回值
            bool isNumber = IsNull.IsNumber(Cardno);
            //接受返回的充值记录
            DataTable Selectrechar = new DataTable();

            //判断卡号是否为空
            if (isNull == "")//没有返回值,说明不为空
            {
                //判断卡号是不是数字
                if (isNumber == true)//是数字
                {
                    //调用查询记录的数据层接口和创建DAL层工厂,创建DAL层具体的类。
                    SelectRechargeIDAL selectRecharIDAL = (SelectRechargeIDAL)fact.CreateUser("SelectRechargeDAL");
                    //实例化充值实体与赋值
                    Recharge recharge = new Recharge();
                    recharge.StudentCardno = int.Parse(Cardno);                         //卡号赋值
                    Selectrechar           = selectRecharIDAL.SelectRecharge(recharge); //查询充值记录里
                    #region 查询充值记录
                    //判断卡号是否存在
                    if (Selectrechar.Rows.Count == 0)//等于零说明账号不存在!
                    {
                        StrMsg = "账号不存在,或者没有充值记录!";
                    }
                    else
                    {
                        StrMsg = "查询完毕!";
                    }
                    #endregion
                }
                else
                {
                    StrMsg = "卡号请输入数字!";
                }
            }
            else
            {
                StrMsg = isNull;
            }

            return(Selectrechar);//返回查询信息
        }
Beispiel #7
0
        /// <summary>
        /// 向基础表插入信息
        /// </summary>
        /// <param name="LimintOnCash">最小上机金额</param>
        /// <param name="LimintRecCash">最小充值金额</param>
        /// <param name="OnpreTime">准备时间</param>
        /// <param name="FixUser">固定用户收费标准</param>
        /// <param name="TemUser">临时用户收费标准</param>
        /// <param name="chargeuni">计时单位</param>
        /// <param name="Admin">管理员</param>
        /// <param name="Date">日期</param>
        /// <param name="Time">时间</param>
        /// <returns>以表形式返回</returns>
        public string InsertBaistInfo(string LimintOnCash, string LimintRecCash, string OnpreTime, string FixUser, string TemUser, string chargeuni, string Admin, string Date, string Time, Form form)
        {
            //用于返回信息
            string strMsger = "";
            //接受判空返回值,判断文本框是否为空。
            string isNull = IsNull.isNull(form);
            //判断文本框内容是否是数字
            string GroupIsNumber = IsNull.GroupIsNumber(form);

            //判断文本框是否为空
            if (isNull == "")//没有返回值说明不为空
            {
                //判断文本框内容是否是数字
                if (GroupIsNumber == "")//没有返回值说明,是数字!
                {
                    BasitDateIDAL basitIDAL = (BasitDateIDAL)fact.CreateUser("BasitDateDAL");
                    //删除上次数据
                    basitIDAL.DeleteBasiInfo();
                    //转换成实体
                    Basis basiInfo = new Basis();
                    basiInfo.LimtOnCash = double.Parse(LimintOnCash);
                    basiInfo.LimtReCash = double.Parse(LimintRecCash);
                    basiInfo.OnpreTime  = OnpreTime;
                    basiInfo.FixUser    = double.Parse(FixUser);
                    basiInfo.Admin      = Admin;
                    basiInfo.Chargeuni  = chargeuni;
                    basiInfo.Date       = DateTime.Parse(Date);
                    basiInfo.Time       = DateTime.Parse(Time);
                    basiInfo.TemUser    = double.Parse(TemUser);
                    //调用插入方法,插入新的数据
                    basitIDAL.InsertBasitInfo(basiInfo);
                    strMsger = "更新成功!";
                }
                else
                {
                    strMsger = GroupIsNumber;
                }
            }
            else
            {
                strMsger = isNull;
            }


            return(strMsger);
        }
        /// <summary>
        /// 查询余额
        /// </summary>
        /// <param name="Cardno">卡号</param>
        /// <returns>余额</returns>
        public string SelectCash(string Cardno, Form form)
        {
            //用于返回信息
            string strMsger = "";
            //接受判空返回值,判断文本框是否为空。
            string isNull = IsNull.isNull(form);
            //接受是不是数字的判断返回值
            bool isNumber = IsNull.IsNumber(Cardno);

            //判断文本框是否为空
            if (isNull == "")//没有返回值,说明不为空。
            {
                //判断卡号是否是数字
                if (isNumber == true)//是数字
                {
                    //调用查询余额数据层接口和实例化DAL数据层工厂,实例化具体的DAL层类
                    QueryCashIDAL queryIDAL = (QueryCashIDAL)fact.CreateUser("QueryCashDAL");
                    //转换成卡号实体
                    RegistrationCardno regCardno = new RegistrationCardno();
                    regCardno.StudentCardno = int.Parse(Cardno);
                    //获取卡号余额
                    DataTable SelectStuCash = queryIDAL.SelectCash(regCardno);
                    //判断卡号是否存在
                    if (SelectStuCash.Rows.Count == 0)//卡号不存在
                    {
                        strMsger = "卡号不存在,请从新输入!";
                    }
                    else
                    {
                        strMsger = SelectStuCash.Rows[0][0].ToString();//返回余额
                    }
                }
                else
                {
                    strMsger = "卡号请输入数字!";
                }
            }
            else
            {
                strMsger = isNull;
            }
            return(strMsger);
        }
        /// <summary>
        /// 注册卡号方法
        /// </summary>
        /// <param name="Cardno">卡号</param>
        /// <param name="CardnoType">卡号类型</param>
        /// <param name="CardnoPwd">密码</param>
        /// <param name="CardnoCash">余额</param>
        /// <param name="Cardnoblane">开卡金额</param>
        /// <param name="CardnoState">卡号状态</param>
        /// <param name="CardnoName">姓名</param>
        /// <param name="CardnoSex">性别</param>
        /// <param name="CardnoAge">年龄</param>
        /// <param name="CarnodNumber">电话号</param>
        /// <param name="CardnoAddess">住址</param>
        /// <param name="CardnoGarde">年级</param>
        /// <param name="weChat">微信</param>
        /// <returns></returns>
        public string RegistartonCardno(string Cardno, string CardnoType, string CardnoPwd, string CardnoCash, string Cardnoblane, string CardnoState, string CardnoName, string CardnoSex, string CardnoAge, string CarnodNumber, string CardnoAddess, string CardnoGarde, string weChat, Form form)
        {
            //用于返回信息
            string strMsger = "";
            //接受判空返回值,判断文本框是否为空。
            string isNull = IsNull.isNull(form);
            //接受是不是数字的判断返回值
            bool isNumber = IsNull.IsNumber(Cardno);

            //判断是否有值
            if (isNull == "")//不为空
            {
                //判断卡号是否是数字
                if (isNumber == true)//返回true说明是数字
                {
                    //调用注册接口和工厂创建DAL层查询。
                    RegistrationCardnoIDAL RegistIdal = (RegistrationCardnoIDAL)fact.CreateUser("RegistrationCardnoDAL");
                    #region 注册卡号

                    //查询卡号是否已经存在。
                    RegistrationCardno user = new RegistrationCardno();
                    user.StudentCardno = int.Parse(Cardno);                     //卡号赋值
                    DataTable RegitTable = RegistIdal.SelectRegistCardno(user); //获取卡号表内容


                    RegistrationCardno StuCarndo = new RegistrationCardno(); //实例化卡号实体
                    #region 判断卡号是否已经注册
                    if (RegitTable.Rows.Count == 0)                          //没有查到用户,说明没有注册。就可以进行注册
                    {
                        //获取基础表信息的最小充值金额
                        DataTable BasiTable  = RegistIdal.SelectBasit();
                        double    LimetRegch = double.Parse(BasiTable.Rows[0][1].ToString());//最小充值金额

                        #region 判断金额是否大于等于最小充值金额
                        if (double.Parse(CardnoCash) >= LimetRegch)
                        {
                            UserLevel userlevel = new UserLevel();
                            userlevel.UserID = int.Parse(Cardno);
                            DataTable SeleceLevel = RegistIdal.SelectUserLevel(userlevel);
                            //判断卡号是否和管理者冲突
                            if (SeleceLevel.Rows.Count == 0)
                            {
                                #region 添加注册信息
                                //添加登录信息
                                UserLevel use = new UserLevel();
                                use.UserID    = int.Parse(Cardno);
                                use.Userlevel = "学生";            //级别
                                use.UserPwd   = CardnoPwd;       //密码
                                RegistIdal.InsertUserLogin(use); //向登录表添加信息

                                #region 给卡号实体赋值
                                StuCarndo.StudentCardno  = int.Parse(Cardno);        //卡号
                                StuCarndo.StudentLeve    = CardnoType;               //学生类型
                                StuCarndo.Initialamount  = int.Parse(Cardnoblane);   //开卡金额
                                StuCarndo.State          = CardnoState;              //使用状态
                                StuCarndo.Studentbalance = double.Parse(CardnoCash); //余额
                                StuCarndo.OpertionID     = UserLevel.UserIdall;      //操作员ID
                                StuCarndo.AccountsState  = "未结账";                    //结账状态
                                #endregion
                                RegistIdal.InsertCarndo(StuCarndo);                  //向卡号表插入信息
                                #region 实例化学生信息与赋值
                                StudentInfo studentinfo = new StudentInfo();
                                studentinfo.StudentCardno = int.Parse(Cardno);    //卡号
                                studentinfo.Grade         = CardnoGarde;          //年级
                                studentinfo.HomeAddress   = CardnoAddess;         //住址
                                studentinfo.Name          = CardnoName;           //姓名
                                studentinfo.Sex           = CardnoSex;            //性别
                                studentinfo.WeChat        = weChat;               //微信
                                studentinfo.Age           = int.Parse(CardnoAge); //年龄
                                studentinfo.CallNumber    = CarnodNumber;         //手机号码
                                #endregion
                                RegistIdal.InsertStudentInfo(studentinfo);        //向学生信息表插入信息
                                #region 向充值记录表添加信息
                                //调用充值接口和创建DAL层的工厂,实例化DAL层具体的类
                                RechargeIDAL RecarIDAL = (RechargeIDAL)fact.CreateUser("RechargeDAL");
                                //插入充值记录
                                Recharge recahrge = new Recharge();                        //实例化充值表实体
                                recahrge.StudentCardno = int.Parse(Cardno);                //充值卡号
                                recahrge.RechargeCash  = double.Parse(CardnoCash);         //充值金额
                                recahrge.OpertionID    = UserLevel.UserIdall;              //充值的操作员
                                recahrge.RechargeDate  = DateTime.Now.Date;                //充值日期
                                recahrge.RechargeTime  = DateTime.Now.ToShortTimeString(); //充值时间
                                recahrge.State         = "未结账";                            //结账状态
                                                                                           //调用插入方法
                                RecarIDAL.InsertRecharge(recahrge);
                                #endregion
                                #endregion
                                strMsger = "注册成功!";
                            }
                            else
                            {
                                strMsger = "此卡号与管理者冲突,请从新输入!";
                            }
                        }
                        else//否则提醒,充值金额小于最小充值金额!
                        {
                            strMsger = "温馨提示,充值金额不得小于" + LimetRegch + "元";
                        }//end if
                        #endregion
                    }
                    else//否则说明已经注册,就进行激活或者提醒卡号已注册。
                    {
                        StuCarndo.StudentCardno = int.Parse(Cardno);
                        DataTable CardnoTable = RegistIdal.SelectRegistCardno(StuCarndo); //获取卡号信息
                                                                                          //判断卡号是否已经激活
                        if (CardnoTable.Rows[0][4].ToString() != "已激活")
                        {
                            //进行激活操作
                            StuCarndo.State = "已激活";
                            RegistIdal.UpdateCardnoState(StuCarndo);//激活卡号
                            strMsger = "卡号激活成功!";
                        }
                        else
                        {
                            strMsger = "此卡号已激活,请从新输入卡号!";
                        }
                    }
                    #endregion
                    #endregion
                }
                else
                {
                    strMsger = "卡号请输入数字!";
                }
            }
            else
            {
                strMsger = isNull;//返回错误
            }//end if
            return(strMsger);
        }
        /// <summary>
        /// 充值方法
        /// </summary>
        /// <param name="Cardno">充值的卡号</param>
        /// <param name="Cash">充值金额</param>
        /// <returns>是否充值成功</returns>
        public string Rechargebll(string Cardno, Form form, string Cash)
        {
            //用于返回信息
            string strMsger = "";
            //接受判空返回值,判断文本框是否为空。
            string isNull = IsNull.isNull(form);
            //接受是不是数字的判断返回值
            bool isNumber = IsNull.IsNumber(Cardno);
            bool isCash   = IsNull.IsNumber(Cash);

            //判断文本是否为空
            if (isNull == "")//没有返回值说明不为空
            {
                //判断输入的卡号是否为数字
                if (isNumber != true)//不是数字
                {
                    strMsger = "卡号请输入数字";
                }
                else//否则是数字
                {
                    #region 获取卡号信息
                    //调用充值接口和创建DAL层的工厂,实例化DAL层具体的类
                    RechargeIDAL RecarIDAL = (RechargeIDAL)fact.CreateUser("RechargeDAL");
                    //转换为卡号实体
                    RegistrationCardno RegistCardno = new RegistrationCardno();
                    RegistCardno.StudentCardno = int.Parse(Cardno);//给卡号赋值
                    //获取卡号信息
                    DataTable CardnoInfoTable = RecarIDAL.SelectStudentCardno(RegistCardno);
                    #endregion
                    #region 充值
                    //判断卡号是否存在
                    if (CardnoInfoTable.Rows.Count != 0)//不等于零,说明卡号存在。
                    {
                        //判断卡号使用状态
                        if (CardnoInfoTable.Rows[0][4].ToString() == "已激活")
                        {
                            //获取基础表信息
                            DataTable Baist = RecarIDAL.SelectBast();
                            #region 判断充值金额
                            if (isCash != true)//充值金额不是数字
                            {
                                strMsger = "充值金额请输入数字!";
                            }
                            else
                            {
                                //判断充值金额是否大于或等于最小充值金额
                                if (double.Parse(Cash) >= double.Parse(Baist.Rows[0][1].ToString()))
                                {
                                    //插入充值记录
                                    Recharge recahrge = new Recharge();                        //实例化充值表实体
                                    recahrge.StudentCardno = int.Parse(Cardno);                //充值卡号
                                    recahrge.RechargeCash  = double.Parse(Cash);               //充值金额
                                    recahrge.OpertionID    = UserLevel.UserIdall;              //充值的操作员
                                    recahrge.RechargeDate  = DateTime.Now.Date;                //充值日期
                                    recahrge.RechargeTime  = DateTime.Now.ToShortTimeString(); //充值时间
                                    recahrge.State         = "未结账";                            //结账状态
                                    //调用插入方法
                                    RecarIDAL.InsertRecharge(recahrge);
                                    //更新当前余额
                                    double NowCash = double.Parse(CardnoInfoTable.Rows[0][1].ToString()); //当前余额
                                    double NewCash = NowCash + double.Parse(Cash);                        //新余额=当前余额+充值余额
                                    RegistCardno.Studentbalance = NewCash;                                //给余额赋值
                                    //调用更新方法
                                    RecarIDAL.UpdateCardnoCash(RegistCardno);
                                    strMsger = "充值成功!";
                                }
                                else
                                {
                                    strMsger = "充值金额不能小于最小充值金额,请从新输入!";
                                }
                            }
                            #endregion
                        }
                        else
                        {
                            strMsger = "卡号未激活,请先激活。";
                        }
                    }
                    else
                    {
                        strMsger = "卡号不存在,请先注册!";
                    }

                    #endregion
                }
            }
            else
            {
                //否则说明为空
                strMsger = isNull;
            }
            return(strMsger);
        }
Beispiel #11
0
        /// <summary>
        /// 退卡
        /// </summary>
        /// <param name="cardno">卡号</param>
        /// <param name="form">退卡窗体</param>
        /// <returns>是否退卡成功!</returns>
        public string CancelCard(string cardno, Form form)
        {
            //用于返回信息
            string strMsger = "";
            //接受判空返回值,判断文本框是否为空。
            string isNull = IsNull.isNull(form);
            //接受是不是数字的判断返回值
            bool isNumber = IsNull.IsNumber(cardno);

            //判断卡号是否为空
            if (isNull == "")//没有返回值说明,文本框不为空。
            {
                //判断卡号是否是数字
                if (isNumber == true)//返回true是数字
                {
                    #region 退卡
                    CancelCardIDAL cancardnoIDAL = (CancelCardIDAL)fact.CreateUser("CancelCardDAL");
                    //实例化实体
                    RegistrationCardno registCardno = new RegistrationCardno();
                    registCardno.StudentCardno = int.Parse(cardno);
                    //获取卡号信息
                    DataTable CardnoInfoTable = cancardnoIDAL.SelectRegisCardnoInfo(registCardno);
                    //判断卡号是否存在
                    if (CardnoInfoTable.Rows.Count != 0)//不等于零说明,存在。
                    {
                        //向CanCardno表插入数据
                        CanceCard carnCardno = new CanceCard();
                        carnCardno.StudentCardno = int.Parse(cardno);
                        carnCardno.CanCash       = double.Parse(CardnoInfoTable.Rows[0][1].ToString());
                        carnCardno.CanDate       = DateTime.Now.Date;                //充值日期
                        carnCardno.CanTime       = DateTime.Now.ToShortTimeString(); //充值时间
                        carnCardno.OperationID   = UserLevel.UserIdall;
                        carnCardno.State         = "未结账";
                        cancardnoIDAL.InsertCanCardno(carnCardno);
                        //删除卡号信息
                        cancardnoIDAL.DeleteRegiscardnoInfo(registCardno);
                        //删除登录表信息
                        UserLevel user = new UserLevel();
                        user.UserID = int.Parse(cardno);
                        cancardnoIDAL.DeleteUserLoginCardnoInfo(user);
                        //删除学生信息
                        StudentInfo student = new StudentInfo();
                        student.StudentCardno = int.Parse(cardno);
                        cancardnoIDAL.DeleteStudentInfo(student);
                        strMsger = "退卡成功!";
                    }
                    else
                    {
                        strMsger = "卡号不存在,请重新输入!";
                    }
                    #endregion
                }
                else
                {
                    strMsger = "卡号请输入数字!";
                }
            }
            else
            {
                strMsger = isNull;
            }
            return(strMsger);
        }
        /// <summary>
        /// 登录业务
        /// </summary>
        /// <param name="userid">用户id</param>
        /// <param name="pwd">密码</param>
        /// <returns>是否登录成功</returns>
        public string loginFacade(string userid, string pwd, Form form)
        {
            //用于返回信息
            string strMsger = "";
            //接受判空返回值,判断文本框是否为空。
            string isNull = IsNull.isNull(form);
            //接受是不是数字的判断返回值
            bool isNumber = IsNull.IsNumber(userid);

            //判断文本框是否为空
            if (isNull == "")//没有返回值说明文本框不为空!
            {
                //判断UserID是不是数字
                if (isNumber == true)//等于true,说明输入的是数字!
                {
                    #region 赋值与转化实体
                    //转换为实体
                    UserLevel user = new UserLevel();
                    user.UserID  = Convert.ToInt32(userid);
                    user.UserPwd = pwd;
                    #endregion
                    #region 调用D层登录查询
                    //利用反射,实例化D层登录查询类
                    LoginIDAL idal = (LoginIDAL)fact.CreateUser("LoginDal");
                    //获取D层返回值
                    UserTable = idal.SelectUserLevel(user);
                    #endregion
                    #region 判断用户是否存在
                    //判断账号是否存在
                    if (UserTable.Rows.Count != 0)
                    {
                        //给级别赋值
                        user.Userlevel = UserTable.Rows[0][1].ToString().Trim();
                        #region 设置继续处理者
                        Level.LoginAdmin   admin     = new Level.LoginAdmin("管理员");
                        Level.LoginOpetion operation = new Level.LoginOpetion("操作员");
                        Level.LoginStudnet student   = new Level.LoginStudnet("学生");
                        #endregion
                        #region 级别判断
                        //判断级别
                        if (user.Userlevel == "管理员")
                        {
                            //继续处理者,跳转到对应的职责链
                            admin.SetSupertior(operation);
                            admin.SetSupertior(student);
                            strMsger = admin.UserLogin(user, form);
                        }
                        else if (user.Userlevel == "操作员")
                        {
                            //继续处理者,跳转到对应的职责链
                            operation.SetSupertior(admin);
                            operation.SetSupertior(student);
                            strMsger = operation.UserLogin(user, form);
                        }
                        else if (user.Userlevel == "学生")
                        {
                            //继续处理者,跳转到对应的职责链
                            student.SetSupertior(admin);
                            student.SetSupertior(operation);
                            strMsger = student.UserLogin(user, form);
                        }
                        #endregion
                    }
                    else
                    {
                        strMsger = "账号不存在,或密码错误!";
                    }
                    //end if
                    #endregion
                }
                else
                {
                    //输入值不是数字
                    strMsger = "登录账号请输入数字!";
                }
            }
            else
            {
                //文本框为空!
                strMsger = isNull;//把返回结果赋值给strMsger返回给U层
            }

            return(strMsger);
        }
Beispiel #13
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="UserID">用户DI</param>
        /// <param name="UserLevel">用户级别</param>
        /// <param name="UserPwd">用户密码</param>
        /// <param name="UserName">用户姓名</param>
        /// <param name="State">使用状态</param>
        /// <param name="PhonNumber">手机号</param>
        /// <param name="Sex">性别</param>
        /// <param name="Age">年龄</param>
        /// <param name="form">添加删除窗体</param>
        /// <returns>是否添加成功!</returns>
        public string AddUserManInfo(string UserID, string UserLevel, string UserPwd, string UserName, string State, string PhonNumber, string Sex, string Age, Form form)
        {
            //用于返回信息
            string strMsger = "";
            //接受判空返回值,判断文本框是否为空。
            string isNull = IsNull.isNull(form);
            //接受判断用户id和年龄是否是数字
            bool isNumberUserID = IsNull.IsNumber(UserID);
            bool isNumberAge    = IsNull.IsNumber(Age);

            //判断文本框是否为空
            if (isNull == "")//没有返回值,说明文本框不为空。
            {
                #region 添加用户
                //判断年龄和管理者id是否为数字
                if (isNumberUserID == true && isNumberAge == true)//如果都是true,说明都是数字。
                {
                    //调用添加删除用户接口,和创建DAL层工厂实例化具体的DAL层类
                    AddandDeleteUserIDAL addanddeleteIDAL = (AddandDeleteUserIDAL)fact.CreateUser("AddandDeleteUserDAL");
                    //转换为实体
                    Managerial manager = new Managerial();
                    manager.ManId = int.Parse(UserID);
                    DataTable SelectManagerTable = addanddeleteIDAL.SelectManagerial(manager); //获取管理者信息
                    //判断用户是否已经存在
                    if (SelectManagerTable.Rows.Count != 0)                                    //不等于零,说明已经存在
                    {
                        strMsger = "此管理者已存在,请从新输入!";
                    }
                    else
                    {
                        UserLevel ManLevel = new Enitity.UserLevel();
                        ManLevel.UserID = int.Parse(UserID);
                        DataTable SelectLevel = addanddeleteIDAL.SelectUserLevel(ManLevel);
                        //判断是否和卡号冲突
                        if (SelectLevel.Rows.Count == 0)//等于零说明不冲突
                        {
                            #region 添加管理者
                            //向登录表插入信息
                            UserLevel user = new Enitity.UserLevel();
                            user.UserID    = int.Parse(UserID);
                            user.Userlevel = UserLevel;
                            user.UserPwd   = UserPwd;
                            addanddeleteIDAL.InsertUserLogin(user);
                            //向管理者插入信息
                            manager.Level = UserLevel;
                            manager.Name  = UserName;
                            manager.State = State;
                            addanddeleteIDAL.InsertManagerial(manager);
                            //向管理者身份信息插入信息
                            ManIDcardno manidcardno = new ManIDcardno();
                            manidcardno.Manid       = int.Parse(UserID);
                            manidcardno.Age         = int.Parse(Age);
                            manidcardno.PhoneNumber = PhonNumber;
                            manidcardno.Sex         = Sex;
                            addanddeleteIDAL.InsertManIDcardno(manidcardno);
                            #endregion
                            strMsger = "用户添加成功!";
                        }
                        else
                        {
                            strMsger = "管理者与卡号冲突,请从新输入!";
                        }
                    }
                }
                else
                {
                    strMsger = "用户ID或者年龄不是数字,请输入数字!";
                }
                #endregion
            }
            else
            {
                strMsger = isNull;
            }
            return(strMsger);
        }