예제 #1
0
        public bool ZhuCe(InFo2_Modle info)   //注册的方法
        {
            bool Flg1 = true;

            conn = new SqlConnection(strcon);


            string strSQL = "insert into Login(LoginName,password,Name,Sex,Phone,City) values";

            strSQL += "(@LoginName,@password,@Name,@Sex,@Phone,@City)";
            SqlCommand com = new SqlCommand();

            com.CommandText = strSQL;

            com.Parameters.Add("@LoginName", SqlDbType.NVarChar, 20).Value = info.LoginName;
            com.Parameters.Add("@password", SqlDbType.NVarChar, 20).Value  = info.Password;
            com.Parameters.Add("@Name", SqlDbType.NVarChar, 50).Value      = info.Name;
            com.Parameters.Add("@Sex", SqlDbType.NVarChar, 5).Value        = info.Sex;
            com.Parameters.Add("@Phone", SqlDbType.NVarChar, 11).Value     = info.Phoen;
            com.Parameters.Add("@City", SqlDbType.NVarChar, 10).Value      = info.City;


            com.Connection = open();
            int result = com.ExecuteNonQuery();

            if (result == 1)
            {
                Flg1 = true;
            }
            else
            {
                Flg1 = false;
            }


            return(Flg1);
        }
예제 #2
0
        public DataTable CheckFour(InFo2_Modle info)   //检验注册的重复性,返回一张表
        {
            string     strSQL = "select top 1 * from Login where  LoginName='" + info.LoginName + "'";
            SqlCommand com    = new SqlCommand();

            conn = new SqlConnection(strcon);
            DataSet ds = new DataSet();

            com.CommandText = strSQL;

            try
            {
                com.Connection = new SqlConnection(strcon);

                SqlDataAdapter sda = new SqlDataAdapter(com);
                sda.Fill(ds);
            }
            catch (SqlException ex)
            {
                return(null);
            }
            close();
            return(ds.Tables.Count > 0 ? ds.Tables[0] : null);
        }
예제 #3
0
        public DataTable GetAllStaffAdvance(InFo2_Modle info)   //查询方法 ,匹配模糊查询
        {
            string     strSQL = "select Name as 姓名,Sex 性别,Phone 个人手机,department 部门,position 职位,City 负责市区,Area 负责县区,Birthday 出生日期,EnterDate 入职日期,Departure 离职日期, WorkTime 在职时间, Age 年龄, LandLine 公司固话, CardID 身份证号, BankId  银行卡号,Educational 学历, ClubLevel  行政级别, Professionals 专业, MoneyLevel 工资级别,HomeTown 籍贯,Dress 现住地址,AccountLocation 户口所在地, Money 工资,AccessLevel 权限级别,LoginState 状态,official 转正日期, Remark 备注 from person where   EnterDate >=@EnterDate and  EnterDate <= @EnterDateEnd and official>=@official and official<=@officialEnd";
            SqlCommand com    = new SqlCommand();

            com.CommandText = strSQL;



            com.Parameters.Add(new SqlParameter("@EnterDate", SqlDbType.Date)
            {
                Value = info.Enter_Str
            });
            com.Parameters.Add(new SqlParameter("@EnterDateEnd", SqlDbType.Date)
            {
                Value = info.EnterEnd_Str
            });
            com.Parameters.Add(new SqlParameter("@official", SqlDbType.Date)
            {
                Value = info.official_Str
            });
            com.Parameters.Add(new SqlParameter("@officialEnd", SqlDbType.Date)
            {
                Value = info.officialEnd_Str
            });


            if (info.MoneyLevel != 0)
            {
                strSQL += " and MoneyLevel = @MoneyLevel ";
                com.Parameters.Add(new SqlParameter("@MoneyLevel", SqlDbType.Int)
                {
                    Value = info.MoneyLevel
                });
            }


            if (info.Educational != "全部")
            {
                strSQL += " and Educational = @Educational ";
                com.Parameters.Add(new SqlParameter("@Educational", SqlDbType.NVarChar, 10)
                {
                    Value = info.Educational
                });
            }



            if (info.Sex.Trim() != "全部")
            {
                strSQL += " and Sex = @Sex ";
                com.Parameters.Add(new SqlParameter("@Sex", SqlDbType.Char, 3)
                {
                    Value = info.Sex
                });
            }

            if (info.Department.Trim() != "")
            {
                string temp = info.Department.Substring(0, info.Department.LastIndexOf(','));
                strSQL += "  and   department in (" + temp + ")";
                //com.Parameters.Add(new SqlParameter("@department", SqlDbType.NVarChar, 10) { Value = info.Department });
            }



            //if (info.City.Trim() != "")
            //{

            //    strSQL += "  and  City = @City ";
            //    com.Parameters.Add(new SqlParameter("@City", SqlDbType.VarChar, 20) { Value = info.City });
            //}


            //if (info.Area.Trim() != "")
            //{
            //    strSQL += "  and (  Area like '%'+@Area+'%')";
            //    //com.Parameters.Add(new SqlParameter("@Area", SqlDbType.NVarChar, 10) { Value = info.Area });
            //}
            if (info.areaList.Count > 0)
            {
                string orStr = "1=1 ";
                for (int i = 0; i < info.areaList.Count; i++)
                {
                    orStr += " or  Area like '%" + info.areaList[i] + "%'";
                }
                strSQL += "  and ( " + orStr + " )";
            }

            if (info.Name.Trim().Length != 0)
            {
                strSQL += "  and  Name like '%'+@Name+'%' ";
                com.Parameters.Add(new SqlParameter("@Name", SqlDbType.NVarChar, 30)
                {
                    Value = info.Name
                });
            }

            if (info.Phoen.Trim().Length != 0)
            {
                strSQL += " and  Phone= @Phone";
                com.Parameters.Add(new SqlParameter("@Phone", SqlDbType.NChar, 11)
                {
                    Value = info.Phoen
                });
            }



            com.CommandText = strSQL;
            com.Connection  = new SqlConnection(strcon);
            DataSet        ds1 = new DataSet();
            SqlDataAdapter sda = new SqlDataAdapter(com);

            sda.Fill(ds1, "AllStaff");
            return(ds1.Tables[0]);
        }
예제 #4
0
        public InFo2_Modle UpdateStaffByID(int ID)
        {
            InFo2_Modle info = new InFo2_Modle();

            return(info);
        }