Example #1
0
        protected void RadButton1_Click(object sender, EventArgs e)
        {
            string yh       = "MachineSonName='" + TextBox1.Text + "'";
            string search1  = TextBox1.Text;
            string xxdz1    = TextBox1.Text.Trim();
            Regex  pattern1 = new Regex("[%--`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、? ' ’]");//特殊字符正则判断

            if ((pattern1.IsMatch(xxdz1) == true))
            {
                Response.Write("<script>alert('请不要输入特殊字符!')</script>");
                return;
            }
            DataSet ds = MachineSonType_bll.GetList(yh);

            if (TextBox1.Text == "")//判断输入框是否为空
            {
                Response.Write("<script>alert('请输入设备子类别!')</script>");
                return;
            }
            else if (MachineSonType_bll.GetRecordCount(" MachineSonName ='" + TextBox1.Text + "' ") != 0 && TextBox1.Text != name)//判断是否存在该子类别名称
            {
                Response.Write("<script>alert('该子类别名称已存在!')</script>");
            }
            else
            {
                //Maticsoft.Model.GoodsChildForm modelcclass1 = BLLCClass.GetModel(Request.QueryString["ID"].ToString());//引用id的所有信息
                MachineSonType_Model = MachineSonType_bll.GetModel(Request.QueryString["ID"].ToString());                     //引用id的所有信息
                MachineSonType_Model.MachineSonName = TextBox1.Text;                                                          //添加数据
                MachineSonType_bll.Update(MachineSonType_Model);                                                              //更新数据
                RadAjaxManager1.Alert("修改成功!");                                                                               //提示
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>CloseAndRebind();</script>"); //关闭弹窗
            }
        }
Example #2
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Maticsoft.Model.MachineSonType DataRowToModel(DataRow row)
		{
			Maticsoft.Model.MachineSonType model=new Maticsoft.Model.MachineSonType();
			if (row != null)
			{
				if(row["MachineSonID"]!=null)
				{
					model.MachineSonID=row["MachineSonID"].ToString();
				}
				if(row["MachineFatherID"]!=null)
				{
					model.MachineFatherID=row["MachineFatherID"].ToString();
				}
				if(row["MachineSonName"]!=null)
				{
					model.MachineSonName=row["MachineSonName"].ToString();
				}
				if(row["MachineSonAddTime"]!=null && row["MachineSonAddTime"].ToString()!="")
				{
					model.MachineSonAddTime=DateTime.Parse(row["MachineSonAddTime"].ToString());
				}
				if(row["MachineSonPicture"]!=null)
				{
					model.MachineSonPicture=row["MachineSonPicture"].ToString();
				}
				if(row["MachineSonIntroduction"]!=null)
				{
					model.MachineSonIntroduction=row["MachineSonIntroduction"].ToString();
				}
				if(row["EEE1"]!=null)
				{
					model.EEE1=row["EEE1"].ToString();
				}
				if(row["EEE2"]!=null)
				{
					model.EEE2=row["EEE2"].ToString();
				}
				if(row["EEE3"]!=null)
				{
					model.EEE3=row["EEE3"].ToString();
				}
				if(row["EEE4"]!=null)
				{
					model.EEE4=row["EEE4"].ToString();
				}
				if(row["EEE5"]!=null)
				{
					model.EEE5=row["EEE5"].ToString();
				}
			}
			return model;
		}
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UsersInfo.UserID == "")                                                                     //判断是否登录
     {
         Response.Write("<script> alert('请先登录'); window.location.href='/BackLogin.aspx' </script>"); //提示并跳转
     }
     else
     {
         if (!IsPostBack)
         {
             Maticsoft.Model.MachineSonType MachineSonType_Model = MachineSonType_bll.GetModel(Request.QueryString["ID"].ToString()); //引用id的所有信息
             name = TextBox1.Text = MachineSonType_Model.MachineSonName;                                                              //为输入框赋值
         }
     }
 }
Example #4
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Maticsoft.Model.MachineSonType GetModel(string MachineSonID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1  ");
			strSql.Append(" MachineSonID,MachineFatherID,MachineSonName,MachineSonAddTime,MachineSonPicture,MachineSonIntroduction,EEE1,EEE2,EEE3,EEE4,EEE5 ");
			strSql.Append(" from MachineSonType ");
			strSql.Append(" where MachineSonID='"+MachineSonID+"' " );
			Maticsoft.Model.MachineSonType model=new Maticsoft.Model.MachineSonType();
			DataSet ds=DbHelperSQL.Query(strSql.ToString());
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
                {
                    Maticsoft.Model.Replacement molr = bllr.GetModel(Request.QueryString["ID"].ToString());//引用id所在行的数据
                    if (molr == null)
                    {
                        Response.Write("<script>window.location.href='~/BackLogin.aspx'</script>");
                    }

                    Maticsoft.Model.MachineFatherType molmf = bllmf.GetModel(molr.MachineFatherID);
                    Maticsoft.Model.MachineSonType    molms = bllms.GetModel(molr.MachineSonID);

                    Label1.Text = molr.ReplacementID;
                    Label2.Text = molr.ReplacementModel;
                    Label3.Text = molr.ReplacementName;
                    Label4.Text = molmf.MachineFatherName + "-" + molms.MachineSonName;
                    Label5.Text = molr.ReplacementState;
                    Label6.Text = molr.ReplacementAddTime.ToString();

                    string st = molr.ReplacementPicture;

                    string[] sop = st.Split(';');

                    ImgList.Clear();

                    for (int i = 0; i < sop.Length - 1; i++)
                    {
                        ImgModel img = new ImgModel();
                        img.ID     = ImgList.Count + 1;
                        img.imgUrl = sop[i];
                        ImgList.Add(img);
                        RadListView1.Rebind();
                    }
                }
            }
        }
Example #6
0
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public bool Add(Maticsoft.Model.MachineSonType model)
		{
			StringBuilder strSql=new StringBuilder();
			StringBuilder strSql1=new StringBuilder();
			StringBuilder strSql2=new StringBuilder();
			if (model.MachineSonID != null)
			{
				strSql1.Append("MachineSonID,");
				strSql2.Append("'"+model.MachineSonID+"',");
			}
			if (model.MachineFatherID != null)
			{
				strSql1.Append("MachineFatherID,");
				strSql2.Append("'"+model.MachineFatherID+"',");
			}
			if (model.MachineSonName != null)
			{
				strSql1.Append("MachineSonName,");
				strSql2.Append("'"+model.MachineSonName+"',");
			}
			if (model.MachineSonAddTime != null)
			{
				strSql1.Append("MachineSonAddTime,");
				strSql2.Append("'"+model.MachineSonAddTime+"',");
			}
			if (model.MachineSonPicture != null)
			{
				strSql1.Append("MachineSonPicture,");
				strSql2.Append("'"+model.MachineSonPicture+"',");
			}
			if (model.MachineSonIntroduction != null)
			{
				strSql1.Append("MachineSonIntroduction,");
				strSql2.Append("'"+model.MachineSonIntroduction+"',");
			}
			if (model.EEE1 != null)
			{
				strSql1.Append("EEE1,");
				strSql2.Append("'"+model.EEE1+"',");
			}
			if (model.EEE2 != null)
			{
				strSql1.Append("EEE2,");
				strSql2.Append("'"+model.EEE2+"',");
			}
			if (model.EEE3 != null)
			{
				strSql1.Append("EEE3,");
				strSql2.Append("'"+model.EEE3+"',");
			}
			if (model.EEE4 != null)
			{
				strSql1.Append("EEE4,");
				strSql2.Append("'"+model.EEE4+"',");
			}
			if (model.EEE5 != null)
			{
				strSql1.Append("EEE5,");
				strSql2.Append("'"+model.EEE5+"',");
			}
			strSql.Append("insert into MachineSonType(");
			strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
			strSql.Append(")");
			strSql.Append(" values (");
			strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
			strSql.Append(")");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
Example #7
0
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(Maticsoft.Model.MachineSonType model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update MachineSonType set ");
			if (model.MachineFatherID != null)
			{
				strSql.Append("MachineFatherID='"+model.MachineFatherID+"',");
			}
			else
			{
				strSql.Append("MachineFatherID= null ,");
			}
			if (model.MachineSonName != null)
			{
				strSql.Append("MachineSonName='"+model.MachineSonName+"',");
			}
			else
			{
				strSql.Append("MachineSonName= null ,");
			}
			if (model.MachineSonAddTime != null)
			{
				strSql.Append("MachineSonAddTime='"+model.MachineSonAddTime+"',");
			}
			else
			{
				strSql.Append("MachineSonAddTime= null ,");
			}
			if (model.MachineSonPicture != null)
			{
				strSql.Append("MachineSonPicture='"+model.MachineSonPicture+"',");
			}
			else
			{
				strSql.Append("MachineSonPicture= null ,");
			}
			if (model.MachineSonIntroduction != null)
			{
				strSql.Append("MachineSonIntroduction='"+model.MachineSonIntroduction+"',");
			}
			else
			{
				strSql.Append("MachineSonIntroduction= null ,");
			}
			if (model.EEE1 != null)
			{
				strSql.Append("EEE1='"+model.EEE1+"',");
			}
			else
			{
				strSql.Append("EEE1= null ,");
			}
			if (model.EEE2 != null)
			{
				strSql.Append("EEE2='"+model.EEE2+"',");
			}
			else
			{
				strSql.Append("EEE2= null ,");
			}
			if (model.EEE3 != null)
			{
				strSql.Append("EEE3='"+model.EEE3+"',");
			}
			else
			{
				strSql.Append("EEE3= null ,");
			}
			if (model.EEE4 != null)
			{
				strSql.Append("EEE4='"+model.EEE4+"',");
			}
			else
			{
				strSql.Append("EEE4= null ,");
			}
			if (model.EEE5 != null)
			{
				strSql.Append("EEE5='"+model.EEE5+"',");
			}
			else
			{
				strSql.Append("EEE5= null ,");
			}
			int n = strSql.ToString().LastIndexOf(",");
			strSql.Remove(n, 1);
			strSql.Append(" where MachineSonID='"+ model.MachineSonID+"' ");
			int rowsAffected=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rowsAffected > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
                {
                    Maticsoft.Model.Replacement molr = bllr.GetModel(Request.QueryString["ID"].ToString());//引用id所在行的数据

                    if (molr.ReplacementState == "已借出")
                    {
                        Response.Write("<script>alert('已借出,无法修改!');window.location.href='SubstituteMachine.aspx'</script>");
                        return;
                    }
                    if (molr.ReplacementState == "已报废")
                    {
                        Response.Write("<script>alert('已报废,无法修改!');window.location.href='SubstituteMachine.aspx'</script>");
                        return;
                    }

                    if (molr == null)
                    {
                        Response.Write("<script>window.location.href='~/BackLogin.aspx'</script>");
                    }

                    MachineFather.Items.Clear();
                    MachineSon.Items.Clear();
                    MachineFather.Items.Add("请选择...");
                    MachineSon.Items.Add("请选择...");

                    MachineFather.DataSource     = bllmf.GetList("");
                    MachineFather.DataTextField  = "MachineFatherName";
                    MachineFather.DataValueField = "MachineFatherID";
                    MachineFather.DataBind();

                    MachineSon.DataSource     = bllms.GetList(" MachineFatherID ='" + MachineFather.SelectedValue + "'  ");
                    MachineSon.DataTextField  = "MachineSonName";
                    MachineSon.DataValueField = "MachineSonID";
                    MachineSon.DataBind();

                    Maticsoft.Model.MachineFatherType molmf = bllmf.GetModel(molr.MachineFatherID);
                    Maticsoft.Model.MachineSonType    molms = bllms.GetModel(molr.MachineSonID);

                    ReplacementName.Text        = molr.ReplacementName;
                    ReplacementModel.Text       = molr.ReplacementModel;
                    MachineFather.SelectedValue = molmf.MachineFatherID;

                    MachineSon.Items.Clear();       //清子类下拉框项目
                    MachineSon.Items.Add("请选择..."); //给市下拉框添加请选择
                    MachineSon.DataSource     = bllms.GetList(" MachineFatherID ='" + MachineFather.SelectedValue + "'  ");
                    MachineSon.DataTextField  = "MachineSonName";
                    MachineSon.DataValueField = "MachineSonID";
                    MachineSon.DataBind();

                    MachineSon.SelectedValue = molms.MachineSonID;
                    //DropDownList1.SelectedValue = molr.ReplacementState;

                    string st = molr.ReplacementPicture;

                    string[] sop = st.Split(';');

                    ImgList.Clear();

                    for (int i = 0; i < sop.Length - 1; i++)        //修改图片显示
                    {
                        ImgModel img = new ImgModel();
                        img.ID     = ImgList.Count + 1;
                        img.imgUrl = sop[i];
                        ImgList.Add(img);
                        RadListView1.Rebind();
                    }

                    //imgPic.ImageUrl = molr.ReplacementPicture;
                }
            }
        }