123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- using LYFZ.Helper;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- using LYFZ.Software.MainBusiness.DoorCityProcess;
- using LYFZ.Model;
- namespace LYFZ.Software.MainBusiness.OAShopManagement
- {
- public partial class frmTeskView : LYFZ.Software.UI.OAShopManagement.frmTeskView
- {
- public frmTeskView()
- {
- this.btnClose.Click += btnClose_Click;
- this.btnSave.Click += btnSave_Click;
- this.btnReply.Click += btnReply_Click;
- this.Load += frmTeskView_Load;
- }
- /// <summary>
- /// 回复
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnReply_Click(object sender, EventArgs e)
- {
- if (this.txtTaskSummary.Text == "")
- {
- MessageBoxCustom.Show("请输入回复!");
- }
- else
- {
- DateTime strTime = SDateTime.Now;
- LYFZ.Model.Model_ErpShopAssignmente model3 = ambll.GetModel(Convert.ToInt32(TeskRow.Cells[0].Value));
- model3.Agt_Revert = this.txtTaskSummary.Text.Trim();
- model3.Agt_UpdateName = strUserID;
- model3.Agt_UpdateDatetime = strTime;
- if (ambll.Update(model3))
- {
- MessageBoxCustom.Show("提交成功");
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- else
- {
- MessageBoxCustom.Show("提交失败");
- }
- }
- }
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- //当前登录者的ID
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- LYFZ.BLL.BLL_ErpShopAssignmente ambll = new BLL.BLL_ErpShopAssignmente();
- LYFZ.BLL.BLL_ErpShopDebriefing ambll1 = new BLL.BLL_ErpShopDebriefing();
- LYFZ.Model.Model_ErpShopAssignmente assigmodel = null;
- void frmTeskView_Load(object sender, EventArgs e)
- {
-
- this.comboBoxCompletionState.Items.Clear();
- this.comboBoxCompletionState.Items.AddRange(Enum.GetNames(typeof(frmTaskAssigned.CompleteStatus)));
- if (this.TeskRow != null)
- {
- assigmodel = ambll.GetModel(Convert.ToInt32(this.TeskRow.Cells[0].Value.ToString()));
- if (assigmodel.ID > 0)
- {
- //任务状态选择
- this.comboBoxCompletionState.SelectedItem =((frmTaskAssigned.CompleteStatus)assigmodel.Agt_CompleteStatus).ToString();// TeskRow.Cells[7].Value.ToString();
- //任务优先级
- this.labPriority.Text = ((frmTaskAssigned.Priority)assigmodel.Agt_Priority).ToString();// TeskRow.Cells["优先级"].Value.ToString();
- //发布时间
- this.labReleaseDatetime.Text = assigmodel.Agt_PublishTime.ToString("yyyy-MM-dd HH:mm:ss");// TeskRow.Cells["发布时间"].Value.ToString();
- //完成期限
- this.labCompletiondate.Text = LYFZ.Command.Command_Validate.DateTimeToString(assigmodel.Agt_Deadlines,"yyyy-MM-dd HH:mm:ss");// TeskRow.Cells["完成期限"].Value.ToString();
- //任务内容
- this.txtTaskInfo.Text = assigmodel.Agt_Content;// TeskRow.Cells["任务内容"].Value.ToString();
- //完成时间
- this.dateTimePickerEx1.DateValue = LYFZ.Command.Command_Validate.DateTimeToString(assigmodel.Agt_CompleteTime, "yyyy-MM-dd HH:mm:ss");// TeskRow.Cells["完成期限"].Value.ToString();
- DataRow dtRow = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable.Rows.Find(assigmodel.Agt_ManageName);
- string Agt_ManageName = "";
- if (dtRow != null)
- {
- Agt_ManageName = dtRow["User_Name"].ToString().Trim();
- }
- //办理人
- this.labTransactor.Text = Agt_ManageName;// TeskRow.Cells["办理人"].Value.ToString();
- dtRow = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable.Rows.Find(assigmodel.Agt_PublishName);
- Agt_ManageName = "";
- if (dtRow != null)
- {
- Agt_ManageName = dtRow["User_Name"].ToString().Trim();
- }
- this.lbTitle.Text = assigmodel.Agt_TaskTopic;
-
- //发布人
- this.labPostedby.Text = Agt_ManageName;// TeskRow.Cells["发布人"].Value.ToString();
- //任务总结
- this.txtTaskSummary.Text = assigmodel.Agt_Summary;// TeskRow.Cells["任务总结"].Value.ToString();
- //发布人回复
- this.txtTaskReply.Text = assigmodel.Agt_Revert;
-
- if (_myTeskType == TeskType.发布人)
- {
- this.comboBoxCompletionState.Enabled = false;
- this.dateTimePickerEx1.Enabled = false;
- this.txtTaskSummary.Enabled = false;
- this.btnSave.Enabled = false;
- this.txtTaskReply.Enabled = true;
- this.btnReply.Enabled = true;
- }
- else
- {
- this.comboBoxCompletionState.Enabled = true;
- this.dateTimePickerEx1.Enabled = true;
- this.txtTaskSummary.Enabled = true;
- this.btnSave.Enabled = true;
- this.txtTaskReply.Enabled = false;
- this.btnReply.Enabled = false;
- }
- }
- }
- }
- /// <summary>
- /// 保存更新
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- if (comboBoxCompletionState.Text == "")
- {
- MessageBoxCustom.Show("请选择任务状态");
- }
- else
- {
- frmTaskAssigned.CompleteStatus cStatus = (frmTaskAssigned.CompleteStatus)Enum.Parse(typeof(frmTaskAssigned.CompleteStatus), this.comboBoxCompletionState.SelectedItem.ToString());
- DateTime strTime = SDateTime.Now;
- List<Helper.CommandInfo> clist = new List<CommandInfo>();
- LYFZ.Model.Model_ErpShopAssignmente model = ambll.GetModel(Convert.ToInt32(TeskRow.Cells[0].Value));
- model.Agt_CompleteStatus = Convert.ToInt32(cStatus);
- model.Agt_CompleteTime = Convert.ToDateTime(this.labReleaseDatetime.Text.Trim());
- model.Agt_Summary = this.txtTaskSummary.Text.Trim();
- model.Agt_UpdateName = strUserID;
- model.Agt_UpdateDatetime = strTime;
- clist.Add(ambll.GetUpdateCommandInfo(model));
- LYFZ.Model.Model_ErpShopDebriefing mode2 = new Model.Model_ErpShopDebriefing();
- mode2.Rpt_CompleteState = Convert.ToInt32(cStatus);
- mode2.Rpt_Summary = this.txtTaskSummary.Text.Trim();
- mode2.Rpt_UpdateName = strUserID;
- mode2.Rpt_CreateDatetime = strTime;
- mode2.fuID = model.ID;
- clist.Add(ambll1.GetAddCommandInfo(mode2));
- if (clist.Count > 0)
- {
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
- {
-
- MessageBoxCustom.Show("保存成功");
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- else { MessageBoxCustom.Show("保存失败"); }
- }
- }
- }
- catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
- }
- void btnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- DataGridViewRow _teskRow = null;
- public DataGridViewRow TeskRow
- {
- get { return _teskRow; }
- set { _teskRow = value; }
- }
- TeskType _myTeskType = TeskType.办理人;
- internal TeskType MyTeskType
- {
- get { return _myTeskType; }
- set { _myTeskType = value; }
- }
-
- }
- /// <summary>
- /// 任务关系类型 是发布人还是办理人
- /// </summary>
- enum TeskType
- {
- 发布人,
- 办理人
- }
- }
|