コード例 #1
0
ファイル: Problem.cs プロジェクト: wccmike/RoadSolution
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public string Add(RoadSolution.Model.Problem model)
        {
            model.ProblemID = GetMaxId().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Problem(");
            strSql.Append("ProblemID,BigClass,SmallClass,Title,AuthorID,Address,Description,ProblemShot,UploadDate,UploadTime,Road,Lat,Lng,IsHandled,IsReviewed,ReviewShot,HandleDate,HandleTime,ReviewDate,ReviewTime");
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append("'" + model.ProblemID + "',");
            strSql.Append("'" + model.BigClass + "',");
            strSql.Append("'" + model.SmallClass + "',");
            strSql.Append("'" + model.Title + "',");
            strSql.Append("'" + model.AuthorID + "',");
            strSql.Append("'" + model.Address + "',");
            strSql.Append("'" + model.Description + "',");
            strSql.Append("'" + model.ProblemShot + "',");
            strSql.Append("'" + model.UploadDate + "',");
            strSql.Append("'" + model.UploadTime + "',");
            strSql.Append("'" + model.Road + "',");
            strSql.Append("" + model.Lat + ",");
            strSql.Append("" + model.Lng + ",");
            strSql.Append("" + model.IsHandled + ",");
            strSql.Append("" + model.IsReviewed + ",");
            strSql.Append("'" + model.ReviewShot + "',");
            strSql.Append("'" + model.HandleDate + "',");
            strSql.Append("'" + model.HandleTime + "',");
            strSql.Append("'" + model.ReviewDate + "',");
            strSql.Append("'" + model.ReviewTime + "'");
            strSql.Append(")");
            DbHelperSQL.ExecuteSql(strSql.ToString());
            return(model.ProblemID);
        }
コード例 #2
0
ファイル: Problem.cs プロジェクト: wccmike/RoadSolution
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(RoadSolution.Model.Problem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Problem set ");
            strSql.Append("BigClass='" + model.BigClass + "',");
            strSql.Append("SmallClass='" + model.SmallClass + "',");
            strSql.Append("Title='" + model.Title + "',");
            strSql.Append("AuthorID='" + model.AuthorID + "',");
            strSql.Append("Address='" + model.Address + "',");
            strSql.Append("Description='" + model.Description + "',");
            strSql.Append("ProblemShot='" + model.ProblemShot + "',");
            strSql.Append("UploadDate='" + model.UploadDate + "',");
            strSql.Append("UploadTime='" + model.UploadTime + "',");
            strSql.Append("Road='" + model.Road + "',");
            strSql.Append("Lat=" + model.Lat + ",");
            strSql.Append("Lng=" + model.Lng + ",");

            string strIsHandled  = model.IsHandled ? "1" : "0";
            string strIsReviewed = model.IsReviewed ? "1" : "0";

            strSql.Append("IsHandled=" + strIsHandled + ",");


            strSql.Append("IsReviewed=" + strIsReviewed + ",");
            strSql.Append("ReviewShot='" + model.ReviewShot + "',");
            //string strHandleTime = model.HandleTime.ToString()=="0001/1/1 0:00:00"? "":model.HandleTime.ToString("yyyy-MM-dd HH-mm-ss.fff") ;
            //string strReviewTime = model.ReviewTime.ToString() == "0001/1/1 0:00:00" ? "" : model.ReviewTime.ToString("yyyy-MM-dd HH-mm-ss.fff");
            if (model.HandleDate != "")
            {
                strSql.Append("HandleDate='" + model.HandleDate + "',");
            }
            if (model.HandleTime.ToString() != "0001/1/1 0:00:00")
            {
                strSql.Append("HandleTime='" + model.HandleTime + "',");
            }
            if (model.ReviewDate != "")
            {
                strSql.Append("ReviewDate='" + model.ReviewDate + "',");
            }
            if (model.ReviewTime.ToString() != "0001/1/1 0:00:00")
            {
                strSql.Append("ReviewTime='" + model.ReviewTime + "',");
            }
            strSql.Remove(strSql.Length - 1, 1);
            strSql.Append(" where ProblemID='" + model.ProblemID + "'");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
コード例 #3
0
        protected void BtnConfirm_Click(object sender, EventArgs e)
        {
            string pid = Request.QueryString["ProblemID"];

            //FupPhoto
            //判断是否有待上船的文件
            if (FupPhoto.HasFile)
            {
                //设置文件保存的路径
                string strPath = Server.MapPath("~/upload/recheckPhoto/") + Guid.NewGuid().ToString("N") + FupPhoto.FileName;
                //
                //保存文件
                FupPhoto.SaveAs(strPath);

                //pid
                RoadSolution.BLL.Problem   problemBll = new RoadSolution.BLL.Problem();
                RoadSolution.Model.Problem problem    = problemBll.GetModel(pid);
                problem.ReviewShot = strPath;
                problemBll.Update(problem);
            }
        }
コード例 #4
0
ファイル: Problem.cs プロジェクト: wccmike/RoadSolution
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(RoadSolution.Model.Problem model)
 {
     dal.Update(model);
 }
コード例 #5
0
ファイル: Problem.cs プロジェクト: wccmike/RoadSolution
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public string Add(RoadSolution.Model.Problem model)
 {
     return(dal.Add(model));
 }
コード例 #6
0
ファイル: Problem.cs プロジェクト: wccmike/RoadSolution
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RoadSolution.Model.Problem GetModel(string ProblemID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from Problem ");
            strSql.Append(" where ProblemID='" + ProblemID + "'");
            RoadSolution.Model.Problem model = new RoadSolution.Model.Problem();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            model.ProblemID = ProblemID;
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.BigClass    = ds.Tables[0].Rows[0]["BigClass"].ToString();
                model.SmallClass  = ds.Tables[0].Rows[0]["SmallClass"].ToString();
                model.Title       = ds.Tables[0].Rows[0]["Title"].ToString();
                model.AuthorID    = ds.Tables[0].Rows[0]["AuthorID"].ToString();
                model.Address     = ds.Tables[0].Rows[0]["Address"].ToString();
                model.Description = ds.Tables[0].Rows[0]["Description"].ToString();
                model.ProblemShot = ds.Tables[0].Rows[0]["ProblemShot"].ToString();
                model.UploadDate  = ds.Tables[0].Rows[0]["UploadDate"].ToString();
                if (ds.Tables[0].Rows[0]["UploadTime"].ToString() != "")
                {
                    model.UploadTime = DateTime.Parse(ds.Tables[0].Rows[0]["UploadTime"].ToString());
                }
                model.Road = ds.Tables[0].Rows[0]["Road"].ToString();
                if (ds.Tables[0].Rows[0]["Lat"].ToString() != "")
                {
                    model.Lat = decimal.Parse(ds.Tables[0].Rows[0]["Lat"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Lng"].ToString() != "")
                {
                    model.Lng = decimal.Parse(ds.Tables[0].Rows[0]["Lng"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsHandled"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["IsHandled"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsHandled"].ToString().ToLower() == "true"))
                    {
                        model.IsHandled = true;
                    }
                    else
                    {
                        model.IsHandled = false;
                    }
                }

                if (ds.Tables[0].Rows[0]["IsReviewed"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["IsReviewed"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsReviewed"].ToString().ToLower() == "true"))
                    {
                        model.IsReviewed = true;
                    }
                    else
                    {
                        model.IsReviewed = false;
                    }
                }

                model.ReviewShot = ds.Tables[0].Rows[0]["ReviewShot"].ToString();
                model.HandleDate = ds.Tables[0].Rows[0]["HandleDate"].ToString();
                if (ds.Tables[0].Rows[0]["HandleTime"].ToString() != "")
                {
                    model.HandleTime = DateTime.Parse(ds.Tables[0].Rows[0]["HandleTime"].ToString());
                }
                model.ReviewDate = ds.Tables[0].Rows[0]["ReviewDate"].ToString();
                if (ds.Tables[0].Rows[0]["ReviewTime"].ToString() != "")
                {
                    model.ReviewTime = DateTime.Parse(ds.Tables[0].Rows[0]["ReviewTime"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }