Exemplo n.º 1
0
        private void PatrolAdd(Entity.BASE_PATROL model)
        {
            decimal Pid      = Convert.ToDecimal(bll.GetMaxID());                                                           //获取最新添加的巡逻日志编号
            string  sqlwhere = "1=1 and PID=" + Pid + " and to_char(BEGINTIME,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')"; //查询当前巡逻日志下是否有巡查处理情况

            if (handlingbll.GetList(sqlwhere).Rows.Count > 0)
            {
                Entity.BASE_HANDLING handlingmodel = GetHandlingEntity(Pid, 3);
                handlingbll.Add(handlingmodel);//添加巡查处理情况

                if (this.divShift.Style.Value == "block")
                {
                    bll.update(model);
                }
            }
            else
            {
                int a = bll.Add(model);//添加人工巡逻日志
                if (a > 0)
                {
                    decimal newPid = Convert.ToDecimal(bll.GetMaxID()); //获取最新添加的巡逻日志编号
                    Entity.BASE_HANDLING handlingmodel = GetHandlingEntity(newPid, 3);
                    handlingbll.Add(handlingmodel);                     //添加巡查处理情况
                }
                else
                {
                    //提示添加巡逻日志失败
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Entity.BASE_HANDLING entity)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into BASE_HANDLING(");
            strSql.Append("HID,PATROLTYPE,BEGINTIME,ENDTIME,TIMES,CONTENT,REMARK,PID");
            strSql.Append(") values (");
            strSql.Append(":HID,:PATROLTYPE,:BEGINTIME,:ENDTIME,:TIMES,:CONTENT,:REMARK,:PID");
            strSql.Append(") ");

            OracleParameter[] parameters =
            {
                new OracleParameter(":HID",        OracleType.Number,      4),
                new OracleParameter(":PATROLTYPE", OracleType.VarChar,    20),
                new OracleParameter(":BEGINTIME",  OracleType.DateTime),
                new OracleParameter(":ENDTIME",    OracleType.DateTime),
                new OracleParameter(":TIMES",      OracleType.Number,      4),
                new OracleParameter(":CONTENT",    OracleType.VarChar,   200),
                new OracleParameter(":REMARK",     OracleType.VarChar,   200),
                new OracleParameter(":PID",        OracleType.Number, 4)
            };

            parameters[0].Value = entity.HID;
            parameters[1].Value = entity.PATROLTYPE;
            parameters[2].Value = entity.BEGINTIME;
            parameters[3].Value = entity.ENDTIME;
            parameters[4].Value = entity.TIMES;
            parameters[5].Value = entity.CONTENT;
            parameters[6].Value = entity.REMARK;
            parameters[7].Value = entity.PID;
            return(OracleHelper.ExecuteNonQuery(strSql.ToString(), parameters));
        }
Exemplo n.º 3
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool update(Entity.BASE_HANDLING model)
 {
     if (dal.Update(model))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Entity.BASE_HANDLING GetEntity(decimal HID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select HID, PATROLTYPE, BEGINTIME, ENDTIME, TIMES, CONTENT, REMARK, PID  ");
            strSql.Append("  from BASE_HANDLING ");
            strSql.Append(" where HID=:HID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":HID", OracleType.Number, 4)
            };
            parameters[0].Value = HID;


            Entity.BASE_HANDLING entity = new Entity.BASE_HANDLING();
            DataTable            dt     = OracleHelper.Query(CommandType.Text, strSql.ToString(), parameters);

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["HID"].ToString() != "")
                {
                    entity.HID = decimal.Parse(dt.Rows[0]["HID"].ToString());
                }
                entity.PATROLTYPE = dt.Rows[0]["PATROLTYPE"].ToString();
                if (dt.Rows[0]["BEGINTIME"].ToString() != "")
                {
                    entity.BEGINTIME = DateTime.Parse(dt.Rows[0]["BEGINTIME"].ToString());
                }
                if (dt.Rows[0]["ENDTIME"].ToString() != "")
                {
                    entity.ENDTIME = DateTime.Parse(dt.Rows[0]["ENDTIME"].ToString());
                }
                if (dt.Rows[0]["TIMES"].ToString() != "")
                {
                    entity.TIMES = decimal.Parse(dt.Rows[0]["TIMES"].ToString());
                }
                entity.CONTENT = dt.Rows[0]["CONTENT"].ToString();
                entity.REMARK  = dt.Rows[0]["REMARK"].ToString();
                if (dt.Rows[0]["PID"].ToString() != "")
                {
                    entity.PID = decimal.Parse(dt.Rows[0]["PID"].ToString());
                }

                return(entity);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
        private void SetHandlingEntity(Entity.BASE_HANDLING model)
        {
            TextBox tb1 = (TextBox)this.Handling1.FindControl("txtBEGINTIME");

            tb1.Text = model.BEGINTIME.ToString("yyyy-MM-dd hh:mm:ss");//开始时间
            TextBox tb2 = (TextBox)this.Handling1.FindControl("txtENDTIME");

            tb2.Text = model.ENDTIME.ToString("yyyy-MM-dd hh:mm:ss");//结束时间
            TextBox txtLog = (TextBox)this.Handling1.FindControl("txtLog");

            txtLog.Text = model.CONTENT;//处理情况内容;
            TextBox txtRemark = (TextBox)this.Handling1.FindControl("txtRemark");

            txtRemark.Text = model.REMARK;//备注
        }
Exemplo n.º 6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Entity.BASE_HANDLING entity)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BASE_HANDLING set ");

            strSql.Append(" HID = :HID , ");
            strSql.Append(" PATROLTYPE = :PATROLTYPE , ");
            strSql.Append(" BEGINTIME = :BEGINTIME , ");
            strSql.Append(" ENDTIME = :ENDTIME , ");
            strSql.Append(" TIMES = :TIMES , ");
            strSql.Append(" CONTENT = :CONTENT , ");
            strSql.Append(" REMARK = :REMARK , ");
            strSql.Append(" PID = :PID  ");
            strSql.Append(" where HID=:HID  ");

            OracleParameter[] parameters =
            {
                new OracleParameter(":HID",        OracleType.Number,      4),
                new OracleParameter(":PATROLTYPE", OracleType.VarChar,    20),
                new OracleParameter(":BEGINTIME",  OracleType.DateTime),
                new OracleParameter(":ENDTIME",    OracleType.DateTime),
                new OracleParameter(":TIMES",      OracleType.Number,      4),
                new OracleParameter(":CONTENT",    OracleType.VarChar,   200),
                new OracleParameter(":REMARK",     OracleType.VarChar,   200),
                new OracleParameter(":PID",        OracleType.Number, 4)
            };

            parameters[0].Value = entity.HID;
            parameters[1].Value = entity.PATROLTYPE;
            parameters[2].Value = entity.BEGINTIME;
            parameters[3].Value = entity.ENDTIME;
            parameters[4].Value = entity.TIMES;
            parameters[5].Value = entity.CONTENT;
            parameters[6].Value = entity.REMARK;
            parameters[7].Value = entity.PID;
            int rows = OracleHelper.ExecuteNonQuery(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取处理情况实体数据
        /// </summary>
        /// <param name="pid">巡逻日志编号</param>
        /// <param name="times">巡逻次数</param>
        /// <returns></returns>
        private Entity.BASE_HANDLING GetHandlingEntity(decimal pid, decimal times)
        {
            Entity.BASE_HANDLING model = new Entity.BASE_HANDLING();
            model.HID        = -1;     //主键,巡查处理情况编号
            model.PATROLTYPE = "人工巡逻"; //巡逻类型;
            model.TIMES      = times;  //巡逻次数;
            TextBox tb1 = (TextBox)this.Handling1.FindControl("txtBEGINTIME");

            model.BEGINTIME = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + tb1.Text);//开始时间
            TextBox tb2 = (TextBox)this.Handling1.FindControl("txtENDTIME");

            model.ENDTIME = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + tb2.Text);//结束时间
            TextBox txtLog = (TextBox)this.Handling1.FindControl("txtLog");

            model.CONTENT = txtLog.Text;//处理情况内容;
            model.PID     = pid;
            TextBox txtRemark = (TextBox)this.Handling1.FindControl("txtRemark");

            model.REMARK = txtRemark.Text;//备注
            return(model);
        }
Exemplo n.º 8
0
 /// <summary>
 /// 添加巡查处理情况
 /// </summary>
 /// <param name="model">巡查处理情况实体</param>
 public int Add(Entity.BASE_HANDLING model)
 {
     return(dal.Add(model));
 }