/// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEnter_Click(object sender, EventArgs e)
        {
            try
            {
                Song.Entities.Task mm = Business.Do <ITask>().GetSingle(id);
                //任务名称
                mm.Task_Name = tbName.Text.Trim();
                //任务内容
                mm.Task_Context = tbContext.Text.Trim();
                //任务等级
                mm.Task_Level = Convert.ToInt16(ddlLevel.SelectedItem.Text);
                //计划开始时间,计划结束时间,实际结束时间
                mm.Task_StartTime = Convert.ToDateTime(tbStart.Text);
                mm.Task_EndTime   = Convert.ToDateTime(tbEnd.Text);
                if (tbComplete.Text.Trim() != "")
                {
                    mm.Task_CompleteTime = Convert.ToDateTime(tbComplete.Text);
                }
                //所属员工
                EmpAccount acc = Extend.LoginState.Admin.CurrentUser;
                mm.Acc_Id   = acc.Acc_Id;
                mm.Acc_Name = acc.Acc_Name;
                //指派给谁
                mm.Task_WorkerId = Convert.ToInt32(ddlEmployee.SelectedValue);
                //是否使用
                mm.Task_IsUse = !cbIsUse.Checked;
                //是否完成
                mm.Task_IsComplete = cbIsComplete.Checked;
                //完成度
                if (tbCompletePer.Text.Trim() != "")
                {
                    int per = Convert.ToInt16(tbCompletePer.Text);
                    per = per < 0 ? 0 : per;
                    mm.Task_CompletePer = per > 100 ? per : per;
                }
                else
                {
                    mm.Task_CompletePer = 0;
                }
                //设置没有退回
                mm.Task_IsGoback = false;
                //
                //确定操作
                Business.Do <ITask>().Save(mm);

                Master.AlertCloseAndRefresh("操作成功!");
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
        }
示例#2
0
        /// <summary>
        /// 设置初始界面
        /// </summary>
        private void fill()
        {
            try
            {
                //
                Song.Entities.Task mm;
                if (id != 0)
                {
                    mm = Business.Do <ITask>().GetSingle(id);
                    //优先级
                    ListItem li = ddlLevel.Items.FindByText(mm.Task_Level.ToString());
                    if (li != null)
                    {
                        li.Selected = true;
                    }
                    tbStart.Text = ((DateTime)mm.Task_StartTime).ToString("yyyy-MM-dd");
                    tbEnd.Text   = ((DateTime)mm.Task_EndTime).ToString("yyyy-MM-dd");
                    //是否完成
                    cbIsComplete.Checked = mm.Task_IsComplete;
                    if (mm.Task_IsComplete)
                    {
                        tbComplete.Text = ((DateTime)mm.Task_CompleteTime).ToString("yyyy-MM-dd");
                    }
                    //设置指派给谁
                    setDepart((int)mm.Task_WorkerId);
                }
                else
                {
                    //如果是新增
                    mm            = new Song.Entities.Task();
                    tbStart.Text  = DateTime.Now.ToString("yyyy-MM-dd");
                    tbEnd.Text    = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd");
                    mm.Task_IsUse = true;
                }
                //任务名称
                tbName.Text = mm.Task_Name;
                //任务内容
                tbContext.Text = mm.Task_Context;
                //是否使用
                cbIsUse.Checked = !mm.Task_IsUse;
                //完成度
                tbCompletePer.Text = mm.Task_CompletePer.ToString();

                //完成时间所在的区域
                divCompleteBox.Visible = mm.Task_IsComplete;
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
        }
        /// <summary>
        /// 设置初始界面
        /// </summary>
        private void fill()
        {
            try
            {
                if (id < 1)
                {
                    return;
                }
                Song.Entities.Task mm = Business.Do <ITask>().GetSingle(id);
                //优先级
                ListItem li = ddlLevel.Items.FindByText(mm.Task_Level.ToString());
                if (li != null)
                {
                    li.Selected = true;
                }
                tbStart.Text = ((DateTime)mm.Task_StartTime).ToString("yyyy-MM-dd");
                tbEnd.Text   = ((DateTime)mm.Task_EndTime).ToString("yyyy-MM-dd");
                //是否完成
                cbIsComplete.Checked = mm.Task_IsComplete;
                if (mm.Task_IsComplete)
                {
                    tbComplete.Text = ((DateTime)mm.Task_CompleteTime).ToString("yyyy-MM-dd");
                }
                //设置指派给谁
                setDepart((int)mm.Task_WorkerId);
                //任务名称
                tbName.Text = mm.Task_Name;
                //任务内容
                tbContext.Text = mm.Task_Context;
                //是否使用
                cbIsUse.Checked = !mm.Task_IsUse;
                //完成度
                tbCompletePer.Text = mm.Task_CompletePer.ToString();
                //完成时间所在的区域
                divCompleteBox.Visible = mm.Task_IsComplete;

                //工作记录
                tbWorkLog.Text = mm.Task_WorkLog;
                //退回的原因
                tbGoBackText.Text = mm.Task_GobackText;
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
        }
 /// <summary>
 /// 确定退回任务
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnGoBackEnter_Click(object sender, EventArgs e)
 {
     try
     {
         if (id < 1)
         {
             return;
         }
         Song.Entities.Task mm = Business.Do <ITask>().GetSingle(id);
         //退回
         mm.Task_IsGoback = true;
         //退回的原因
         mm.Task_GobackText = tbGoBackText.Text;
         Business.Do <ITask>().Save(mm);
         Master.AlertCloseAndRefresh("操作成功!");
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
示例#5
0
 /// <summary>
 /// 是否完成任务的复选框
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void cbIsComplete_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         CheckBox cb = (CheckBox)sender;
         divCompleteBox.Visible = cb.Checked;
         if (cb.Checked)
         {
             tbComplete.Text    = DateTime.Now.ToString("yyyy-MM-dd");
             tbCompletePer.Text = "100";
         }
         else
         {
             Song.Entities.Task mm = Business.Do <ITask>().GetSingle(id);
             tbCompletePer.Text = mm.Task_CompletePer.ToString();
         }
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
示例#6
0
        public bool RemoveDown(int id)
        {
            //当前对象
            Song.Entities.Task current = this.GetSingle(id);
            //当前对象排序号
            int orderValue = (int)current.Task_Tax; 
            //下一个对象,即弟弟对象;
            Song.Entities.Task down = Gateway.Default.From<Task>().Where(Task._.Task_Tax <orderValue && Task._.Task_Level == current.Task_Level).OrderBy(Task._.Task_Tax.Desc).ToFirst<Task>();
            if (down == null)
            {
                //如果弟对象不存在,则表示当前节点在兄弟中是老幺;即是最底端;
                return false;
            }
            //交换排序号
            current.Task_Tax = down.Task_Tax;
            down.Task_Tax = orderValue;
            using (DbTrans tran = Gateway.Default.BeginTrans())
            {
                try
                {
                    tran.Save<Task>(current);
                    tran.Save<Task>(down);
                    tran.Commit();
                    return true;
                }
                catch
                {
                    tran.Rollback();
                    throw;

                }
                finally
                {
                    tran.Close();
                }
            }
            
        }
示例#7
0
        public bool RemoveUp(int id)
        {
            Song.Entities.Task current = this.GetSingle(id);
            //当前对象排序号
            int orderValue = (int)current.Task_Tax; 
            //上一个对象,即兄长对象;存在当前优先级
            Song.Entities.Task up = Gateway.Default.From<Task>().Where(Task._.Task_Tax > orderValue && Task._.Task_Level == current.Task_Level).OrderBy(Task._.Task_Tax.Asc).ToFirst<Task>();
            if (up == null)
            {
                //如果兄长对象不存在,则表示当前节点在兄弟中是老大;即是最顶点;
                return false;
            }
            //交换排序号
            current.Task_Tax = up.Task_Tax;
            up.Task_Tax = orderValue;
            using (DbTrans tran = Gateway.Default.BeginTrans())
            {
                try
                {
                    tran.Save<Task>(current);
                    tran.Save<Task>(up);
                    tran.Commit();
                    return true;
                }
                catch
                {
                    tran.Rollback();
                    throw;

                }
                finally
                {
                    tran.Close();
                }
               
            }
        }
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEnter_Click(object sender, EventArgs e)
 {
     try
     {
         if (id < 1)
         {
             return;
         }
         Song.Entities.Task mm = Business.Do <ITask>().GetSingle(id);
         //工作记录
         mm.Task_WorkLog = tbWorkLog.Text;
         //完成度
         //完成度
         if (tbCompletePer.Text.Trim() != "")
         {
             int per = Convert.ToInt16(tbCompletePer.Text);
             per = per < 0 ? 0 : per;
             mm.Task_CompletePer = per > 100 ? per : per;
             if (mm.Task_CompletePer >= 100)
             {
                 mm.Task_IsComplete   = true;
                 mm.Task_CompleteTime = DateTime.Now;
             }
         }
         else
         {
             mm.Task_CompletePer = 0;
         }
         Business.Do <ITask>().Save(mm);
         Master.AlertCloseAndRefresh("操作成功!");
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }