Beispiel #1
0
        void Up()
        {
            DataTable table = com.GetList("uid = " + UserId + " and Workprogress in(2,5,6)").Tables[0];

            JumbotOA.Entity.TaskEntity model = new JumbotOA.Entity.TaskEntity();
            foreach (DataRow dr in table.Rows)
            {
                if (Convert.ToInt32(dr["Workprogress"].ToString()) == 2)
                {
                    DateTime now = Convert.ToDateTime(DateTime.Now.ToString("yyyy-M-d HH:mm:ss"));
                    if (now <= Convert.ToDateTime(dr["Plantime"].ToString()))
                    {
                        int i = JumbotOA.BLL.TaskBLL.timespans(Convert.ToDateTime(dr["Nowtime"].ToString()), now);
                        model.Progresstime = i;
                    }
                    else
                    {
                        continue;
                    }
                }
                else
                {   //提前完成或提交已完成
                    model.Progresstime = Convert.ToInt32(dr["sumtime"].ToString());
                }
                model.Tlid     = Convert.ToInt32(dr["Tlid"].ToString());
                model.Worktime = Convert.ToDateTime(dr["Worktime"].ToString());
                model.Nowtime  = Convert.ToDateTime(dr["Nowtime"].ToString());
                model.Plantime = Convert.ToDateTime(dr["Plantime"].ToString());
                model.Newnote  = dr["newnote"].ToString();
                com.Update(model);
            }
        }
 //判断是否是发布任务的本人
 void MyValidate()
 {
     JumbotOA.Entity.TaskEntity taskEntity = new JumbotOA.Entity.TaskEntity();
     taskEntity = new JumbotOA.BLL.TaskBLL().GetEntity(Str2Int(q("id")));
     if (UserName != taskEntity.Manager)
     {
         FinalMessage("该任务你无权修改", "", 1);
     }
 }
 //信息绑定
 void Bind()
 {
     JumbotOA.Entity.TaskEntity model = new JumbotOA.Entity.TaskEntity();
     model = new BLL.TaskBLL().GetEntity(Str2Int(q("id")));
     if (model.Ttype == "锁定")
     {
         Response.Redirect("Locked.aspx");
     }
     JumbotOA.Entity.UserEntity userEntity = new JumbotOA.Entity.UserEntity();
     userEntity                   = new BLL.UserBLL().GetEntity(model.Uid);
     this.txtBegintime.Text       = model.Nowtime.ToString();
     this.txtEndtime.Text         = model.Plantime.ToString();
     this.txtTitle.Text           = model.Tasktitle;
     this.ddlWorker.SelectedValue = userEntity.Uid.ToString();
     txt.Text                   = model.Content;
     questext.Text              = model.Question;
     this.ddlWorker.Enabled     = false;
     this.classse.SelectedValue = model.Classse;
 }
Beispiel #4
0
 void showlist()
 {
     if (txtid.Text.Trim() != "")
     {
         qs.Visible = true;
         JumbotOA.Entity.TaskEntity model = new JumbotOA.Entity.TaskEntity();
         int id = Convert.ToInt32(txtid.Text.Trim());
         model = new BLL.TaskBLL().GetEntity(id);
         if (id == 4 || id == 8)
         {
             Workprogress.SelectedValue = model.Workprogress.ToString();
         }
         this.txtBegintime.Text = model.Nowtime.ToString();
         this.txtEndtime.Text   = model.Plantime.ToString();
         this.txtTitle.Text     = model.Tasktitle.ToString();
         JumbotOA.Entity.UserEntity userEntity = new JumbotOA.Entity.UserEntity();
         userEntity  = new BLL.UserBLL().GetEntity(model.Uid);
         Uidtxt.Text = userEntity.Uname.ToString();
     }
     else
     {
         qs.Visible = false;
     }
 }
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void lbDel_Click(object sender, CommandEventArgs e)
 {
     User_Load("task-del");
     JumbotOA.Entity.TaskEntity taskEntity = new JumbotOA.Entity.TaskEntity();
     taskEntity = new JumbotOA.BLL.TaskBLL().GetEntity(Convert.ToInt32(e.CommandArgument));
     if (UserName == taskEntity.Manager)
     {
         if (taskEntity.Ttype == "锁定")
         {
             System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
             page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script language='javascript'>alert('该任务已锁定!');</script>");
         }
         else
         {
             new JumbotOA.BLL.TaskBLL().Delete(Convert.ToInt32(e.CommandArgument));
             Selectinfo(wherestr);
         }
     }
     else
     {
         System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
         page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script language='javascript'>alert('该任务你无权修改!');</script>");
     }
 }
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void lbDel_Click(object sender, CommandEventArgs e)
 {
     User_Load("task-del");
     JumbotOA.Entity.TaskEntity taskEntity = new JumbotOA.Entity.TaskEntity();
     taskEntity = new JumbotOA.BLL.TaskBLL().GetEntity(Convert.ToInt32(e.CommandArgument));
     if (UserName == taskEntity.Manager)
     {
         if (taskEntity.Ttype == "锁定")
         {
             System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
             page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script language='javascript'>alert('该任务已锁定!');</script>");
         }
         else
         {
             new JumbotOA.BLL.TaskBLL().Delete(Convert.ToInt32(e.CommandArgument));
             Selectinfo(wherestr);
         }
     }
     else
     {
         System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
         page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script language='javascript'>alert('该任务你无权修改!');</script>");
     }
 }
Beispiel #7
0
 protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
 {
     JumbotOA.Entity.TaskEntity taskEntity = new JumbotOA.Entity.TaskEntity();
     if (this.ddlWorker.SelectedValue.ToString() != "")
     {
         DateTime begin = Convert.ToDateTime(this.txtBegintime.Text);
         DateTime end   = Convert.ToDateTime(this.txtEndtime.Text);
         if (begin < end)
         {
             //可以添加
             taskEntity.Content      = txt.Text.Trim();
             taskEntity.Manager      = UserName;
             taskEntity.Nowtime      = Convert.ToDateTime(this.txtBegintime.Text);
             taskEntity.Plantime     = Convert.ToDateTime(this.txtEndtime.Text);
             taskEntity.Tasktitle    = this.txtTitle.Text;
             taskEntity.Worktime     = Convert.ToDateTime(this.txtEndtime.Text);
             taskEntity.Workprogress = 1;
             taskEntity.Ttype        = "未锁定";
             taskEntity.Sumtime      = JumbotOA.BLL.TaskBLL.timespans(taskEntity.Nowtime, taskEntity.Plantime);
             taskEntity.Progresstime = 0;
             taskEntity.Classse      = classse.SelectedValue.ToString();
             DataTable dt = sql.Select(Convert.ToInt32(getvalue(1)), 0);
             foreach (DataRow dr in dt.Rows)
             {
                 taskEntity.Filepath += dr["names"] + ",";
             }
             taskEntity.Question = questext.Text;
             int i = 0;
             for (int c = 0; c < ddlWorker.Items.Count; c++)
             {
                 if (ddlWorker.Items[c].Selected)
                 {
                     taskEntity.Uid = Convert.ToInt32(ddlWorker.Items[c].Value.ToString());
                     string ToUid = "," + taskEntity.Uid + ",";
                     i = new JumbotOA.BLL.TaskBLL().Add(taskEntity);
                     JumbotOA.BLL.OA_SysMessageIn.ADDsysMessage(4, ToUid, "新的工作任务" + taskEntity.Tasktitle, JumbotOA.Utils.Strings.Left(JumbotOA.Utils.Strings.delhtml(txt.Text.ToString()), 53), "My_Work_Show.aspx?id=" + i.ToString());
                 }
             }
             if (i > 0)
             {
                 // JumbotOA.Utils.QQRobotHelp.SendClusterMessage();
                 sql.Up(Convert.ToInt32(getvalue(1)), i);
                 FinalMessage("任务添加成功", "Task_List.aspx", 0);
             }
             else
             {
                 FinalMessage("任务添加失败", "Task_List.aspx", 0);
             }
         }
         else
         {
             System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
             page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script language='javascript'>alert('任务开始时间必须大于计划结束时间!');</script>");
         }
     }
     else
     {
         System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
         page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script language='javascript'>alert('请选择员工!');</script>");
     }
 }
Beispiel #8
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(JumbotOA.Entity.TaskEntity model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            strSql1.Append("Uid,");
            strSql2.Append("" + model.Uid + ",");
            if (model.Manager != null)
            {
                strSql1.Append("Manager,");
                strSql2.Append("'" + model.Manager + "',");
            }
            if (model.Tasktitle != null)
            {
                strSql1.Append("Tasktitle,");
                strSql2.Append("'" + model.Tasktitle + "',");
            }
            if (model.Content != null)
            {
                strSql1.Append("Content,");
                strSql2.Append("'" + model.Content + "',");
            }
            if (model.Nowtime != null)
            {
                strSql1.Append("Nowtime,");
                strSql2.Append("'" + model.Nowtime + "',");
            }
            if (model.Plantime != null)
            {
                strSql1.Append("Plantime,");
                strSql2.Append("'" + model.Plantime + "',");
            }
            if (model.Ttype != null)
            {
                strSql1.Append("Ttype,");
                strSql2.Append("'" + model.Ttype + "',");
            }
            if (model.Worktime != null)
            {
                strSql1.Append("Worktime,");
                strSql2.Append("'" + model.Worktime + "',");
            }
            if (model.Workprogress != 0)
            {
                strSql1.Append("Workprogress,");
                strSql2.Append("'" + model.Workprogress + "',");
            }
            if (model.Sumtime != 0)
            {
                strSql1.Append("sumtime,");
                strSql2.Append("'" + model.Sumtime + "',");
            }
            if (model.Progresstime != 0)
            {
                strSql1.Append("progresstime,");
                strSql2.Append("'" + model.Progresstime + "',");
            }

            if (model.Classse != null)
            {
                strSql1.Append("classse,");
                strSql2.Append("'" + model.Classse + "',");
            }
            if (model.Remark != null)
            {
                strSql1.Append("remark,");
                strSql2.Append("'" + model.Remark + "',");
            }
            if (model.Newnote != null)
            {
                strSql1.Append("newnote,");
                strSql2.Append("'" + model.Newnote + "',");
            }
            if (model.Filepath != null)
            {
                strSql1.Append("filepath,");
                strSql2.Append("'" + model.Filepath + "',");
            }
            if (model.Question != null)
            {
                strSql1.Append("question,");
                strSql2.Append("'" + model.Question + "',");
            }
            strSql.Append("insert into [OA_Task](");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(")");
            strSql.Append(";select @@IDENTITY");
            object obj = DbHelperSQL.GetSingle(strSql.ToString());

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Beispiel #9
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JumbotOA.Entity.TaskEntity GetEntity(int Tlid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" *,(case when (Workprogress= 1) then '新的任务' when (Workprogress= 2) then '正在办理' when (Workprogress= 3) then '已经完成' when (Workprogress= 4) then '验收未完成' when (Workprogress= 5) then '提前完成' when (Workprogress= 6) then '按时完成' when (Workprogress= 7) then '未完成' when (Workprogress= 8) then '重新申请时间' when (Workprogress= 9) then '拒收' end) as Workstate ");
            strSql.Append(" from [OA_Task] ");
            strSql.Append(" where Tlid=" + Tlid + " ");
            JumbotOA.Entity.TaskEntity model = new JumbotOA.Entity.TaskEntity();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Tlid"].ToString() != "")
                {
                    model.Tlid = int.Parse(ds.Tables[0].Rows[0]["Tlid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Uid"].ToString() != "")
                {
                    model.Uid = int.Parse(ds.Tables[0].Rows[0]["Uid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Manager"].ToString() != "")
                {
                    model.Manager = ds.Tables[0].Rows[0]["Manager"].ToString();
                }
                model.Tasktitle = ds.Tables[0].Rows[0]["Tasktitle"].ToString();
                model.Content   = ds.Tables[0].Rows[0]["Content"].ToString();
                if (ds.Tables[0].Rows[0]["Nowtime"].ToString() != "")
                {
                    model.Nowtime = DateTime.Parse(ds.Tables[0].Rows[0]["Nowtime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Plantime"].ToString() != "")
                {
                    model.Plantime = DateTime.Parse(ds.Tables[0].Rows[0]["Plantime"].ToString());
                }
                model.Ttype = ds.Tables[0].Rows[0]["Ttype"].ToString();
                if (ds.Tables[0].Rows[0]["Worktime"].ToString() != "")
                {
                    model.Worktime = DateTime.Parse(ds.Tables[0].Rows[0]["Worktime"].ToString());
                }
                model.Workprogress = int.Parse(ds.Tables[0].Rows[0]["Workprogress"].ToString());
                model.Workstate    = ds.Tables[0].Rows[0]["Workstate"].ToString();
                if (ds.Tables[0].Rows[0]["sumtime"].ToString() != "")
                {
                    model.Sumtime = int.Parse(ds.Tables[0].Rows[0]["sumtime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["progresstime"].ToString() != "")
                {
                    model.Progresstime = int.Parse(ds.Tables[0].Rows[0]["progresstime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["classse"].ToString() != "")
                {
                    model.Classse = ds.Tables[0].Rows[0]["classse"].ToString();
                }
                if (ds.Tables[0].Rows[0]["remark"].ToString() != "")
                {
                    model.Remark = ds.Tables[0].Rows[0]["remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["newnote"].ToString() != "")
                {
                    model.Newnote = ds.Tables[0].Rows[0]["newnote"].ToString();
                }
                if (ds.Tables[0].Rows[0]["filepath"].ToString() != "")
                {
                    model.Filepath = ds.Tables[0].Rows[0]["filepath"].ToString();
                }
                if (ds.Tables[0].Rows[0]["question"].ToString() != "")
                {
                    model.Question = ds.Tables[0].Rows[0]["question"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #10
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(JumbotOA.Entity.TaskEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [OA_Task] set ");
            if (model.Uid != 0)
            {
                strSql.Append("Uid=" + model.Uid + ",");
            }
            if (model.Manager != null)
            {
                strSql.Append("Manager='" + model.Manager + "',");
            }
            if (model.Tasktitle != null)
            {
                strSql.Append("Tasktitle='" + model.Tasktitle + "',");
            }
            if (model.Content != null)
            {
                strSql.Append("Content='" + model.Content + "',");
            }
            if (model.Nowtime != null)
            {
                strSql.Append("Nowtime='" + model.Nowtime + "',");
            }
            if (model.Plantime != null)
            {
                strSql.Append("Plantime='" + model.Plantime + "',");
            }
            if (model.Ttype != null)
            {
                strSql.Append("Ttype='" + model.Ttype + "',");
            }
            if (model.Worktime != null)
            {
                strSql.Append("Worktime='" + model.Worktime + "',");
            }
            if (model.Workprogress != 0)
            {
                strSql.Append("Workprogress='" + model.Workprogress + "',");
            }
            if (model.Sumtime != 0)
            {
                strSql.Append("sumtime='" + model.Sumtime + "',");
            }
            if (model.Progresstime != 0)
            {
                strSql.Append("progresstime='" + model.Progresstime + "',");
            }
            if (model.Classse != null)
            {
                strSql.Append("classse='" + model.Classse + "',");
            }
            if (model.Remark != null)
            {
                strSql.Append("remark='" + model.Remark + "',");
            }
            if (model.Question != null)
            {
                strSql.Append("question='" + model.Question + "',");
            }
            strSql.Append("newnote='" + model.Newnote + "'");

            strSql.Append(" where Tlid=" + model.Tlid);
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
 //判断是否是发布任务的本人
 void MyValidate()
 {
     JumbotOA.Entity.TaskEntity taskEntity = new JumbotOA.Entity.TaskEntity();
     taskEntity = new JumbotOA.BLL.TaskBLL().GetEntity(Str2Int(q("id")));
     if (UserName != taskEntity.Manager)
     {
         FinalMessage("该任务你无权修改", "", 1);
     }
 }
        //信息绑定
        void Bind()
        {
            JumbotOA.Entity.TaskEntity model = new JumbotOA.Entity.TaskEntity();
            model = new BLL.TaskBLL().GetEntity(Str2Int(q("id")));
            if (model.Ttype == "锁定")
            {
                Response.Redirect("Locked.aspx");

            }
            JumbotOA.Entity.UserEntity userEntity = new JumbotOA.Entity.UserEntity();
            userEntity = new BLL.UserBLL().GetEntity(model.Uid);
            this.txtBegintime.Text = model.Nowtime.ToString();
            this.txtEndtime.Text = model.Plantime.ToString();
            this.txtTitle.Text = model.Tasktitle;
            this.ddlWorker.SelectedValue = userEntity.Uid.ToString();
            txt.Text = model.Content;
            questext.Text = model.Question;
            this.ddlWorker.Enabled = false;
            this.classse.SelectedValue = model.Classse;
        }
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            JumbotOA.Entity.TaskEntity taskEntity = new JumbotOA.Entity.TaskEntity();
            if (this.ddlWorker.SelectedValue.ToString()!="")
            {

                DateTime begin = Convert.ToDateTime(this.txtBegintime.Text);
                DateTime end = Convert.ToDateTime(this.txtEndtime.Text);
                if (begin < end)
                {
                        //可以添加
                        taskEntity.Content = txt.Text.Trim();
                        taskEntity.Manager = UserName;
                        taskEntity.Nowtime = Convert.ToDateTime(this.txtBegintime.Text);
                        taskEntity.Plantime = Convert.ToDateTime(this.txtEndtime.Text);
                        taskEntity.Tasktitle = this.txtTitle.Text;
                        taskEntity.Worktime = Convert.ToDateTime(this.txtEndtime.Text);
                        taskEntity.Workprogress = 1;
                        taskEntity.Ttype = "未锁定";
                        taskEntity.Sumtime = JumbotOA.BLL.TaskBLL.timespans(taskEntity.Nowtime,taskEntity.Plantime);
                        taskEntity.Progresstime = 0;
                        taskEntity.Classse = classse.SelectedValue.ToString();
                    DataTable dt=sql.Select(Convert.ToInt32(getvalue(1)),0);
                    foreach(DataRow dr in dt.Rows)
                    {
                        taskEntity.Filepath += dr["names"] + ",";
                    }
                    taskEntity.Question=questext.Text;
                        int i = 0;
                    for (int c = 0; c < ddlWorker.Items.Count; c++)
                        {
                            if (ddlWorker.Items[c].Selected)
                            {
                              taskEntity.Uid = Convert.ToInt32(ddlWorker.Items[c].Value.ToString());
                              string ToUid = "," + taskEntity.Uid + ",";
                              i = new JumbotOA.BLL.TaskBLL().Add(taskEntity);
                              JumbotOA.BLL.OA_SysMessageIn.ADDsysMessage(4, ToUid, "新的工作任务" + taskEntity.Tasktitle, JumbotOA.Utils.Strings.Left(JumbotOA.Utils.Strings.delhtml(txt.Text.ToString()), 53), "My_Work_Show.aspx?id=" + i.ToString());

                            }
                        }
                        if (i > 0)
                        {
                           // JumbotOA.Utils.QQRobotHelp.SendClusterMessage();
                            sql.Up(Convert.ToInt32(getvalue(1)),i);
                            FinalMessage("任务添加成功", "Task_List.aspx", 0);
                        }
                        else
                        {
                            FinalMessage("任务添加失败", "Task_List.aspx", 0);
                        }

                }
                else
                {
                    System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
                    page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script language='javascript'>alert('任务开始时间必须大于计划结束时间!');</script>");
                }
            }
            else
            {
                System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
                page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script language='javascript'>alert('请选择员工!');</script>");
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public JumbotOA.Entity.TaskEntity GetEntity(int Tlid)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select  top 1  ");
     strSql.Append(" *,(case when (Workprogress= 1) then '新的任务' when (Workprogress= 2) then '正在办理' when (Workprogress= 3) then '已经完成' when (Workprogress= 4) then '验收未完成' when (Workprogress= 5) then '提前完成' when (Workprogress= 6) then '按时完成' when (Workprogress= 7) then '未完成' when (Workprogress= 8) then '重新申请时间' when (Workprogress= 9) then '拒收' end) as Workstate ");
     strSql.Append(" from [OA_Task] ");
     strSql.Append(" where Tlid=" + Tlid + " ");
     JumbotOA.Entity.TaskEntity model = new JumbotOA.Entity.TaskEntity();
     DataSet ds = DbHelperSQL.Query(strSql.ToString());
     if (ds.Tables[0].Rows.Count > 0)
     {
         if (ds.Tables[0].Rows[0]["Tlid"].ToString() != "")
         {
             model.Tlid = int.Parse(ds.Tables[0].Rows[0]["Tlid"].ToString());
         }
         if (ds.Tables[0].Rows[0]["Uid"].ToString() != "")
         {
             model.Uid = int.Parse(ds.Tables[0].Rows[0]["Uid"].ToString());
         }
         if (ds.Tables[0].Rows[0]["Manager"].ToString() != "")
         {
             model.Manager = ds.Tables[0].Rows[0]["Manager"].ToString();
         }
         model.Tasktitle = ds.Tables[0].Rows[0]["Tasktitle"].ToString();
         model.Content = ds.Tables[0].Rows[0]["Content"].ToString();
         if (ds.Tables[0].Rows[0]["Nowtime"].ToString() != "")
         {
             model.Nowtime = DateTime.Parse(ds.Tables[0].Rows[0]["Nowtime"].ToString());
         }
         if (ds.Tables[0].Rows[0]["Plantime"].ToString() != "")
         {
             model.Plantime = DateTime.Parse(ds.Tables[0].Rows[0]["Plantime"].ToString());
         }
         model.Ttype = ds.Tables[0].Rows[0]["Ttype"].ToString();
         if (ds.Tables[0].Rows[0]["Worktime"].ToString() != "")
         {
             model.Worktime = DateTime.Parse(ds.Tables[0].Rows[0]["Worktime"].ToString());
         }
         model.Workprogress = int.Parse(ds.Tables[0].Rows[0]["Workprogress"].ToString());
         model.Workstate = ds.Tables[0].Rows[0]["Workstate"].ToString();
         if (ds.Tables[0].Rows[0]["sumtime"].ToString() != "")
         {
             model.Sumtime = int.Parse(ds.Tables[0].Rows[0]["sumtime"].ToString());
         }
         if (ds.Tables[0].Rows[0]["progresstime"].ToString()!="")
         {
             model.Progresstime = int.Parse(ds.Tables[0].Rows[0]["progresstime"].ToString());
         }
         if (ds.Tables[0].Rows[0]["classse"].ToString() != "")
         {
             model.Classse = ds.Tables[0].Rows[0]["classse"].ToString();
         }
         if (ds.Tables[0].Rows[0]["remark"].ToString() != "")
         {
             model.Remark = ds.Tables[0].Rows[0]["remark"].ToString();
         }
         if (ds.Tables[0].Rows[0]["newnote"].ToString() != "")
         {
             model.Newnote = ds.Tables[0].Rows[0]["newnote"].ToString();
         }
         if (ds.Tables[0].Rows[0]["filepath"].ToString() != "")
         {
             model.Filepath = ds.Tables[0].Rows[0]["filepath"].ToString();
         }
         if (ds.Tables[0].Rows[0]["question"].ToString() != "")
         {
             model.Question = ds.Tables[0].Rows[0]["question"].ToString();
         }
         return model;
     }
     else
     {
         return null;
     }
 }
 void showlist()
 {
     if (txtid.Text.Trim() != "")
     {
         qs.Visible = true;
         JumbotOA.Entity.TaskEntity model = new JumbotOA.Entity.TaskEntity();
         int id = Convert.ToInt32(txtid.Text.Trim());
         model = new BLL.TaskBLL().GetEntity(id);
         if (id == 4 || id == 8)
         { Workprogress.SelectedValue = model.Workprogress.ToString(); }
         this.txtBegintime.Text = model.Nowtime.ToString();
         this.txtEndtime.Text = model.Plantime.ToString();
         this.txtTitle.Text = model.Tasktitle.ToString();
         JumbotOA.Entity.UserEntity userEntity = new JumbotOA.Entity.UserEntity();
         userEntity = new BLL.UserBLL().GetEntity(model.Uid);
         Uidtxt.Text = userEntity.Uname.ToString();
     }
     else
         qs.Visible = false;
 }
 void Up()
 {
     DataTable table =com.GetList("uid = " + UserId + " and Workprogress in(2,5,6)").Tables[0];
     JumbotOA.Entity.TaskEntity model = new JumbotOA.Entity.TaskEntity();
     foreach( DataRow dr in table.Rows)
     {
         if (Convert.ToInt32(dr["Workprogress"].ToString()) == 2)
         {
             DateTime now=Convert.ToDateTime(DateTime.Now.ToString("yyyy-M-d HH:mm:ss"));
             if (now <= Convert.ToDateTime(dr["Plantime"].ToString()))
             {
                 int i = JumbotOA.BLL.TaskBLL.timespans(Convert.ToDateTime(dr["Nowtime"].ToString()), now);
                 model.Progresstime = i;
             }
             else
                 continue;
         }
         else
         {   //提前完成或提交已完成
           model.Progresstime = Convert.ToInt32(dr["sumtime"].ToString());
         }
         model.Tlid =Convert.ToInt32(dr["Tlid"].ToString());
         model.Worktime =Convert.ToDateTime( dr["Worktime"].ToString());
         model.Nowtime =Convert.ToDateTime( dr["Nowtime"].ToString());
         model.Plantime =Convert.ToDateTime( dr["Plantime"].ToString());
         model.Newnote = dr["newnote"].ToString();
         com.Update(model);
     }
 }