Example #1
0
 protected void RadGrid1_PageIndexChanged(object sender, Telerik.Web.UI.GridPageChangedEventArgs e)
 {
     Maticsoft.Model.ReplacementRecord molpur = bllpur.GetModel(Request.QueryString["ID"].ToString());//引用id所在行的数据
     if (molpur != null)
     {
         Maticsoft.Model.ReplacementRecord molpur1 = bllpur.GetModel1(molpur.ReplacementRecordID);//引用id所在行的数据
         Maticsoft.BLL.ReplacementRecord   bllpur1 = new Maticsoft.BLL.ReplacementRecord();
         RadGrid1.Rebind();
     }
 }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.ReplacementRecord DataRowToModel(DataRow row)
 {
     Maticsoft.Model.ReplacementRecord model = new Maticsoft.Model.ReplacementRecord();
     if (row != null)
     {
         if (row["ReplacementRecordID"] != null)
         {
             model.ReplacementRecordID = row["ReplacementRecordID"].ToString();
         }
         if (row["ReplacementID"] != null)
         {
             model.ReplacementID = row["ReplacementID"].ToString();
         }
         if (row["ReplacementName"] != null)
         {
             model.ReplacementName = row["ReplacementName"].ToString();
         }
         if (row["ReplacementLendTime"] != null && row["ReplacementLendTime"].ToString() != "")
         {
             model.ReplacementLendTime = DateTime.Parse(row["ReplacementLendTime"].ToString());
         }
         if (row["ReplacementBackTime"] != null && row["ReplacementBackTime"].ToString() != "")
         {
             model.ReplacementBackTime = DateTime.Parse(row["ReplacementBackTime"].ToString());
         }
         if (row["UserID"] != null)
         {
             model.UserID = row["UserID"].ToString();
         }
         if (row["GGG1"] != null)
         {
             model.GGG1 = row["GGG1"].ToString();
         }
         if (row["GGG2"] != null)
         {
             model.GGG2 = row["GGG2"].ToString();
         }
         if (row["GGG3"] != null)
         {
             model.GGG3 = row["GGG3"].ToString();
         }
         if (row["GGG4"] != null)
         {
             model.GGG4 = row["GGG4"].ToString();
         }
         if (row["GGG5"] != null)
         {
             model.GGG5 = row["GGG5"].ToString();
         }
     }
     return(model);
 }
Example #3
0
        /*
         */
        public Maticsoft.Model.ReplacementRecord GetModelJYF2(string ReplacementID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" * ");
            strSql.Append(" from ReplacementRecord a,Declaration b ");
            strSql.Append(" where b.ReplacementID='" + ReplacementID + "'and a.ReplacementID = b.ReplacementID ");
            Maticsoft.Model.ReplacementRecord model = new Maticsoft.Model.ReplacementRecord();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #4
0
        public Maticsoft.Model.ReplacementRecord GetModel1(string ReplacementRecordID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" ReplacementRecordID,ReplacementID,ReplacementName,ReplacementLendTime,ReplacementBackTime,UserID,GGG1,GGG2,GGG3,GGG4,GGG5 ");
            strSql.Append(" from ReplacementRecord ");
            strSql.Append(" where ReplacementRecordID='" + ReplacementRecordID + "' ");
            Maticsoft.Model.ReplacementRecord model = new Maticsoft.Model.ReplacementRecord();
            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 RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            string id = e.CommandArgument.ToString();

            if (e.CommandName == "Chanel")
            {
                Response.Redirect("RepairEdit.aspx?ID=" + e.CommandArgument + "");//跳转修改页面
            }
            if (e.CommandName == "UP")
            {
                Declaration_Mol = Declaration_Bll.GetModel(e.CommandArgument.ToString());
                Declaration_Mol.DeclarationState = "装备中心待受理";
                Declaration_Bll.Update(Declaration_Mol);
                DataLoad();
                RadGrid1.Rebind();
            }
            if (e.CommandName == "Return")
            {
                Declaration_Mol = Declaration_Bll.GetModel(e.CommandArgument.ToString());
                Declaration_Mol.DeclarationState = "未上报";
                Declaration_Bll.Update(Declaration_Mol);
                DataLoad();
                RadGrid1.Rebind();
            }
            if (e.CommandName == "CheckOK")
            {
                Declaration_Mol = Declaration_Bll.GetModel(e.CommandArgument.ToString());
                Declaration_Mol.DeclarationState = "维修完成";
                Declaration_Bll.Update(Declaration_Mol);
                DataLoad();
                RadGrid1.Rebind();
            }
            if (e.CommandName == "CheckBack")
            {
                Declaration_Mol = Declaration_Bll.GetModel(e.CommandArgument.ToString());
                Replacement_Mol = Replacement_Bll.GetModelJYF(Declaration_Mol.ReplacementID);
                if (Declaration_Mol.ReplacementUse != "否")
                {
                    Replacement_Mol.ReplacementState = "未借出";
                    Replacement_Bll.Update(Replacement_Mol);
                    ReplacementRecord_Mol = ReplacementRecord_Bll.GetModelJYF2(Declaration_Mol.ReplacementID);
                    ReplacementRecord_Mol.ReplacementBackTime = DateTime.Now;
                    ReplacementRecord_Bll.Update(ReplacementRecord_Mol);
                }


                Declaration_Mol.DeclarationState = "报修单位已取回";
                Declaration_Bll.Update(Declaration_Mol);
                DataLoad();
                RadGrid1.Rebind();
            }
            if (e.CommandName == "Repair2")
            {
                Lable_xxx.Text = e.CommandArgument.ToString();
                //Response.Redirect("RepairBackAdd.aspx?ID=" + e.CommandArgument + "");
            }
            if (e.CommandName == "CheckRepair2Back")
            {
                Declaration_Mol = Declaration_Bll.GetModel(e.CommandArgument.ToString());
                Replacement_Mol = Replacement_Bll.GetModelJYF(Declaration_Mol.ReplacementID);
                if (Declaration_Mol.ReplacementUse != "否")
                {
                    Replacement_Mol.ReplacementState = "未借出";
                    Replacement_Bll.Update(Replacement_Mol);
                    ReplacementRecord_Mol.ReplacementBackTime = DateTime.Now;
                    ReplacementRecord_Bll.Update(ReplacementRecord_Mol);
                }
                Declaration_Mol.DeclarationState = "报修单位已取回(返修)";
                Declaration_Bll.Update(Declaration_Mol);
                DataLoad();
                RadGrid1.Rebind();
            }
            if (e.CommandName == "CheckRepair2OK")
            {
                Declaration_Mol = Declaration_Bll.GetModel(e.CommandArgument.ToString());
                Declaration_Mol.DeclarationState = "返修完成";
                Declaration_Bll.Update(Declaration_Mol);
                DataLoad();
                RadGrid1.Rebind();
            }
            if (e.CommandName == "Down")
            {
                Response.Redirect("RepairReport.aspx?ID=" + e.CommandArgument + "");//跳转报表页面
            }
        }
Example #6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.ReplacementRecord model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.ReplacementRecordID != null)
            {
                strSql1.Append("ReplacementRecordID,");
                strSql2.Append("'" + model.ReplacementRecordID + "',");
            }
            if (model.ReplacementID != null)
            {
                strSql1.Append("ReplacementID,");
                strSql2.Append("'" + model.ReplacementID + "',");
            }
            if (model.ReplacementName != null)
            {
                strSql1.Append("ReplacementName,");
                strSql2.Append("'" + model.ReplacementName + "',");
            }
            if (model.ReplacementLendTime != null)
            {
                strSql1.Append("ReplacementLendTime,");
                strSql2.Append("'" + model.ReplacementLendTime + "',");
            }
            if (model.ReplacementBackTime != null)
            {
                strSql1.Append("ReplacementBackTime,");
                strSql2.Append("'" + model.ReplacementBackTime + "',");
            }
            if (model.UserID != null)
            {
                strSql1.Append("UserID,");
                strSql2.Append("'" + model.UserID + "',");
            }
            if (model.GGG1 != null)
            {
                strSql1.Append("GGG1,");
                strSql2.Append("'" + model.GGG1 + "',");
            }
            if (model.GGG2 != null)
            {
                strSql1.Append("GGG2,");
                strSql2.Append("'" + model.GGG2 + "',");
            }
            if (model.GGG3 != null)
            {
                strSql1.Append("GGG3,");
                strSql2.Append("'" + model.GGG3 + "',");
            }
            if (model.GGG4 != null)
            {
                strSql1.Append("GGG4,");
                strSql2.Append("'" + model.GGG4 + "',");
            }
            if (model.GGG5 != null)
            {
                strSql1.Append("GGG5,");
                strSql2.Append("'" + model.GGG5 + "',");
            }
            strSql.Append("insert into ReplacementRecord(");
            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.ReplacementRecord model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ReplacementRecord set ");
            if (model.ReplacementID != null)
            {
                strSql.Append("ReplacementID='" + model.ReplacementID + "',");
            }
            else
            {
                strSql.Append("ReplacementID= null ,");
            }
            if (model.ReplacementName != null)
            {
                strSql.Append("ReplacementName='" + model.ReplacementName + "',");
            }
            else
            {
                strSql.Append("ReplacementName= null ,");
            }
            if (model.ReplacementLendTime != null)
            {
                strSql.Append("ReplacementLendTime='" + model.ReplacementLendTime + "',");
            }
            else
            {
                strSql.Append("ReplacementLendTime= null ,");
            }
            if (model.ReplacementBackTime != null)
            {
                strSql.Append("ReplacementBackTime='" + model.ReplacementBackTime + "',");
            }
            else
            {
                strSql.Append("ReplacementBackTime= null ,");
            }
            if (model.UserID != null)
            {
                strSql.Append("UserID='" + model.UserID + "',");
            }
            else
            {
                strSql.Append("UserID= null ,");
            }
            if (model.GGG1 != null)
            {
                strSql.Append("GGG1='" + model.GGG1 + "',");
            }
            else
            {
                strSql.Append("GGG1= null ,");
            }
            if (model.GGG2 != null)
            {
                strSql.Append("GGG2='" + model.GGG2 + "',");
            }
            else
            {
                strSql.Append("GGG2= null ,");
            }
            if (model.GGG3 != null)
            {
                strSql.Append("GGG3='" + model.GGG3 + "',");
            }
            else
            {
                strSql.Append("GGG3= null ,");
            }
            if (model.GGG4 != null)
            {
                strSql.Append("GGG4='" + model.GGG4 + "',");
            }
            else
            {
                strSql.Append("GGG4= null ,");
            }
            if (model.GGG5 != null)
            {
                strSql.Append("GGG5='" + model.GGG5 + "',");
            }
            else
            {
                strSql.Append("GGG5= null ,");
            }
            int n = strSql.ToString().LastIndexOf(",");

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

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