示例#1
0
        public static List <shebei> select(string name)
        {
            string        sql  = string.Format("select ID from Shebei where  name='{0}'", name);
            DataTable     dt   = DBHelper.ExecutReader(sql);
            List <shebei> list = new List <shebei>();

            foreach (DataRow dr in dt.Rows)
            {
                shebei sb = new shebei();

                sb.ID = (int)dr["ID"];
                //sb.Name = dr["Name"].ToString();
                //sb.TypeName = dr["TypeName"].ToString();
                //sb.State = dr["State"].ToString();
                //sb.XulieNumber = dr["XulieNumber"].ToString();
                //sb.Xinghao = dr["Xinghao"].ToString();
                //sb.Pinpai = dr["Pinpai"].ToString();
                //sb.Shopdata = dr["Shopdata"].ToString();
                //sb.Factory = dr["Factory"].ToString();
                //sb.Outdata = dr["Outdata"].ToString();
                //sb.Url = dr["Url"].ToString();
                //sb.Beizu = dr["Beizu"].ToString();
                list.Add(sb);
            }
            return(list);
        }
示例#2
0
        public static bool update(shebei sb)
        {
            string sql = string.Format("update  Shebei set Name='{0}',Typeid={1},State='{2}',XulieNumber='{3}',Xinghao='{4}',Pinpai='{5}',Shopdata='{6}',Factory='{7}',Outdata='{8}',Url='{9}',Beizu='{10}' where Name='{11}'"
                                       , sb.Name, sb.Typeid, sb.State, sb.XulieNumber, sb.Xinghao, sb.Pinpai, sb.Shopdata, sb.Factory, sb.Outdata, sb.Url, sb.Beizu, sb.Name);

            return(DBHelper.ExecutNonQuery(sql));
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            shebei sb = new shebei();

            sb.Name = this.TextBox1.Text;
            if (this.DropDownList1.SelectedItem.Text == "常用类")
            {
                sb.Typeid = 1;
            }
            if (this.DropDownList1.SelectedItem.Text == "普通类")
            {
                sb.Typeid = 2;
            }
            if (this.DropDownList1.SelectedItem.Text == "其他类")
            {
                sb.Typeid = 3;
            }
            sb.Xinghao     = this.TextBox3.Text;
            sb.Pinpai      = this.TextBox4.Text;
            sb.XulieNumber = this.TextBox5.Text;
            sb.Shopdata    = this.TextBox7.Text;
            sb.Outdata     = this.TextBox8.Text;
            sb.Factory     = this.TextBox6.Text;

            if (FileUpload2.HasFile)
            {
                string filename    = FileUpload2.FileName;
                string ex          = filename.Substring(filename.LastIndexOf("."));
                string newfilename = DateTime.Now.Ticks.ToString() + new Random().Next(100000, 1000000) + ex;
                string path        = Server.MapPath("/") + "Images/";
                FileUpload2.SaveAs(path + newfilename);
                this.TextBox2.Text   = "Images/" + newfilename;
                sb.Url               = "Images/" + newfilename;
                sb.Beizu             = this.TextBox11.Text;
                this.Image1.ImageUrl = sb.Url;
            }

            this.TextBox2.Text = sb.Url;
            if (ShebeiManger.update(sb))
            {
                Response.Write("<script>alert('更新成功!')</script>");
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            shebei sb = new shebei();

            sb.Name = this.TextBox1.Text;
            if (this.DropDownList1.Text == "常用类")
            {
                sb.Typeid = 1;
            }
            if (this.DropDownList1.Text == "普通类")
            {
                sb.Typeid = 1;
            }
            if (this.DropDownList1.Text == "其他类")
            {
                sb.Typeid = 1;
            }
            sb.Xinghao     = this.TextBox3.Text;
            sb.Pinpai      = this.TextBox4.Text;
            sb.XulieNumber = this.TextBox5.Text;
            sb.Shopdata    = this.TextBox7.Text;
            sb.Outdata     = this.TextBox8.Text;
            sb.Factory     = this.TextBox6.Text;

            if (FileUpload2.HasFile)
            {
                string filename    = FileUpload2.FileName;
                string ex          = filename.Substring(filename.LastIndexOf("."));
                string newfilename = DateTime.Now.Ticks.ToString() + new Random().Next(100000, 1000000) + ex;
                string path        = Server.MapPath("/") + "Images/";
                FileUpload2.SaveAs(path + newfilename);
                this.TextBox2.Text = "Images/" + newfilename;
                sb.Url             = "Images/" + newfilename;
                sb.Beizu           = this.TextBox11.Text;
                if (ShebeiManger.insert(sb))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "loginSucess", "<script>alert('添加成功! ')</script>");
                }
            }
        }
示例#5
0
        public static List <shebei> selectlist(string name, string typename, string datatime)
        {
            string sql = string.Format("select * from Shebei,SheBeiType where Shebei.typeid=SheBeiType.TypeId ");

            if (name != "")
            {
                sql += string.Format("and Name='{0}'", name);
            }
            if (typename != "----请选择类型----")
            {
                sql += string.Format("and TypeName='{0}'", typename);
            }
            if (datatime != "")
            {
                sql += string.Format("and Shopdata>='{0}'", datatime);
            }

            DataTable     dt   = DBHelper.ExecutReader(sql);
            List <shebei> list = new List <shebei>();

            foreach (DataRow dr in dt.Rows)
            {
                shebei sb = new shebei();
                sb.ID          = (int)dr["ID"];
                sb.Name        = dr["Name"].ToString();
                sb.TypeName    = dr["TypeName"].ToString();
                sb.State       = dr["State"].ToString();
                sb.XulieNumber = dr["XulieNumber"].ToString();
                sb.Xinghao     = dr["Xinghao"].ToString();
                sb.Pinpai      = dr["Pinpai"].ToString();
                sb.Shopdata    = dr["Shopdata"].ToString();
                sb.Factory     = dr["Factory"].ToString();
                sb.Outdata     = dr["Outdata"].ToString();
                sb.Url         = dr["Url"].ToString();
                sb.Beizu       = dr["Beizu"].ToString();
                list.Add(sb);
            }
            return(list);
        }
示例#6
0
        public static bool insert(shebei sb)
        {
            string sql = string.Format("insert into Shebei values('{0}',{1},'空闲','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", sb.Name, sb.Typeid, sb.XulieNumber, sb.Xinghao, sb.Pinpai, sb.Shopdata, sb.Factory, sb.Outdata, sb.Url, sb.Beizu);

            return(DBHelper.ExecutNonQuery(sql));
        }