Esempio n. 1
0
        //
        // GET: /DetectProject/

        public ActionResult DetectProjectList(int LaboratoryID)
        {
            E_tb_DetectProject eDetectProject = new E_tb_DetectProject();

            eDetectProject.LaboratoryID = LaboratoryID;
            return(View(eDetectProject));
        }
Esempio n. 2
0
        /// <summary>
        /// 显示详情页
        /// </summary>
        /// <param name="EditType">编辑类型</param>
        /// <returns>返回编辑结果</returns>
        public ActionResult DetectProjectEdit(E_tb_DetectProject eDetectProject, int LaboratoryID, string EditType, int?InfoID)
        {
            ViewData["ProjectList"]   = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", false);
            ViewData["PersonnelList"] = PageTools.GetSelectList(tInPersonnel.GetList("").Tables[0], "PersonnelID", "PersonnelName", false);

            if (EditType == "Edit")
            {
                eDetectProject = tDetectProject.GetModel(Convert.ToInt32(InfoID));
            }
            eDetectProject.EditType     = EditType;
            eDetectProject.LaboratoryID = LaboratoryID;
            return(View(eDetectProject));
        }
Esempio n. 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(E_tb_DetectProject model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_DetectProject set ");
            strSql.Append("LaboratoryID=@LaboratoryID,");
            strSql.Append("RelationProjectID=@RelationProjectID,");
            strSql.Append("TaskNo=@TaskNo,");
            strSql.Append("ProjectName=@ProjectName,");
            strSql.Append("DetectTime=@DetectTime,");
            strSql.Append("HeadPersonnelID=@HeadPersonnelID,");
            strSql.Append("MainPerson=@MainPerson,");
            strSql.Append("Tel=@Tel,");
            strSql.Append("UpdateTime=@UpdateTime");
            strSql.Append(" where ProjectID=@ProjectID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LaboratoryID",      SqlDbType.Int,        4),
                new SqlParameter("@RelationProjectID", SqlDbType.Int,        4),
                new SqlParameter("@TaskNo",            SqlDbType.NVarChar,  50),
                new SqlParameter("@ProjectName",       SqlDbType.NVarChar,  50),
                new SqlParameter("@DetectTime",        SqlDbType.DateTime),
                new SqlParameter("@HeadPersonnelID",   SqlDbType.Int,        4),
                new SqlParameter("@MainPerson",        SqlDbType.NVarChar,  50),
                new SqlParameter("@Tel",               SqlDbType.NVarChar,  50),
                new SqlParameter("@UpdateTime",        SqlDbType.DateTime),
                new SqlParameter("@ProjectID",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.LaboratoryID;
            parameters[1].Value = model.RelationProjectID;
            parameters[2].Value = model.TaskNo;
            parameters[3].Value = model.ProjectName;
            parameters[4].Value = model.DetectTime;
            parameters[5].Value = model.HeadPersonnelID;
            parameters[6].Value = model.MainPerson;
            parameters[7].Value = model.Tel;
            parameters[8].Value = model.UpdateTime;
            parameters[9].Value = model.ProjectID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <E_tb_DetectProject> DataTableToList(DataTable dt)
        {
            List <E_tb_DetectProject> modelList = new List <E_tb_DetectProject>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                E_tb_DetectProject model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new E_tb_DetectProject();
                    if (dt.Rows[n]["ProjectID"].ToString() != "")
                    {
                        model.ProjectID = int.Parse(dt.Rows[n]["ProjectID"].ToString());
                    }
                    if (dt.Rows[n]["LaboratoryID"].ToString() != "")
                    {
                        model.LaboratoryID = int.Parse(dt.Rows[n]["LaboratoryID"].ToString());
                    }
                    if (dt.Rows[n]["RelationProjectID"].ToString() != "")
                    {
                        model.RelationProjectID = int.Parse(dt.Rows[n]["RelationProjectID"].ToString());
                    }
                    model.TaskNo      = dt.Rows[n]["TaskNo"].ToString();
                    model.ProjectName = dt.Rows[n]["ProjectName"].ToString();
                    if (dt.Rows[n]["DetectTime"].ToString() != "")
                    {
                        model.DetectTime = DateTime.Parse(dt.Rows[n]["DetectTime"].ToString());
                    }
                    if (dt.Rows[n]["HeadPersonnelID"].ToString() != "")
                    {
                        model.HeadPersonnelID = int.Parse(dt.Rows[n]["HeadPersonnelID"].ToString());
                    }
                    model.MainPerson = dt.Rows[n]["MainPerson"].ToString();
                    model.Tel        = dt.Rows[n]["Tel"].ToString();
                    if (dt.Rows[n]["UpdateTime"].ToString() != "")
                    {
                        model.UpdateTime = DateTime.Parse(dt.Rows[n]["UpdateTime"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(E_tb_DetectProject model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_DetectProject(");
            strSql.Append("LaboratoryID,RelationProjectID,TaskNo,ProjectName,DetectTime,HeadPersonnelID,MainPerson,Tel,UpdateTime)");
            strSql.Append(" values (");
            strSql.Append("@LaboratoryID,@RelationProjectID,@TaskNo,@ProjectName,@DetectTime,@HeadPersonnelID,@MainPerson,@Tel,@UpdateTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LaboratoryID",      SqlDbType.Int,        4),
                new SqlParameter("@RelationProjectID", SqlDbType.Int,        4),
                new SqlParameter("@TaskNo",            SqlDbType.NVarChar,  50),
                new SqlParameter("@ProjectName",       SqlDbType.NVarChar,  50),
                new SqlParameter("@DetectTime",        SqlDbType.DateTime),
                new SqlParameter("@HeadPersonnelID",   SqlDbType.Int,        4),
                new SqlParameter("@MainPerson",        SqlDbType.NVarChar,  50),
                new SqlParameter("@Tel",               SqlDbType.NVarChar,  50),
                new SqlParameter("@UpdateTime",        SqlDbType.DateTime)
            };
            parameters[0].Value = model.LaboratoryID;
            parameters[1].Value = model.RelationProjectID;
            parameters[2].Value = model.TaskNo;
            parameters[3].Value = model.ProjectName;
            parameters[4].Value = model.DetectTime;
            parameters[5].Value = model.HeadPersonnelID;
            parameters[6].Value = model.MainPerson;
            parameters[7].Value = model.Tel;
            parameters[8].Value = model.UpdateTime;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 保存实验室信息
        /// 作者:小朱
        /// </summary>
        /// <param name="eDetectProject">要处理的对象</param>
        /// <returns>返回是否处理成功</returns>
        public string Save(E_tb_DetectProject eDetectProject)
        {
            string msg = "0";

            eDetectProject.ProjectName = tProject.GetModel(int.Parse(eDetectProject.RelationProjectID.ToString())).ProjectName; //项目名称
            E_tb_InPersonnel eInPersonnel = tInPersonnel.GetModel(int.Parse(eDetectProject.HeadPersonnelID.ToString()));        //负责人名称

            eDetectProject.MainPerson = eInPersonnel.PersonnelName;                                                             //联系电话
            eDetectProject.Tel        = eInPersonnel.Tel;
            if (eDetectProject.EditType == "Add")
            {
                tDetectProject.Add(eDetectProject);
                msg = "1";
            }
            else
            {
                tDetectProject.Update(eDetectProject);
                msg = "1";
            }
            return(msg);
        }
Esempio n. 7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public E_tb_DetectProject GetModel(int ProjectID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ProjectID,LaboratoryID,RelationProjectID,TaskNo,ProjectName,DetectTime,HeadPersonnelID,MainPerson,Tel,UpdateTime from tb_DetectProject ");
            strSql.Append(" where ProjectID=@ProjectID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProjectID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ProjectID;

            E_tb_DetectProject model = new E_tb_DetectProject();
            DataSet            ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ProjectID"].ToString() != "")
                {
                    model.ProjectID = int.Parse(ds.Tables[0].Rows[0]["ProjectID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["LaboratoryID"].ToString() != "")
                {
                    model.LaboratoryID = int.Parse(ds.Tables[0].Rows[0]["LaboratoryID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RelationProjectID"].ToString() != "")
                {
                    model.RelationProjectID = int.Parse(ds.Tables[0].Rows[0]["RelationProjectID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TaskNo"] != null)
                {
                    model.TaskNo = ds.Tables[0].Rows[0]["TaskNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ProjectName"] != null)
                {
                    model.ProjectName = ds.Tables[0].Rows[0]["ProjectName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["DetectTime"].ToString() != "")
                {
                    model.DetectTime = DateTime.Parse(ds.Tables[0].Rows[0]["DetectTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["HeadPersonnelID"].ToString() != "")
                {
                    model.HeadPersonnelID = int.Parse(ds.Tables[0].Rows[0]["HeadPersonnelID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MainPerson"] != null)
                {
                    model.MainPerson = ds.Tables[0].Rows[0]["MainPerson"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Tel"] != null)
                {
                    model.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["UpdateTime"].ToString() != "")
                {
                    model.UpdateTime = DateTime.Parse(ds.Tables[0].Rows[0]["UpdateTime"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(E_tb_DetectProject model)
 {
     return(dal.Update(model));
 }
Esempio n. 9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(E_tb_DetectProject model)
 {
     return(dal.Add(model));
 }