Exemple #1
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int U_Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from U_UserInfo ");
            strSql.Append(" where U_Id=@U_Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@U_Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = U_Id;


            int rows = DBHelp.ExecuteNonQuery(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// 根据用户id和多个书籍id显示结账数据
        /// </summary>
        /// <param name="MID"></param>
        /// <returns></returns>
        public static List <Trade> getTradeByMIDAndBIDS(int MID, string ids)
        {
            List <Trade> list = new List <Trade>();
            string       sql  = string.Format("select * from Trade inner join Book on Trade.BID=Book.BID where MID={0} and Trade.TID in ({1})", MID, ids);

            using (SqlDataReader sdr = DBHelp.MyExecuteReader(sql, null))
            {
                while (sdr.Read())
                {
                    Trade t = new Trade();
                    t.TID    = Convert.ToInt32(sdr["TID"]);
                    t.BID    = Convert.ToInt32(sdr["BID"]);
                    t.MID    = Convert.ToInt32(sdr["MID"]);
                    t.BCount = Convert.ToInt32(sdr["BCount"]);
                    t.BName  = sdr["BName"].ToString();
                    t.BPic   = sdr["BPic"].ToString();
                    t.BPrice = Convert.ToInt32(sdr["BPrice"]);
                    list.Add(t);
                }
            }


            return(list);
        }
        public static bool AddUsersInfo(ENTITY.CusUsers u1)
        {
            string sql = "insert into CusUsers(Customername,customerpwd ,Realname,CustomerSfz,address,telphone,IsCusAdmin,CusType) values(@Customername,@customerpwd,@Realname,@CustomerSfz,@address,@telphone,@IsCusAdmin,@CusType)";

            SqlParameter[] parm = new SqlParameter[] {
                new SqlParameter("@Customername", SqlDbType.VarChar),
                new SqlParameter("@customerpwd", SqlDbType.VarChar),
                new SqlParameter("@Realname", SqlDbType.VarChar),
                new SqlParameter("@CustomerSfz", SqlDbType.VarChar),
                new SqlParameter("@address", SqlDbType.NVarChar),
                new SqlParameter("@telphone", SqlDbType.VarChar),
                new SqlParameter("@IsCusAdmin", SqlDbType.Int),
                new SqlParameter("@CusType", SqlDbType.Int)
            };
            parm[0].Value = u1.Customername;
            parm[1].Value = u1.customerpwd;
            parm[2].Value = u1.Realname;
            parm[3].Value = u1.CustomerSfz;
            parm[4].Value = u1.address;
            parm[5].Value = u1.telphone;
            parm[6].Value = u1.IsCusAdmin;
            parm[7].Value = u1.CusType;
            return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false);
        }
Exemple #4
0
        /*添加学院信息实现*/
        public static bool AddCollegeInfo(ENTITY.CollegeInfo collegeInfo)
        {
            string sql = "insert into CollegeInfo(collegeNumber,collegeName,collegeBirthDate,collegeMan,collegeTelephone,collegeMemo) values(@collegeNumber,@collegeName,@collegeBirthDate,@collegeMan,@collegeTelephone,@collegeMemo)";

            /*构建sql参数*/
            SqlParameter[] parm = new SqlParameter[] {
                new SqlParameter("@collegeNumber", SqlDbType.VarChar),
                new SqlParameter("@collegeName", SqlDbType.VarChar),
                new SqlParameter("@collegeBirthDate", SqlDbType.DateTime),
                new SqlParameter("@collegeMan", SqlDbType.VarChar),
                new SqlParameter("@collegeTelephone", SqlDbType.VarChar),
                new SqlParameter("@collegeMemo", SqlDbType.VarChar)
            };
            /*给参数赋值*/
            parm[0].Value = collegeInfo.collegeNumber;    //学院编号
            parm[1].Value = collegeInfo.collegeName;      //学院名称
            parm[2].Value = collegeInfo.collegeBirthDate; //成立日期
            parm[3].Value = collegeInfo.collegeMan;       //院长姓名
            parm[4].Value = collegeInfo.collegeTelephone; //联系电话
            parm[5].Value = collegeInfo.collegeMemo;      //附加信息

            /*执行sql进行添加*/
            return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false);
        }
Exemple #5
0
        public static bool AddSettle(Model.Adjust book)                         //添加月结单
        {
            string sql = "insert into U_Settle(R_Month,R_Clerk,R_LoginDate) values(@U_Adjust,@U_ClerkType,@U_LoginTime)";

            /*构建sql参数*/
            SqlParameter[] parm = new SqlParameter[] {
                new SqlParameter("@U_Adjust", SqlDbType.NVarChar, 20),
                new SqlParameter("@U_ClerkType", SqlDbType.Int),
                new SqlParameter("@U_LoginTime", SqlDbType.DateTime)
            };
            /*给参数赋值*/
            parm[0].Value = book.note;
            parm[1].Value = book.clerk;
            parm[2].Value = book.publishDate;
            foreach (SqlParameter p in parm)   //没有对传入的数据作空值的处理
            {
                if (p.Value == null)
                {
                    p.Value = DBNull.Value;
                }
            }
            /*执行sql进行添加*/
            return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false);
        }
Exemple #6
0
 public static int GetCount(string sql)
 {
     return(Convert.ToInt32(DBHelp.ExecuteObject(sql)));
 }
Exemple #7
0
 public static int DeleteIndent(string id)
 {
     cmdText = "delete from Indent where ID='" + id + "'";
     return(DBHelp.ExecuteNonQuery(cmdText));
 }
Exemple #8
0
 public static int Delete(string isbn)
 {
     cmdText = "delete from BookInfo where ISBN='" + isbn + "'";
     return(DBHelp.ExecuteNonQuery(cmdText));
 }
Exemple #9
0
        public static int AddToIndent(string id, int num)
        {
            cmdText = "insert into Indent(ID,bookName,bookAuthor,ISBN,price,countIn,countOut,bookAbout,bookType,Image,number) select ID,bookName,bookAuthor,ISBN,price,countIn,countOut,bookAbout,bookType,Image," + num + " from Cart where id='" + id + "'";

            return(DBHelp.ExecuteNonQuery(cmdText));
        }
Exemple #10
0
        /// <summary>
        /// 添加图书
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        public static int addBook(Book b)
        {
            string sql = string.Format("insert into Book values({0},'{1}','{2}','{3}','','','{4}',{5},{6},getdate(),{7})", b.BSID, b.BName, b.BAuthor, b.BISBN, b.BPic, b.BPrice, b.BCount, b.BSaleCount);

            return(DBHelp.MyExecuteNonQuery(sql, null));
        }
Exemple #11
0
        /// <summary>
        /// 根据订单号修改订单状态
        /// </summary>
        /// <returns></returns>
        public static int updateStateByOID(string OID)
        {
            string sql = string.Format("update Orders set OState=OState+1 where OID='{0}'", OID);

            return(DBHelp.MyExecuteNonQuery(sql, null));
        }
Exemple #12
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateAAA(MU_UserInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update U_UserInfo set ");
            strSql.Append(" U_NativePlace = @U_NativePlace , ");
            strSql.Append(" U_Address = @U_Address , ");
            strSql.Append(" U_Telephone = @U_Telephone , ");
            strSql.Append(" U_Email = @U_Email , ");
            strSql.Append(" U_PostalId = @U_PostalId , ");
            strSql.Append(" U_RelName = @U_RelName , ");
            strSql.Append(" U_Sex = @U_Sex , ");
            strSql.Append(" U_Birthday = @U_Birthday , ");
            strSql.Append(" U_IdCard = @U_IdCard,  ");
            strSql.Append(" U_Image = @U_Image ,");
            strSql.Append(" U_QQ = @U_QQ ");
            strSql.Append(" where U_Id=@U_Id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@U_Id",          SqlDbType.Int,        4),
                new SqlParameter("@U_NativePlace", SqlDbType.VarChar,   20),
                new SqlParameter("@U_Address",     SqlDbType.VarChar,   50),
                new SqlParameter("@U_Telephone",   SqlDbType.VarChar,   50),
                new SqlParameter("@U_Email",       SqlDbType.VarChar,   50),
                new SqlParameter("@U_PostalId",    SqlDbType.VarChar,   20),
                new SqlParameter("@U_RelName",     SqlDbType.VarChar,   50),
                new SqlParameter("@U_Sex",         SqlDbType.Bit,        1),
                new SqlParameter("@U_Birthday",    SqlDbType.DateTime),
                new SqlParameter("@U_IdCard",      SqlDbType.VarChar,   20),
                new SqlParameter("@U_Image",       SqlDbType.Image),
                new SqlParameter("@U_QQ",          SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.U_Id;
            parameters[1].Value  = model.U_NativePlace;
            parameters[2].Value  = model.U_Address;
            parameters[3].Value  = model.U_Telephone;
            parameters[4].Value  = model.U_Email;
            parameters[5].Value  = model.U_PostalId;
            parameters[6].Value  = model.U_RelName;
            parameters[7].Value  = model.U_Sex;
            parameters[8].Value  = model.U_Birthday;
            parameters[9].Value  = model.U_IdCard;
            parameters[10].Value = model.U_Image;
            parameters[11].Value = model.U_QQ;

            foreach (SqlParameter p in parameters)   //没有对传入的数据作空值的处理
            {
                if (p.Value == null)
                {
                    p.Value = DBNull.Value;
                }
            }

            int rows = DBHelp.ExecuteNonQuery(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /*删除学期信息*/
        public static bool DelTermInfo_(string p)
        {
            string sql = "delete from TermInfo_ where termId in (" + p + ") ";

            return(((DBHelp.ExecuteNonQuery(sql, null)) > 0) ? true : false);
        }
Exemple #14
0
 public static int Add(string isbn)
 {
     cmdText = "";
     return(DBHelp.ExecuteNonQuery(cmdText));
 }
        public static bool DelUsersInfo(string p)
        {
            string sql = "delete from CusUsers where customerid in (" + p + ") ";

            return(((DBHelp.ExecuteNonQuery(sql, null)) > 0) ? true : false);
        }
Exemple #16
0
        /// <summary>
        /// 根据书籍id修改书籍信息
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        public static int update(Book b)
        {
            string sql = string.Format("update Book set BSID={0},BName='{1}',BAuthor='{2}',BISBN='{3}',BPic='{4}',BPrice={5},BCount={6} where BID={7}", b.BSID, b.BName, b.BAuthor, b.BISBN, b.BPic, b.BPrice, b.BCount, b.BID);

            return(DBHelp.MyExecuteNonQuery(sql, null));
        }
Exemple #17
0
        /*删除成绩信息*/
        public static bool DelScoreInfo(string p)
        {
            string sql = "delete from ScoreInfo where scoreId in (" + p + ") ";

            return(((DBHelp.ExecuteNonQuery(sql, null)) > 0) ? true : false);
        }
Exemple #18
0
        /// <summary>
        /// 添加入订单表
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public static int addOrders(Order o)
        {
            string sql = string.Format("insert into Orders values('{0}',{1},getdate(),'{2}','{3}','{4}',{5},{6})", o.OID, o.MID, o.OConsignee, o.OAddress, o.OTelephone, o.OSumPrice, o.OState);

            return(DBHelp.MyExecuteNonQuery(sql, null));
        }
        /*删除选课信息*/
        public static bool DelStudentSelectCourseInfo(string p)
        {
            string sql = "delete from StudentSelectCourseInfo where selectId in (" + p + ") ";

            return(((DBHelp.ExecuteNonQuery(sql, null)) > 0) ? true : false);
        }
Exemple #20
0
        /// <summary>
        /// 添加订单
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public static int addOrderDetails(OrderDetails o)
        {
            string sql = string.Format("insert into OrderDetails values('{0}',{1},{2},{3})", o.OID, o.BID, o.BPrice, o.BCount);

            return(DBHelp.MyExecuteNonQuery(sql, null));
        }
Exemple #21
0
 /// <summary>
 /// 根据书籍id删除书籍
 /// </summary>
 /// <param name="BID"></param>
 /// <returns></returns>
 public static int delete(int BID)
 {
     return(DBHelp.MyExecuteNonQuery(string.Format("delete from Book where BID={0}", BID), null));
 }
        /*删除新闻信息*/
        public static bool DelNews(string p)
        {
            string sql = "delete from News where newsId in (" + p + ") ";

            return(((DBHelp.ExecuteNonQuery(sql, null)) > 0) ? true : false);
        }
Exemple #23
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MU_UserInfo GetModel(int U_Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * ");
            strSql.Append("  from U_UserInfo ");
            strSql.Append(" where U_Id=@U_Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@U_Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = U_Id;

            MU_UserInfo model = new MU_UserInfo();
            DataSet     ds    = DBHelp.DateSet(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["U_Id"].ToString() != "")
                {
                    model.U_Id = int.Parse(ds.Tables[0].Rows[0]["U_Id"].ToString());
                }
                model.U_NativePlace = ds.Tables[0].Rows[0]["U_NativePlace"].ToString();
                model.U_Address     = ds.Tables[0].Rows[0]["U_Address"].ToString();
                model.U_Telephone   = ds.Tables[0].Rows[0]["U_Telephone"].ToString();
                model.U_Email       = ds.Tables[0].Rows[0]["U_Email"].ToString();
                model.U_PostalId    = ds.Tables[0].Rows[0]["U_PostalId"].ToString();
                model.U_Position    = ds.Tables[0].Rows[0]["U_Position"].ToString();
                model.U_Reamrk      = ds.Tables[0].Rows[0]["U_Remark"].ToString();
                if (ds.Tables[0].Rows[0]["U_LoginTime"].ToString() != "")
                {
                    model.U_LoginTime = DateTime.Parse(ds.Tables[0].Rows[0]["U_LoginTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["U_RoleType"].ToString() != "")
                {
                    model.U_RoleType = int.Parse(ds.Tables[0].Rows[0]["U_RoleType"].ToString());
                }
                model.U_Name    = ds.Tables[0].Rows[0]["U_Name2"].ToString();
                model.U_RelName = ds.Tables[0].Rows[0]["U_RelName"].ToString();
                if (ds.Tables[0].Rows[0]["U_Sex"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["U_Sex"].ToString() == "1") || (ds.Tables[0].Rows[0]["U_Sex"].ToString().ToLower() == "true"))
                    {
                        model.U_Sex = true;
                    }
                    else
                    {
                        model.U_Sex = false;
                    }
                }
                model.U_PassWord = ds.Tables[0].Rows[0]["U_PassWord"].ToString();
                if (ds.Tables[0].Rows[0]["U_Birthday"].ToString() != "")
                {
                    model.U_Birthday = DateTime.Parse(ds.Tables[0].Rows[0]["U_Birthday"].ToString());
                }
                if (ds.Tables[0].Rows[0]["U_PsdType"].ToString() != "")
                {
                    model.U_PsdType = int.Parse(ds.Tables[0].Rows[0]["U_PsdType"].ToString());
                }
                model.U_PsdAnswer = ds.Tables[0].Rows[0]["U_PsdAnswer"].ToString();
                model.U_IdCard    = ds.Tables[0].Rows[0]["U_IdCard"].ToString();
                if (ds.Tables[0].Rows[0]["U_Image"].ToString() != "")
                {
                    model.U_Image = (byte[])ds.Tables[0].Rows[0]["U_Image"];
                }
                //model.U_DepType = int.Parse(ds.Tables[0].Rows[0]["U_DepType"].ToString());
                return(model);
            }
            else
            {
                return(null);
            }
        }