void setPlan() { try { //原计划; EmpAccount acc = Extend.LoginState.Admin.CurrentUser; //取当前工作记录的上一个记录 Song.Entities.DailyLog pre = Business.Do <IDailyLog>().GetPrevious(Convert.ToDateTime(tbTime.Text.Trim()), rblType.SelectedItem.Text, acc.Acc_Id); //如果不存在 if (pre == null) { divPlan.Visible = false; } else { //如果上一个记录没有填写计划 if (pre.Dlog_Plan.Trim() == "") { divPlan.Visible = false; } else { divPlan.Visible = true; ltPlan.Text = pre.Dlog_Plan.Replace("\n", "<br/>"); } } } catch (Exception ex) { Message.ExceptionShow(ex); } }
void setPlan() { try { // //原计划; //Extend.ManageSession ms = new Song.Extend.ManageSession(); Song.Entities.DailyLog dl = Business.Do <IDailyLog>().GetSingle(id); //取当前工作记录的上一个记录 Song.Entities.DailyLog pre = Business.Do <IDailyLog>().GetPrevious(Convert.ToDateTime(this.ltWrtTime.Text.Trim()), rblType.SelectedItem.Text, (int)dl.Acc_Id); //如果不存在 if (pre == null) { divPlan.Visible = false; } else { //如果上一个记录没有填写计划 if (pre.Dlog_Plan.Trim() == "") { divPlan.Visible = false; } else { divPlan.Visible = true; ltPlan.Text = pre.Dlog_Plan.Replace("\n", "<br/>"); } } } catch (Exception ex) { Message.ExceptionShow(ex); } }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEnter_Click(object sender, EventArgs e) { try { Song.Entities.DailyLog mm; if (id != 0) { mm = Business.Do <IDailyLog>().GetSingle(id); } else { //如果是新增 mm = new Song.Entities.DailyLog(); } //工作记录 mm.Dlog_Note = tbNote.Text; //工作计划 mm.Dlog_Plan = tbPlan.Text; //分类 mm.Dlog_Type = rblType.SelectedItem.Text; //写入时间 mm.Dlog_WrtTime = Convert.ToDateTime(tbTime.Text.Trim()); //所属员工 EmpAccount acc = Extend.LoginState.Admin.CurrentUser; mm.Acc_Id = acc.Acc_Id; mm.Acc_Name = acc.Acc_Name; // //确定操作 if (id == 0) { Business.Do <IDailyLog>().Add(mm); } else { Business.Do <IDailyLog>().Save(mm); } Master.AlertCloseAndRefresh("操作成功!"); } catch (Exception ex) { Message.ExceptionShow(ex); } }
/// <summary> /// 设置初始界面 /// </summary> private void fill() { try { // Song.Entities.DailyLog mm; if (id != 0) { mm = Business.Do <IDailyLog>().GetSingle(id); tbTime.Text = ((DateTime)mm.Dlog_WrtTime).ToString("yyyy-MM-dd"); //类别 ListItem li = rblType.Items.FindByText(mm.Dlog_Type.ToString()); if (li != null) { li.Selected = true; } ltName.Text = mm.Acc_Name; } else { //如果是新增 mm = new Song.Entities.DailyLog(); tbTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); divPlan.Visible = false; EmpAccount acc = Extend.LoginState.Admin.CurrentUser; ltName.Text = acc.Acc_Name; } //工作记录 tbNote.Text = mm.Dlog_Note; //工作计划 tbPlan.Text = mm.Dlog_Plan; //原来的计划 setPlan(); } catch (Exception ex) { Message.ExceptionShow(ex); } }