コード例 #1
0
ファイル: users.cs プロジェクト: zhanglg40/SANKE
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.users model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update " + databaseprefix + "users set ");
            strSql.Append("group_id=@group_id,");
            strSql.Append("user_name=@user_name,");
            strSql.Append("password=@password,");
            strSql.Append("salt=@salt,");
            strSql.Append("email=@email,");
            strSql.Append("nick_name=@nick_name,");
            strSql.Append("avatar=@avatar,");
            strSql.Append("sex=@sex,");
            strSql.Append("birthday=@birthday,");
            strSql.Append("telphone=@telphone,");
            strSql.Append("mobile=@mobile,");
            strSql.Append("qq=@qq,");
            strSql.Append("address=@address,");
            strSql.Append("safe_question=@safe_question,");
            strSql.Append("safe_answer=@safe_answer,");
            strSql.Append("amount=@amount,");
            strSql.Append("point=@point,");
            strSql.Append("exp=@exp,");
            strSql.Append("status=@status,");
            strSql.Append("express_id=@express_id,");
            strSql.Append("reg_time=@reg_time,");
            strSql.Append("wechat=@wechat,");
            strSql.Append("companyid=@companyid,");
            strSql.Append("companyname=@companyname,");
            strSql.Append("companyaddress=@companyaddress,");
            strSql.Append("taxid=@taxid,");
            strSql.Append("reg_ip=@reg_ip");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",             SqlDbType.Int,         4),
                new SqlParameter("@group_id",       SqlDbType.Int,         4),
                new SqlParameter("@user_name",      SqlDbType.NVarChar,  100),
                new SqlParameter("@password",       SqlDbType.NVarChar,  100),
                new SqlParameter("@salt",           SqlDbType.NVarChar,   20),
                new SqlParameter("@email",          SqlDbType.NVarChar,   50),
                new SqlParameter("@nick_name",      SqlDbType.NVarChar,  100),
                new SqlParameter("@avatar",         SqlDbType.NVarChar,  255),
                new SqlParameter("@sex",            SqlDbType.NVarChar,   20),
                new SqlParameter("@birthday",       SqlDbType.DateTime),
                new SqlParameter("@telphone",       SqlDbType.NVarChar,   50),
                new SqlParameter("@mobile",         SqlDbType.NVarChar,   20),
                new SqlParameter("@qq",             SqlDbType.NVarChar,   30),
                new SqlParameter("@address",        SqlDbType.NVarChar,  255),
                new SqlParameter("@safe_question",  SqlDbType.NVarChar,  255),
                new SqlParameter("@safe_answer",    SqlDbType.NVarChar,  255),
                new SqlParameter("@amount",         SqlDbType.Decimal,     5),
                new SqlParameter("@point",          SqlDbType.Int,         4),
                new SqlParameter("@exp",            SqlDbType.Int,         4),
                new SqlParameter("@status",         SqlDbType.TinyInt,     1),
                new SqlParameter("@express_id",     SqlDbType.Int,         4),
                new SqlParameter("@reg_time",       SqlDbType.DateTime),
                new SqlParameter("@wechat",         SqlDbType.NVarChar,   50),
                new SqlParameter("@companyid",      SqlDbType.NVarChar,  100),
                new SqlParameter("@companyname",    SqlDbType.NVarChar,  100),
                new SqlParameter("@companyaddress", SqlDbType.NVarChar,  255),
                new SqlParameter("@taxid",          SqlDbType.NVarChar,  100),
                new SqlParameter("@reg_ip",         SqlDbType.NVarChar, 30)
            };



            parameters[0].Value  = model.id;
            parameters[1].Value  = model.group_id;
            parameters[2].Value  = model.user_name;
            parameters[3].Value  = model.password;
            parameters[4].Value  = model.salt;
            parameters[5].Value  = model.email;
            parameters[6].Value  = model.nick_name;
            parameters[7].Value  = model.avatar;
            parameters[8].Value  = model.sex;
            parameters[9].Value  = model.birthday;
            parameters[10].Value = model.telphone;
            parameters[11].Value = model.mobile;
            parameters[12].Value = model.qq;
            parameters[13].Value = model.address;
            parameters[14].Value = model.safe_question;
            parameters[15].Value = model.safe_answer;
            parameters[16].Value = model.amount;
            parameters[17].Value = model.point;
            parameters[18].Value = model.exp;
            parameters[19].Value = model.status;
            parameters[20].Value = model.express_id;
            parameters[21].Value = model.reg_time;

            parameters[22].Value = model.wechat;
            parameters[23].Value = model.companyid;
            parameters[24].Value = model.companyname;
            parameters[25].Value = model.companyaddress;
            parameters[26].Value = model.taxid;
            parameters[27].Value = model.reg_ip;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
ファイル: Admindb.cs プロジェクト: ttrr1/physicalExamination
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Admin model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Admin set ");
            strSql.Append("UserName=@UserName,");
            strSql.Append("PassWord=@PassWord,");
            strSql.Append("ReallyName=@ReallyName,");
            strSql.Append("Birthday=@Birthday,");
            strSql.Append("Address=@Address,");
            strSql.Append("PostCode=@PostCode,");
            strSql.Append("Email=@Email,");
            strSql.Append("HomePhone=@HomePhone,");
            strSql.Append("MobilePhone=@MobilePhone,");
            strSql.Append("QQ=@QQ,");
            strSql.Append("ICQ=@ICQ,");
            strSql.Append("RegTime=@RegTime,");
            strSql.Append("Sex=@Sex,");
            strSql.Append("IP=@IP,");
            strSql.Append("BlogID=@BlogID,");
            strSql.Append("SuperAdmin=@SuperAdmin");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserName",    SqlDbType.NVarChar,   50),
                new SqlParameter("@PassWord",    SqlDbType.NVarChar,   50),
                new SqlParameter("@ReallyName",  SqlDbType.NVarChar,   50),
                new SqlParameter("@Birthday",    SqlDbType.NVarChar,   50),
                new SqlParameter("@Address",     SqlDbType.NVarChar,  100),
                new SqlParameter("@PostCode",    SqlDbType.NVarChar,   50),
                new SqlParameter("@Email",       SqlDbType.NVarChar,   50),
                new SqlParameter("@HomePhone",   SqlDbType.NVarChar,   50),
                new SqlParameter("@MobilePhone", SqlDbType.NVarChar,   50),
                new SqlParameter("@QQ",          SqlDbType.NVarChar,   50),
                new SqlParameter("@ICQ",         SqlDbType.NVarChar,   50),
                new SqlParameter("@RegTime",     SqlDbType.DateTime),
                new SqlParameter("@Sex",         SqlDbType.NVarChar,    4),
                new SqlParameter("@IP",          SqlDbType.NVarChar,   20),
                new SqlParameter("@BlogID",      SqlDbType.Int,         4),
                new SqlParameter("@SuperAdmin",  SqlDbType.NVarChar,    4),
                new SqlParameter("@ID",          SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.UserName;
            parameters[1].Value  = model.PassWord;
            parameters[2].Value  = model.ReallyName;
            parameters[3].Value  = model.Birthday;
            parameters[4].Value  = model.Address;
            parameters[5].Value  = model.PostCode;
            parameters[6].Value  = model.Email;
            parameters[7].Value  = model.HomePhone;
            parameters[8].Value  = model.MobilePhone;
            parameters[9].Value  = model.QQ;
            parameters[10].Value = model.ICQ;
            parameters[11].Value = model.RegTime;
            parameters[12].Value = model.Sex;
            parameters[13].Value = model.IP;
            parameters[14].Value = model.BlogID;
            parameters[15].Value = model.SuperAdmin;
            parameters[16].Value = model.ID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
ファイル: tb_DeviceOUTDAL.cs プロジェクト: jangocheng/lims
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(tb_DeviceOUT model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_DeviceOUT set ");
            strSql.Append("deviceId=@deviceId,");
            strSql.Append("amount=@amount,");
            strSql.Append("userId1=@userId1,");
            strSql.Append("useFor=@useFor,");
            strSql.Append("gDate=@gDate,");
            strSql.Append("userId2=@userId2,");
            strSql.Append("bDate=@bDate,");
            strSql.Append("userId3=@userId3,");
            strSql.Append("remark=@remark,");
            strSql.Append("createUser=@createUser,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("updateUser=@updateUser,");
            strSql.Append("updateDate=@updateDate,");
            strSql.Append("temp1=@temp1,");
            strSql.Append("temp2=@temp2");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@deviceId",   SqlDbType.Int,       4),
                new SqlParameter("@amount",     SqlDbType.Int,       4),
                new SqlParameter("@userId1",    SqlDbType.Int,       4),
                new SqlParameter("@useFor",     SqlDbType.Text),
                new SqlParameter("@gDate",      SqlDbType.DateTime),
                new SqlParameter("@userId2",    SqlDbType.Int,       4),
                new SqlParameter("@bDate",      SqlDbType.DateTime),
                new SqlParameter("@userId3",    SqlDbType.Int,       4),
                new SqlParameter("@remark",     SqlDbType.Text),
                new SqlParameter("@createUser", SqlDbType.Int,       4),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@updateUser", SqlDbType.Int,       4),
                new SqlParameter("@updateDate", SqlDbType.DateTime),
                new SqlParameter("@temp1",      SqlDbType.Text),
                new SqlParameter("@temp2",      SqlDbType.Text),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.deviceId;
            parameters[1].Value  = model.amount;
            parameters[2].Value  = model.userId1;
            parameters[3].Value  = model.useFor;
            parameters[4].Value  = model.gDate;
            parameters[5].Value  = model.userId2;
            parameters[6].Value  = model.bDate;
            parameters[7].Value  = model.userId3;
            parameters[8].Value  = model.remark;
            parameters[9].Value  = model.createUser;
            parameters[10].Value = model.createDate;
            parameters[11].Value = model.updateUser;
            parameters[12].Value = model.updateDate;
            parameters[13].Value = model.temp1;
            parameters[14].Value = model.temp2;
            parameters[15].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        /// <summary>
        /// 根据编码更新数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateByCode(Client model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_Client set ");
            strSql.Append("Cli_zhiwen=@Cli_zhiwen,");
            strSql.Append("Cli_Name=@Cli_Name,");
            strSql.Append("Cli_PicName=@Cli_PicName,");
            strSql.Append("Cli_Phone=@Cli_Phone,");
            strSql.Append("Cli_PhoneTwo=@Cli_PhoneTwo,");
            strSql.Append("Cli_faxes=@Cli_faxes,");
            strSql.Append("Cli_CityCode=@Cli_CityCode,");
            strSql.Append("Cli_area=@Cli_area,");
            strSql.Append("Cli_Address=@Cli_Address,");
            strSql.Append("Cli_LinkMan=@Cli_LinkMan,");
            strSql.Append("Cli_TypeCode=@Cli_TypeCode,");
            strSql.Append("Cli_TypeName=@Cli_TypeName,");
            strSql.Append("Cli_Company=@Cli_Company,");
            strSql.Append("Cli_DiscountCode=@Cli_DiscountCode,");
            strSql.Append("Cli_Bankaccounts=@Cli_Bankaccounts,");
            strSql.Append("Cli_OpenBank=@Cli_OpenBank,");
            strSql.Append("Cli_Olddata=@Cli_Olddata,");
            strSql.Append("Cli_Oldreturn=@Cli_Oldreturn,");
            strSql.Append("Cli_Newoutdata=@Cli_Newoutdata,");
            strSql.Append("Cli_Newintodata=@Cli_Newintodata,");
            strSql.Append("Cli_Createdata=@Cli_Createdata,");
            strSql.Append("Cli_Limit=@Cli_Limit,");
            strSql.Append("Cli_RemainLimit=@Cli_RemainLimit,");
            strSql.Append("Cli_ClearLimitdate=@Cli_ClearLimitdate,");
            strSql.Append("Cli_ShouldMoney=@Cli_ShouldMoney,");
            strSql.Append("Cli_GetMoney=@Cli_GetMoney,");
            strSql.Append("Cli_PreMoney=@Cli_PreMoney,");
            strSql.Append("Cli_Remark=@Cli_Remark,");
            strSql.Append("Cli_safetone=@Cli_safetone,");
            strSql.Append("Cli_safettwo=@Cli_safettwo,");
            strSql.Append("Cli_Enable=@Cli_Enable");
            strSql.Append(" where Cli_Code=@Cli_Code");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Cli_zhiwen",         SqlDbType.NVarChar,    -1),
                new SqlParameter("@Cli_Name",           SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_PicName",        SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_Phone",          SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_PhoneTwo",       SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_faxes",          SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_CityCode",       SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_area",           SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_Address",        SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_LinkMan",        SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_Company",        SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_TypeCode",       SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_TypeName",       SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_DiscountCode",   SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_Bankaccounts",   SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_OpenBank",       SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_Olddata",        SqlDbType.DateTime),
                new SqlParameter("@Cli_Oldreturn",      SqlDbType.DateTime),
                new SqlParameter("@Cli_Newoutdata",     SqlDbType.DateTime),
                new SqlParameter("@Cli_Newintodata",    SqlDbType.DateTime),
                new SqlParameter("@Cli_Createdata",     SqlDbType.DateTime),
                new SqlParameter("@Cli_Limit",          SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_RemainLimit",    SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_ClearLimitdate", SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_ShouldMoney",    SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_GetMoney",       SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_PreMoney",       SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_Remark",         SqlDbType.NVarChar,  1024),
                new SqlParameter("@Cli_safetone",       SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_safettwo",       SqlDbType.NVarChar,   512),
                new SqlParameter("@Cli_Enable",         SqlDbType.Int,          4),
                new SqlParameter("@Cli_Code",           SqlDbType.NVarChar, 512)
            };

            parameters[0].Value  = model.Cli_zhiwen;
            parameters[1].Value  = model.Cli_Name;
            parameters[2].Value  = model.Cli_PicName;
            parameters[3].Value  = model.Cli_Phone;
            parameters[4].Value  = model.Cli_PhoneTwo;
            parameters[5].Value  = model.Cli_faxes;
            parameters[6].Value  = model.Cli_CityCode;
            parameters[7].Value  = model.Cli_area;
            parameters[8].Value  = model.Cli_Address;
            parameters[9].Value  = model.Cli_LinkMan;
            parameters[10].Value = model.Cli_Company;
            parameters[11].Value = model.Cli_TypeCode;
            parameters[12].Value = model.Cli_TypeName;
            parameters[13].Value = model.Cli_DiscountCode;
            parameters[14].Value = model.Cli_Bankaccounts;
            parameters[15].Value = model.Cli_OpenBank;
            parameters[16].Value = model.Cli_Olddata;
            parameters[17].Value = model.Cli_Oldreturn;
            parameters[18].Value = model.Cli_Newoutdata;
            parameters[19].Value = model.Cli_Newintodata;
            parameters[20].Value = model.Cli_Createdata;
            parameters[21].Value = model.Cli_Limit;
            parameters[22].Value = model.Cli_RemainLimit;
            parameters[23].Value = model.Cli_ClearLimitdate;
            parameters[24].Value = model.Cli_ShouldMoney;
            parameters[25].Value = model.Cli_GetMoney;
            parameters[26].Value = model.Cli_PreMoney;
            parameters[27].Value = model.Cli_Remark;
            parameters[28].Value = model.Cli_safetone;
            parameters[29].Value = model.Cli_safettwo;
            parameters[30].Value = model.Cli_Enable;
            parameters[31].Value = model.Cli_Code;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {
            //取得Model信息
            Model.article_attribute_field model = GetModel(id);
            //开始删除
            using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
            {
                conn.Open();
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        //查找关联的频道ID,得到后以备使用
                        StringBuilder strSql1 = new StringBuilder();
                        strSql1.Append("select channel_id,field_id from " + databaseprefix + "channel_field ");
                        strSql1.Append(" where field_id=@field_id");
                        SqlParameter[] parameters1 =
                        {
                            new SqlParameter("@field_id", SqlDbType.Int, 4)
                        };
                        parameters1[0].Value = id;
                        DataTable dt = DbHelperSQL.Query(conn, trans, strSql1.ToString(), parameters1).Tables[0];

                        //删除频道关联的字段表
                        StringBuilder strSql2 = new StringBuilder();
                        strSql2.Append("delete from " + databaseprefix + "channel_field");
                        strSql2.Append(" where field_id=@field_id");
                        SqlParameter[] parameters2 =
                        {
                            new SqlParameter("@field_id", SqlDbType.Int, 4)
                        };
                        parameters2[0].Value = id;
                        DbHelperSQL.ExecuteSql(conn, trans, strSql2.ToString(), parameters2);

                        //重建对应频道的视图
                        if (dt.Rows.Count > 0)
                        {
                            foreach (DataRow dr in dt.Rows)
                            {
                                Model.channel modelt = new DAL.channel(databaseprefix).GetModel(conn, trans, int.Parse(dr["channel_id"].ToString()));
                                if (modelt != null)
                                {
                                    new DAL.channel(databaseprefix).RehabChannelViews(conn, trans, modelt, modelt.name);
                                }
                            }
                        }

                        //删除主表
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("delete from " + databaseprefix + "article_attribute_field ");
                        strSql.Append(" where id=@id");
                        SqlParameter[] parameters =
                        {
                            new SqlParameter("@id", SqlDbType.Int, 4)
                        };
                        parameters[0].Value = id;
                        DbHelperSQL.ExecuteSql(conn, trans, strSql.ToString(), parameters);

                        //删除扩展字段表中一列
                        DbHelperSQL.ExecuteSql(conn, trans, "alter table " + databaseprefix + "article_attribute_value drop column " + model.name);

                        //没有错误确认事务
                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        return(false);
                    }
                }
            }
            return(true);
        }
コード例 #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Material model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_Material set ");
            strSql.Append("Ma_PicName=@Ma_PicName,");
            strSql.Append("Ma_Name=@Ma_Name,");
            strSql.Append("Ma_Model=@Ma_Model,");
            strSql.Append("Ma_RFID=@Ma_RFID,");
            strSql.Append("Ma_Barcode=@Ma_Barcode,");
            strSql.Append("Ma_Code=@Ma_Code,");
            strSql.Append("Ma_TypeID=@Ma_TypeID,");
            strSql.Append("Ma_TypeName=@Ma_TypeName,");
            strSql.Append("Ma_Price=@Ma_Price,");
            strSql.Append("Ma_PriceA=@Ma_PriceA,");
            strSql.Append("Ma_PriceB=@Ma_PriceB,");
            strSql.Append("Ma_PriceC=@Ma_PriceC,");
            strSql.Append("Ma_PriceD=@Ma_PriceD,");
            strSql.Append("Ma_PriceE=@Ma_PriceE,");
            strSql.Append("Ma_CreateDate=@Ma_CreateDate,");
            strSql.Append("Ma_Supplier=@Ma_Supplier,");
            strSql.Append("Ma_SupID=@Ma_SupID,");
            strSql.Append("Ma_zhujima=@Ma_zhujima,");
            strSql.Append("Ma_Unit=@Ma_Unit,");
            strSql.Append("Ma_InPrice=@Ma_InPrice,");
            strSql.Append("Ma_OutPrice=@Ma_OutPrice,");
            strSql.Append("Ma_InDate=@Ma_InDate,");
            strSql.Append("Ma_Remark=@Ma_Remark,");
            strSql.Append("Ma_Enable=@Ma_Enable,");
            strSql.Append("Ma_Clear=@Ma_Clear,");
            strSql.Append("Ma_Safeyone=@Ma_Safeyone,");
            strSql.Append("Ma_Safetytwo=@Ma_Safetytwo");
            strSql.Append(" where Ma_ID=@Ma_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Ma_PicName",    SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_Name",       SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_Model",      SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_RFID",       SqlDbType.NVarChar,  1024),
                new SqlParameter("@Ma_Barcode",    SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_Code",       SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_TypeID",     SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_TypeName",   SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_Price",      SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_PriceA",     SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_PriceB",     SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_PriceC",     SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_PriceD",     SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_PriceE",     SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_CreateDate", SqlDbType.DateTime),
                new SqlParameter("@Ma_Supplier",   SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_SupID",      SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_zhujima",    SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_Unit",       SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_InPrice",    SqlDbType.Decimal),
                new SqlParameter("@Ma_OutPrice",   SqlDbType.Decimal),
                new SqlParameter("@Ma_InDate",     SqlDbType.DateTime),
                new SqlParameter("@Ma_Remark",     SqlDbType.NVarChar,  1024),
                new SqlParameter("@Ma_Enable",     SqlDbType.Int,          4),
                new SqlParameter("@Ma_Clear",      SqlDbType.Int,          4),
                new SqlParameter("@Ma_Safeyone",   SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_Safetytwo",  SqlDbType.NVarChar,   512),
                new SqlParameter("@Ma_ID",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.Ma_PicName;
            parameters[1].Value  = model.Ma_Name;
            parameters[2].Value  = model.Ma_Model;
            parameters[3].Value  = model.Ma_RFID;
            parameters[4].Value  = model.Ma_Barcode;
            parameters[5].Value  = model.Ma_Code;
            parameters[6].Value  = model.Ma_TypeID;
            parameters[7].Value  = model.Ma_TypeName;
            parameters[8].Value  = model.Ma_Price;
            parameters[9].Value  = model.Ma_PriceA;
            parameters[10].Value = model.Ma_PriceB;
            parameters[11].Value = model.Ma_PriceC;
            parameters[12].Value = model.Ma_PriceD;
            parameters[13].Value = model.Ma_PriceE;
            parameters[14].Value = model.Ma_CreateDate;
            parameters[15].Value = model.Ma_Supplier;
            parameters[16].Value = model.Ma_SupID;
            parameters[17].Value = model.Ma_zhujima;
            parameters[18].Value = model.Ma_Unit;
            parameters[19].Value = model.Ma_InPrice;
            parameters[20].Value = model.Ma_OutPrice;
            parameters[21].Value = model.Ma_InDate;
            parameters[22].Value = model.Ma_Remark;
            parameters[23].Value = model.Ma_Enable;
            parameters[24].Value = model.Ma_Clear;
            parameters[25].Value = model.Ma_Safeyone;
            parameters[26].Value = model.Ma_Safetytwo;
            parameters[27].Value = model.Ma_ID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #7
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.article_attribute_field model)
        {
            using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
            {
                conn.Open();
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("update " + databaseprefix + "article_attribute_field set ");
                        strSql.Append("name=@name,");
                        strSql.Append("title=@title,");
                        strSql.Append("control_type=@control_type,");
                        strSql.Append("data_type=@data_type,");
                        strSql.Append("data_length=@data_length,");
                        strSql.Append("data_place=@data_place,");
                        strSql.Append("item_option=@item_option,");
                        strSql.Append("default_value=@default_value,");
                        strSql.Append("is_required=@is_required,");
                        strSql.Append("is_password=@is_password,");
                        strSql.Append("is_html=@is_html,");
                        strSql.Append("editor_type=@editor_type,");
                        strSql.Append("valid_tip_msg=@valid_tip_msg,");
                        strSql.Append("valid_error_msg=@valid_error_msg,");
                        strSql.Append("valid_pattern=@valid_pattern,");
                        strSql.Append("sort_id=@sort_id,");
                        strSql.Append("is_sys=@is_sys");
                        strSql.Append(" where id=@id");
                        SqlParameter[] parameters =
                        {
                            new SqlParameter("@id",              SqlDbType.Int,        4),
                            new SqlParameter("@name",            SqlDbType.NVarChar, 100),
                            new SqlParameter("@title",           SqlDbType.NVarChar, 100),
                            new SqlParameter("@control_type",    SqlDbType.NVarChar,  50),
                            new SqlParameter("@data_type",       SqlDbType.NVarChar,  50),
                            new SqlParameter("@data_length",     SqlDbType.Int,        4),
                            new SqlParameter("@data_place",      SqlDbType.TinyInt,    1),
                            new SqlParameter("@item_option",     SqlDbType.NText),
                            new SqlParameter("@default_value",   SqlDbType.NText),
                            new SqlParameter("@is_required",     SqlDbType.TinyInt,    1),
                            new SqlParameter("@is_password",     SqlDbType.TinyInt,    1),
                            new SqlParameter("@is_html",         SqlDbType.TinyInt,    1),
                            new SqlParameter("@editor_type",     SqlDbType.TinyInt,    1),
                            new SqlParameter("@valid_tip_msg",   SqlDbType.NVarChar, 255),
                            new SqlParameter("@valid_error_msg", SqlDbType.NVarChar, 255),
                            new SqlParameter("@valid_pattern",   SqlDbType.NVarChar, 500),
                            new SqlParameter("@sort_id",         SqlDbType.Int,        4),
                            new SqlParameter("@is_sys",          SqlDbType.TinyInt, 1)
                        };
                        parameters[0].Value  = model.id;
                        parameters[1].Value  = model.name;
                        parameters[2].Value  = model.title;
                        parameters[3].Value  = model.control_type;
                        parameters[4].Value  = model.data_type;
                        parameters[5].Value  = model.data_length;
                        parameters[6].Value  = model.data_place;
                        parameters[7].Value  = model.item_option;
                        parameters[8].Value  = model.default_value;
                        parameters[9].Value  = model.is_required;
                        parameters[10].Value = model.is_password;
                        parameters[11].Value = model.is_html;
                        parameters[12].Value = model.editor_type;
                        parameters[13].Value = model.valid_tip_msg;
                        parameters[14].Value = model.valid_error_msg;
                        parameters[15].Value = model.valid_pattern;
                        parameters[16].Value = model.sort_id;
                        parameters[17].Value = model.is_sys;
                        DbHelperSQL.ExecuteSql(conn, trans, strSql.ToString(), parameters);

                        //修改扩展字段表中一列
                        StringBuilder strSql2 = new StringBuilder();
                        strSql2.Append("alter table " + databaseprefix + "article_attribute_value alter column " + model.name + " " + model.data_type);
                        DbHelperSQL.ExecuteSql(conn, trans, strSql2.ToString());
                        //没有错误确认事务
                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        return(false);
                    }
                }
            }
            return(true);
        }
コード例 #8
0
ファイル: tb_DrugCheckDAL.cs プロジェクト: jangocheng/lims
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(tb_DrugCheck model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_DrugCheck set ");
            strSql.Append("drugCode=@drugCode,");
            strSql.Append("drugName=@drugName,");
            strSql.Append("drugId=@drugId,");
            strSql.Append("drugInId=@drugInId,");
            strSql.Append("drugOutId=@drugOutId,");
            strSql.Append("outDate=@outDate,");
            strSql.Append("unit=@unit,");
            strSql.Append("amountIN=@amountIN,");
            strSql.Append("amountOUT=@amountOUT,");
            strSql.Append("amount=@amount,");
            strSql.Append("riskLevel=@riskLevel,");
            strSql.Append("checkDate=@checkDate,");
            strSql.Append("checkUser=@checkUser,");
            strSql.Append("checkUserId=@checkUserId,");
            strSql.Append("auditstatus=@auditstatus,");
            strSql.Append("auditUser=@auditUser,");
            strSql.Append("auditUserId=@auditUserId,");
            strSql.Append("remark=@remark,");
            strSql.Append("isDelete=@isDelete,");
            strSql.Append("createUser=@createUser,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("updateUser=@updateUser,");
            strSql.Append("updateDate=@updateDate");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@drugCode",    SqlDbType.NVarChar,  -1),
                new SqlParameter("@drugName",    SqlDbType.NVarChar,  -1),
                new SqlParameter("@drugId",      SqlDbType.Int,        4),
                new SqlParameter("@drugInId",    SqlDbType.Int,        4),
                new SqlParameter("@drugOutId",   SqlDbType.Int,        4),
                new SqlParameter("@outDate",     SqlDbType.DateTime),
                new SqlParameter("@unit",        SqlDbType.NVarChar,  -1),
                new SqlParameter("@amountIN",    SqlDbType.Int,        4),
                new SqlParameter("@amountOUT",   SqlDbType.Int,        4),
                new SqlParameter("@amount",      SqlDbType.Int,        4),
                new SqlParameter("@riskLevel",   SqlDbType.NVarChar,  -1),
                new SqlParameter("@checkDate",   SqlDbType.DateTime),
                new SqlParameter("@checkUser",   SqlDbType.NVarChar,  -1),
                new SqlParameter("@checkUserId", SqlDbType.Int,        4),
                new SqlParameter("@auditstatus", SqlDbType.NVarChar,  -1),
                new SqlParameter("@auditUser",   SqlDbType.NVarChar,  -1),
                new SqlParameter("@auditUserId", SqlDbType.NVarChar,  -1),
                new SqlParameter("@remark",      SqlDbType.NVarChar,  -1),
                new SqlParameter("@isDelete",    SqlDbType.Bit,        1),
                new SqlParameter("@createUser",  SqlDbType.Int,        4),
                new SqlParameter("@createDate",  SqlDbType.DateTime),
                new SqlParameter("@updateUser",  SqlDbType.Int,        4),
                new SqlParameter("@updateDate",  SqlDbType.DateTime),
                new SqlParameter("@id",          SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.drugCode;
            parameters[1].Value  = model.drugName;
            parameters[2].Value  = model.drugId;
            parameters[3].Value  = model.drugInId;
            parameters[4].Value  = model.drugOutId;
            parameters[5].Value  = model.outDate;
            parameters[6].Value  = model.unit;
            parameters[7].Value  = model.amountIN;
            parameters[8].Value  = model.amountOUT;
            parameters[9].Value  = model.amount;
            parameters[10].Value = model.riskLevel;
            parameters[11].Value = model.checkDate;
            parameters[12].Value = model.checkUser;
            parameters[13].Value = model.checkUserId;
            parameters[14].Value = model.auditstatus;
            parameters[15].Value = model.auditUser;
            parameters[16].Value = model.auditUserId;
            parameters[17].Value = model.remark;
            parameters[18].Value = model.isDelete;
            parameters[19].Value = model.createUser;
            parameters[20].Value = model.createDate;
            parameters[21].Value = model.updateUser;
            parameters[22].Value = model.updateDate;
            parameters[23].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #9
0
        /// <summary>
        /// 删除所有数据
        /// </summary>
        /// <returns></returns>
        public int DelAllBorrow()
        {
            string sql = "TRUNCATE TABLE T_BORROW";

            return(DbHelperSQL.ExecuteSql(sql));
        }
コード例 #10
0
        /// <summary>
        /// 根据ID删除信息
        /// </summary>
        /// <param name="Bo_TypeID">类型ID</param>
        /// <returns>受影响行数</returns>
        public int DelBorrow(string Bo_TypeID)
        {
            string sql = string.Format("delete from T_Borrow where Bo_TypeID={0}", Bo_TypeID);

            return(DbHelperSQL.ExecuteSql(sql));
        }
コード例 #11
0
        /// <summary>
        /// 新增信息
        /// </summary>
        /// <param name="Bo_TypeName">类型名称</param>
        /// <returns>受影响行数</returns>
        public int InsBorrow(string Bo_TypeName)
        {
            string sql = string.Format("insert into T_Borrow values('{0}')", Bo_TypeName);

            return(DbHelperSQL.ExecuteSql(sql));
        }