예제 #1
0
        protected void btnadd_Click(object sender, EventArgs e)
        {
            string name   = "^[a-zA-Z0-9\u4e00-\u9fa5-]{1,}$";//字母数字汉字-
            Regex  rxname = new Regex(name);

            modelPart = bllPart.GetModel(Request.QueryString["ID"].ToString());
            if (PartName.Text.Trim() == "")
            {
                RadAjaxManager1.Alert("配件名称不能为空!");
                return;
            }
            if (!rxname.IsMatch(PartName.Text.Trim()) && PartName.Text.Trim() != "")
            {
                RadAjaxManager1.Alert("配件名称不能输入特殊字符!");
                return;
            }
            if (bllPart.GetList("  PartName='" + PartName.Text + "'  ").Tables[0].Rows.Count != 0 && PartName.Text.Trim() != modelPart.PartName)
            {
                RadAjaxManager1.Alert("该名称已存在!");
                return;
            }

            modelPart.PartName = PartName.Text;
            bllPart.Update(modelPart);
            RadAjaxManager1.Alert("修改成功!");
            ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>CloseAndRebind();</script>");
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UsersInfo.UserID == "" || UsersInfo.UserRole != "维修中心管理员")
     {
         UsersInfo.UserID   = "";
         UsersInfo.UserName = "";
         UsersInfo.UserRole = "";
         Response.Redirect("~/BackLogin.aspx");
         return;
     }
     btnback.Attributes["onclick"] = "GetClose();return false;";
     if (!IsPostBack)
     {
         if (Request.QueryString["ID"] == null)
         {
             Response.Write("<script>window.location.href='PartsType.aspx'</script>");
             return;
         }
         modelPart = bllPart.GetModel(Request.QueryString["ID"].ToString());
         if (modelPart == null)
         {
             ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>CloseAndRebind();</script>");
             return;
         }
         PartName.Text = modelPart.PartName;
     }
 }
예제 #3
0
        protected void RadListView1_ItemCommand(object sender, Telerik.Web.UI.RadListViewCommandEventArgs e)
        {
            partsCost si = new partsCost();

            if (e.CommandName == "tian")//判断是不是添加
            {
                PartPutRecordModel = PartPutRecordBLL.GetModelyyy(e.CommandArgument.ToString());
                if ((partsChoice.partsChoiceList.Where(x => x.PartPutRecordID == PartPutRecordModel.PartPutRecordID).Count() == 0)) //判断list里面有没有这条数据
                {
                    Part_Model         = Part_BLL.GetModel(PartPutRecordModel.PartID);                                              //数据库查找信息
                    si.PartID          = PartPutRecordModel.PartID;                                                                 //配件ID(子)
                    si.Partmoney       = PartPutRecordModel.PartPrice.ToString();                                                   //价格
                    si.PartName        = Part_Model.PartName;                                                                       //名字
                    si.PartPicture     = PartPutRecordModel.PartPicture;                                                            //图片
                    si.PartPrice       = PartPutRecordModel.PartPrice.ToString();                                                   //价格
                    si.PartUseNumber   = "1";                                                                                       //数量
                    si.PartPutNumber   = PartPutRecordModel.PartPutNumber.ToString();                                               //库存
                    si.PartPutRecordID = PartPutRecordModel.PartPutRecordID;                                                        //配件入库ID
                    partsChoice.partsChoiceList.Add(si);                                                                            //加入list
                    RadAjaxManager1.Alert("添加成功!");
                    //    return;
                }
                else
                {
                    RadAjaxManager1.Alert("已经添加过该配件!");
                }
            }
        }
예제 #4
0
파일: Part.cs 프로젝트: Jyf524/Repair
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.Part DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Part model = new Maticsoft.Model.Part();
     if (row != null)
     {
         if (row["PartID"] != null)
         {
             model.PartID = row["PartID"].ToString();
         }
         if (row["PartTypeID"] != null)
         {
             model.PartTypeID = row["PartTypeID"].ToString();
         }
         if (row["PartName"] != null)
         {
             model.PartName = row["PartName"].ToString();
         }
         if (row["PartPicture"] != null)
         {
             model.PartPicture = row["PartPicture"].ToString();
         }
         if (row["PartIntroduction"] != null)
         {
             model.PartIntroduction = row["PartIntroduction"].ToString();
         }
         if (row["PartAddTime"] != null && row["PartAddTime"].ToString() != "")
         {
             model.PartAddTime = DateTime.Parse(row["PartAddTime"].ToString());
         }
         if (row["as1"] != null)
         {
             model.as1 = row["as1"].ToString();
         }
         if (row["as2"] != null)
         {
             model.as2 = row["as2"].ToString();
         }
         if (row["as3"] != null)
         {
             model.as3 = row["as3"].ToString();
         }
         if (row["as4"] != null)
         {
             model.as4 = row["as4"].ToString();
         }
         if (row["as5"] != null)
         {
             model.as5 = row["as5"].ToString();
         }
         if (row["as6"] != null)
         {
             model.as6 = row["as6"].ToString();
         }
     }
     return(model);
 }
예제 #5
0
파일: Part.cs 프로젝트: Jyf524/Repair
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.Part DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Part model = new Maticsoft.Model.Part();
     if (row != null)
     {
         if (row["PartID"] != null)
         {
             model.PartID = row["PartID"].ToString();
         }
         if (row["PartTypeID"] != null)
         {
             model.PartTypeID = row["PartTypeID"].ToString();
         }
         if (row["PartName"] != null)
         {
             model.PartName = row["PartName"].ToString();
         }
         if (row["PartModel"] != null)
         {
             model.PartModel = row["PartModel"].ToString();
         }
         if (row["PartPicture"] != null)
         {
             model.PartPicture = row["PartPicture"].ToString();
         }
         if (row["PartIntroduction"] != null)
         {
             model.PartIntroduction = row["PartIntroduction"].ToString();
         }
         if (row["PartStock"] != null && row["PartStock"].ToString() != "")
         {
             model.PartStock = int.Parse(row["PartStock"].ToString());
         }
         if (row["PartPrice"] != null && row["PartPrice"].ToString() != "")
         {
             model.PartPrice = decimal.Parse(row["PartPrice"].ToString());
         }
         if (row["PartAddTime"] != null && row["PartAddTime"].ToString() != "")
         {
             model.PartAddTime = DateTime.Parse(row["PartAddTime"].ToString());
         }
     }
     return(model);
 }
예제 #6
0
파일: Part.cs 프로젝트: Jyf524/Repair
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Part GetModel(string PartID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" PartID,PartTypeID,PartName,PartModel,PartPicture,PartIntroduction,PartStock,PartPrice,PartAddTime ");
            strSql.Append(" from Part ");
            strSql.Append(" where PartID='" + PartID + "' ");
            Maticsoft.Model.Part model = new Maticsoft.Model.Part();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #7
0
파일: Part.cs 프로젝트: Jyf524/Repair
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.Part model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.PartID != null)
            {
                strSql1.Append("PartID,");
                strSql2.Append("'" + model.PartID + "',");
            }
            if (model.PartTypeID != null)
            {
                strSql1.Append("PartTypeID,");
                strSql2.Append("'" + model.PartTypeID + "',");
            }
            if (model.PartName != null)
            {
                strSql1.Append("PartName,");
                strSql2.Append("'" + model.PartName + "',");
            }
            if (model.PartModel != null)
            {
                strSql1.Append("PartModel,");
                strSql2.Append("'" + model.PartModel + "',");
            }
            if (model.PartPicture != null)
            {
                strSql1.Append("PartPicture,");
                strSql2.Append("'" + model.PartPicture + "',");
            }
            if (model.PartIntroduction != null)
            {
                strSql1.Append("PartIntroduction,");
                strSql2.Append("'" + model.PartIntroduction + "',");
            }
            if (model.PartStock != null)
            {
                strSql1.Append("PartStock,");
                strSql2.Append("" + model.PartStock + ",");
            }
            if (model.PartPrice != null)
            {
                strSql1.Append("PartPrice,");
                strSql2.Append("" + model.PartPrice + ",");
            }
            if (model.PartAddTime != null)
            {
                strSql1.Append("PartAddTime,");
                strSql2.Append("'" + model.PartAddTime + "',");
            }
            strSql.Append("insert into Part(");
            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);
            }
        }
