Example #1
0
        //更新密码
        public bool changepwd(XHD.Model.Sys_FactoryInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Sys_FactoryInfo set ");
            strSql.Append("Factory_Pws=@Factory_Pws");
            strSql.Append(" where ID=@ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Factory_Pws", MySqlDbType.VarChar, 50),
                new MySqlParameter("@ID",          MySqlDbType.Int32, 4)
            };

            parameters[0].Value = model.Factory_Pws;
            parameters[1].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public XHD.Model.Sys_FactoryInfo DataRowToModel(DataRow row)
 {
     XHD.Model.Sys_FactoryInfo model = new XHD.Model.Sys_FactoryInfo();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["Factory_Id"] != null)
         {
             model.Factory_Id = row["Factory_Id"].ToString();
         }
         if (row["Factory_Name"] != null)
         {
             model.Factory_Name = row["Factory_Name"].ToString();
         }
         if (row["Factory_Pws"] != null)
         {
             model.Factory_Pws = row["Factory_Pws"].ToString();
         }
         if (row["Factory_Log"] != null)
         {
             model.Factory_Log = row["Factory_Log"].ToString();
         }
         if (row["Factory_Tel"] != null)
         {
             model.Factory_Tel = row["Factory_Tel"].ToString();
         }
         if (row["Factory_Email"] != null)
         {
             model.Factory_Email = row["Factory_Email"].ToString();
         }
         if (row["Factory_Linkman"] != null)
         {
             model.Factory_Linkman = row["Factory_Linkman"].ToString();
         }
         if (row["Factory_Address"] != null)
         {
             model.Factory_Address = row["Factory_Address"].ToString();
         }
         if (row["Create_Date"] != null && row["Create_Date"].ToString() != "")
         {
             model.Create_Date = DateTime.Parse(row["Create_Date"].ToString());
         }
         if (row["Create_Name"] != null)
         {
             model.Create_Name = row["Create_Name"].ToString();
         }
         if (row["IsDelete"] != null)
         {
             model.IsDelete = row["IsDelete"].ToString();
         }
         if (row["Linkman_tel"] != null)
         {
             model.Linkman_tel = row["Linkman_tel"].ToString();
         }
     }
     return(model);
 }
Example #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(XHD.Model.Sys_FactoryInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Sys_FactoryInfo set ");
            strSql.Append("Factory_Id=@Factory_Id,");
            strSql.Append("Factory_Name=@Factory_Name,");
            strSql.Append("Factory_Pws=@Factory_Pws,");
            strSql.Append("Factory_Log=@Factory_Log,");
            strSql.Append("Factory_Tel=@Factory_Tel,");
            strSql.Append("Factory_Email=@Factory_Email,");
            strSql.Append("Factory_Linkman=@Factory_Linkman,");
            strSql.Append("Factory_Address=@Factory_Address,");
            strSql.Append("IsDelete=@IsDelete,");
            strSql.Append("Linkman_tel=@Linkman_tel,");
            strSql.Append("Factory_UserNum=@Factory_UserNum,");
            strSql.Append("Default_Account=@Default_Account");
            strSql.Append(" where ID=@ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Factory_Id",      MySqlDbType.VarString,  60),
                new MySqlParameter("@Factory_Name",    MySqlDbType.VarString, 100),
                new MySqlParameter("@Factory_Pws",     MySqlDbType.VarString, 100),
                new MySqlParameter("@Factory_Log",     MySqlDbType.VarString, 100),
                new MySqlParameter("@Factory_Tel",     MySqlDbType.VarString,  50),
                new MySqlParameter("@Factory_Email",   MySqlDbType.VarString,  50),
                new MySqlParameter("@Factory_Linkman", MySqlDbType.VarString,  50),
                new MySqlParameter("@Factory_Address", MySqlDbType.VarString,  50),
                new MySqlParameter("@IsDelete",        MySqlDbType.VarChar,     1),
                new MySqlParameter("@Linkman_tel",     MySqlDbType.VarString,  50),
                new MySqlParameter("@Factory_UserNum", MySqlDbType.Int32,       4),
                new MySqlParameter("@Default_Account", MySqlDbType.VarString,  50),
                new MySqlParameter("@ID",              MySqlDbType.Int32, 4)
            };
            parameters[0].Value  = model.Factory_Id;
            parameters[1].Value  = model.Factory_Name;
            parameters[2].Value  = model.Factory_Pws;
            parameters[3].Value  = model.Factory_Log;
            parameters[4].Value  = model.Factory_Tel;
            parameters[5].Value  = model.Factory_Email;
            parameters[6].Value  = model.Factory_Linkman;
            parameters[7].Value  = model.Factory_Address;
            parameters[8].Value  = model.IsDelete;
            parameters[9].Value  = model.Linkman_tel;
            parameters[10].Value = model.Factory_userNum;
            parameters[11].Value = model.Default_Account;
            parameters[12].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(XHD.Model.Sys_FactoryInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Sys_FactoryInfo(");
            strSql.Append("Factory_Id,Factory_Name,Factory_Pws,Factory_Log,Factory_Tel,Factory_Email,Factory_Linkman,Factory_Address,Create_Date,Create_Name,IsDelete,Linkman_tel,Factory_UserNum,Default_Account,empID,Default_role)");
            strSql.Append(" values (");
            strSql.Append("@Factory_Id,@Factory_Name,@Factory_Pws,@Factory_Log,@Factory_Tel,@Factory_Email,@Factory_Linkman,@Factory_Address,@Create_Date,@Create_Name,@IsDelete,@Linkman_tel,@Factory_UserNum,@Default_Account,@empID,@Default_role)");
            strSql.Append(";select @@IDENTITY");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Factory_Id",      MySqlDbType.VarString,  60),
                new MySqlParameter("@Factory_Name",    MySqlDbType.VarString, 100),
                new MySqlParameter("@Factory_Pws",     MySqlDbType.VarString, 100),
                new MySqlParameter("@Factory_Log",     MySqlDbType.VarString, 100),
                new MySqlParameter("@Factory_Tel",     MySqlDbType.VarString,  50),
                new MySqlParameter("@Factory_Email",   MySqlDbType.VarString,  50),
                new MySqlParameter("@Factory_Linkman", MySqlDbType.VarString,  50),
                new MySqlParameter("@Factory_Address", MySqlDbType.VarString,  50),
                new MySqlParameter("@Create_Date",     MySqlDbType.DateTime),
                new MySqlParameter("@Create_Name",     MySqlDbType.VarString,  50),
                new MySqlParameter("@IsDelete",        MySqlDbType.VarChar,     1),
                new MySqlParameter("@Linkman_tel",     MySqlDbType.VarString,  50),
                new MySqlParameter("@Factory_UserNum", MySqlDbType.Int32,       4),
                new MySqlParameter("@Default_Account", MySqlDbType.VarString,  50),
                new MySqlParameter("@empID",           MySqlDbType.Int32,       4),
                new MySqlParameter("@Default_role",    MySqlDbType.Int32, 4)
            };
            parameters[0].Value  = model.Factory_Id;
            parameters[1].Value  = model.Factory_Name;
            parameters[2].Value  = model.Factory_Pws;
            parameters[3].Value  = model.Factory_Log;
            parameters[4].Value  = model.Factory_Tel;
            parameters[5].Value  = model.Factory_Email;
            parameters[6].Value  = model.Factory_Linkman;
            parameters[7].Value  = model.Factory_Address;
            parameters[8].Value  = model.Create_Date;
            parameters[9].Value  = model.Create_Name;
            parameters[10].Value = model.IsDelete;
            parameters[11].Value = model.Linkman_tel;
            parameters[12].Value = model.Factory_userNum;
            parameters[13].Value = model.Default_Account;
            parameters[14].Value = model.empID;
            parameters[15].Value = model.Default_role;

            object obj = DbHelperMySQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XHD.Model.Sys_FactoryInfo GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  ID,Factory_Id,Factory_Name,Factory_Pws,Factory_Log,Factory_Tel,Factory_Email,Factory_Linkman,Factory_Address,Create_Date,Create_Name,IsDelete,Linkman_tel,Default_Account,empID,Default_role from Sys_FactoryInfo ");
            strSql.Append(" where ID=@ID limit 1");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@ID", MySqlDbType.Int32, 4)
            };
            parameters[0].Value = ID;

            XHD.Model.Sys_FactoryInfo model = new XHD.Model.Sys_FactoryInfo();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }