Esempio n. 1
0
        protected void RadButton1_Click(object sender, EventArgs e)
        {
            string yh       = "MachineFatherName='" + 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 = MachineFatherType_bll.GetList(yh);

            if (TextBox1.Text == "")//判断输入框是否为空
            {
                Response.Write("<script>alert('请输入设备父类别!')</script>");
                return;
            }
            else if (MachineFatherType_bll.GetRecordCount(" MachineFatherName ='" + TextBox1.Text + "' ") != 0 && TextBox1.Text != name)//判断是否存在该父类别名称
            {
                Response.Write("<script>.0alert('该父类别名称已存在!')</script>");
            }

            else
            {
                //Maticsoft.Model.GoodsParentForm modelfclass1 = BLLFClass.GetModel(Request.QueryString["ID"].ToString());//引用id的所有信息
                MachineFatherType_Model = MachineFatherType_bll.GetModel(Request.QueryString["ID"].ToString());               //引用id的所有信息
                MachineFatherType_Model.MachineFatherName = TextBox1.Text;                                                    //添加数据
                MachineFatherType_bll.Update(MachineFatherType_Model);                                                        //更新数据
                RadAjaxManager1.Alert("修改成功!");                                                                               //提示
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>CloseAndRebind();</script>"); //关闭弹窗
            }
        }
Esempio n. 2
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.MachineFatherType MachineFatherType_Model = MachineFatherType_bll.GetModel(Request.QueryString["ID"].ToString()); //引用id的所有信息
             name = TextBox1.Text = MachineFatherType_Model.MachineFatherName;                                                                 //为输入框赋值
         }
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.MachineFatherType DataRowToModel(DataRow row)
 {
     Maticsoft.Model.MachineFatherType model = new Maticsoft.Model.MachineFatherType();
     if (row != null)
     {
         if (row["MachineFatherID"] != null)
         {
             model.MachineFatherID = row["MachineFatherID"].ToString();
         }
         if (row["MachineFatherName"] != null)
         {
             model.MachineFatherName = row["MachineFatherName"].ToString();
         }
         if (row["MachineFatherAddTime"] != null && row["MachineFatherAddTime"].ToString() != "")
         {
             model.MachineFatherAddTime = DateTime.Parse(row["MachineFatherAddTime"].ToString());
         }
         if (row["MachineFatherPicture"] != null)
         {
             model.MachineFatherPicture = row["MachineFatherPicture"].ToString();
         }
         if (row["MachineFatherIntroduction"] != null)
         {
             model.MachineFatherIntroduction = row["MachineFatherIntroduction"].ToString();
         }
         if (row["DDD1"] != null)
         {
             model.DDD1 = row["DDD1"].ToString();
         }
         if (row["DDD2"] != null)
         {
             model.DDD2 = row["DDD2"].ToString();
         }
         if (row["DDD3"] != null)
         {
             model.DDD3 = row["DDD3"].ToString();
         }
         if (row["DDD4"] != null)
         {
             model.DDD4 = row["DDD4"].ToString();
         }
         if (row["DDD5"] != null)
         {
             model.DDD5 = row["DDD5"].ToString();
         }
     }
     return(model);
 }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.MachineFatherType GetModel(string MachineFatherID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" MachineFatherID,MachineFatherName,MachineFatherAddTime,MachineFatherPicture,MachineFatherIntroduction,DDD1,DDD2,DDD3,DDD4,DDD5 ");
            strSql.Append(" from MachineFatherType ");
            strSql.Append(" where MachineFatherID='" + MachineFatherID + "' ");
            Maticsoft.Model.MachineFatherType model = new Maticsoft.Model.MachineFatherType();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 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();
                    }
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.MachineFatherType model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.MachineFatherID != null)
            {
                strSql1.Append("MachineFatherID,");
                strSql2.Append("'" + model.MachineFatherID + "',");
            }
            if (model.MachineFatherName != null)
            {
                strSql1.Append("MachineFatherName,");
                strSql2.Append("'" + model.MachineFatherName + "',");
            }
            if (model.MachineFatherAddTime != null)
            {
                strSql1.Append("MachineFatherAddTime,");
                strSql2.Append("'" + model.MachineFatherAddTime + "',");
            }
            if (model.MachineFatherPicture != null)
            {
                strSql1.Append("MachineFatherPicture,");
                strSql2.Append("'" + model.MachineFatherPicture + "',");
            }
            if (model.MachineFatherIntroduction != null)
            {
                strSql1.Append("MachineFatherIntroduction,");
                strSql2.Append("'" + model.MachineFatherIntroduction + "',");
            }
            if (model.DDD1 != null)
            {
                strSql1.Append("DDD1,");
                strSql2.Append("'" + model.DDD1 + "',");
            }
            if (model.DDD2 != null)
            {
                strSql1.Append("DDD2,");
                strSql2.Append("'" + model.DDD2 + "',");
            }
            if (model.DDD3 != null)
            {
                strSql1.Append("DDD3,");
                strSql2.Append("'" + model.DDD3 + "',");
            }
            if (model.DDD4 != null)
            {
                strSql1.Append("DDD4,");
                strSql2.Append("'" + model.DDD4 + "',");
            }
            if (model.DDD5 != null)
            {
                strSql1.Append("DDD5,");
                strSql2.Append("'" + model.DDD5 + "',");
            }
            strSql.Append("insert into MachineFatherType(");
            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);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.MachineFatherType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update MachineFatherType set ");
            if (model.MachineFatherName != null)
            {
                strSql.Append("MachineFatherName='" + model.MachineFatherName + "',");
            }
            else
            {
                strSql.Append("MachineFatherName= null ,");
            }
            if (model.MachineFatherAddTime != null)
            {
                strSql.Append("MachineFatherAddTime='" + model.MachineFatherAddTime + "',");
            }
            else
            {
                strSql.Append("MachineFatherAddTime= null ,");
            }
            if (model.MachineFatherPicture != null)
            {
                strSql.Append("MachineFatherPicture='" + model.MachineFatherPicture + "',");
            }
            else
            {
                strSql.Append("MachineFatherPicture= null ,");
            }
            if (model.MachineFatherIntroduction != null)
            {
                strSql.Append("MachineFatherIntroduction='" + model.MachineFatherIntroduction + "',");
            }
            else
            {
                strSql.Append("MachineFatherIntroduction= null ,");
            }
            if (model.DDD1 != null)
            {
                strSql.Append("DDD1='" + model.DDD1 + "',");
            }
            else
            {
                strSql.Append("DDD1= null ,");
            }
            if (model.DDD2 != null)
            {
                strSql.Append("DDD2='" + model.DDD2 + "',");
            }
            else
            {
                strSql.Append("DDD2= null ,");
            }
            if (model.DDD3 != null)
            {
                strSql.Append("DDD3='" + model.DDD3 + "',");
            }
            else
            {
                strSql.Append("DDD3= null ,");
            }
            if (model.DDD4 != null)
            {
                strSql.Append("DDD4='" + model.DDD4 + "',");
            }
            else
            {
                strSql.Append("DDD4= null ,");
            }
            if (model.DDD5 != null)
            {
                strSql.Append("DDD5='" + model.DDD5 + "',");
            }
            else
            {
                strSql.Append("DDD5= null ,");
            }
            int n = strSql.ToString().LastIndexOf(",");

            strSql.Remove(n, 1);
            strSql.Append(" where MachineFatherID='" + model.MachineFatherID + "' ");
            int rowsAffected = DbHelperSQL.ExecuteSql(strSql.ToString());

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 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;
                }
            }
        }