예제 #8
0
파일: Part.cs 프로젝트: Jyf524/Repair
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.Part model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Part set ");
            if (model.PartTypeID != null)
            {
                strSql.Append("PartTypeID='" + model.PartTypeID + "',");
            }
            else
            {
                strSql.Append("PartTypeID= null ,");
            }
            if (model.PartName != null)
            {
                strSql.Append("PartName='" + model.PartName + "',");
            }
            else
            {
                strSql.Append("PartName= null ,");
            }
            if (model.PartModel != null)
            {
                strSql.Append("PartModel='" + model.PartModel + "',");
            }
            else
            {
                strSql.Append("PartModel= null ,");
            }
            if (model.PartPicture != null)
            {
                strSql.Append("PartPicture='" + model.PartPicture + "',");
            }
            else
            {
                strSql.Append("PartPicture= null ,");
            }
            if (model.PartIntroduction != null)
            {
                strSql.Append("PartIntroduction='" + model.PartIntroduction + "',");
            }
            else
            {
                strSql.Append("PartIntroduction= null ,");
            }
            if (model.PartStock != null)
            {
                strSql.Append("PartStock=" + model.PartStock + ",");
            }
            else
            {
                strSql.Append("PartStock= null ,");
            }
            if (model.PartPrice != null)
            {
                strSql.Append("PartPrice=" + model.PartPrice + ",");
            }
            else
            {
                strSql.Append("PartPrice= null ,");
            }
            if (model.PartAddTime != null)
            {
                strSql.Append("PartAddTime='" + model.PartAddTime + "',");
            }
            else
            {
                strSql.Append("PartAddTime= null ,");
            }
            int n = strSql.ToString().LastIndexOf(",");

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

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #9
0
파일: Part.cs 프로젝트: Jyf524/Repair
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.Part model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.PartID != null)
            {
                strSql1.Append("PartID,");
                strSql2.Append("'" + model.PartID + "',");
            }
            if (model.PartTypeID != null)
            {
                strSql1.Append("PartTypeID,");
                strSql2.Append("'" + model.PartTypeID + "',");
            }
            if (model.PartName != null)
            {
                strSql1.Append("PartName,");
                strSql2.Append("'" + model.PartName + "',");
            }
            if (model.PartPicture != null)
            {
                strSql1.Append("PartPicture,");
                strSql2.Append("'" + model.PartPicture + "',");
            }
            if (model.PartIntroduction != null)
            {
                strSql1.Append("PartIntroduction,");
                strSql2.Append("'" + model.PartIntroduction + "',");
            }
            if (model.PartAddTime != null)
            {
                strSql1.Append("PartAddTime,");
                strSql2.Append("'" + model.PartAddTime + "',");
            }
            if (model.as1 != null)
            {
                strSql1.Append("as1,");
                strSql2.Append("'" + model.as1 + "',");
            }
            if (model.as2 != null)
            {
                strSql1.Append("as2,");
                strSql2.Append("'" + model.as2 + "',");
            }
            if (model.as3 != null)
            {
                strSql1.Append("as3,");
                strSql2.Append("'" + model.as3 + "',");
            }
            if (model.as4 != null)
            {
                strSql1.Append("as4,");
                strSql2.Append("'" + model.as4 + "',");
            }
            if (model.as5 != null)
            {
                strSql1.Append("as5,");
                strSql2.Append("'" + model.as5 + "',");
            }
            if (model.as6 != null)
            {
                strSql1.Append("as6,");
                strSql2.Append("'" + model.as6 + "',");
            }
            strSql.Append("insert into Part(");
            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);
            }
        }
예제 #10
0
파일: Part.cs 프로젝트: Jyf524/Repair
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.Part model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Part set ");
            if (model.PartTypeID != null)
            {
                strSql.Append("PartTypeID='" + model.PartTypeID + "',");
            }
            else
            {
                strSql.Append("PartTypeID= null ,");
            }
            if (model.PartName != null)
            {
                strSql.Append("PartName='" + model.PartName + "',");
            }
            else
            {
                strSql.Append("PartName= null ,");
            }
            if (model.PartPicture != null)
            {
                strSql.Append("PartPicture='" + model.PartPicture + "',");
            }
            else
            {
                strSql.Append("PartPicture= null ,");
            }
            if (model.PartIntroduction != null)
            {
                strSql.Append("PartIntroduction='" + model.PartIntroduction + "',");
            }
            else
            {
                strSql.Append("PartIntroduction= null ,");
            }
            if (model.PartAddTime != null)
            {
                strSql.Append("PartAddTime='" + model.PartAddTime + "',");
            }
            else
            {
                strSql.Append("PartAddTime= null ,");
            }
            if (model.as1 != null)
            {
                strSql.Append("as1='" + model.as1 + "',");
            }
            else
            {
                strSql.Append("as1= null ,");
            }
            if (model.as2 != null)
            {
                strSql.Append("as2='" + model.as2 + "',");
            }
            else
            {
                strSql.Append("as2= null ,");
            }
            if (model.as3 != null)
            {
                strSql.Append("as3='" + model.as3 + "',");
            }
            else
            {
                strSql.Append("as3= null ,");
            }
            if (model.as4 != null)
            {
                strSql.Append("as4='" + model.as4 + "',");
            }
            else
            {
                strSql.Append("as4= null ,");
            }
            if (model.as5 != null)
            {
                strSql.Append("as5='" + model.as5 + "',");
            }
            else
            {
                strSql.Append("as5= null ,");
            }
            if (model.as6 != null)
            {
                strSql.Append("as6='" + model.as6 + "',");
            }
            else
            {
                strSql.Append("as6= null ,");
            }
            int n = strSql.ToString().LastIndexOf(",");

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

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }