123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- 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 System.Web.UI.WebControls;
- namespace LYFZ.Software.MainBusiness.OAShopManagement
- {
- public class frmReleaseTask : LYFZ.Software.UI.OAShopManagement.frmReleaseTask
- {
- LYFZ.BLL.BLL_ErpShopAssignmente ambll = new BLL.BLL_ErpShopAssignmente();
- //当前登录者的ID
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- public frmReleaseTask()
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.comboBoxTreeViewEx1);
- this.btnClose.Click += btnClose_Click;
- this.btnUpdate.Click += btnUpdate_Click;
- this.Load += frmReleaseTask_Load;
- }
- /// <summary>
- /// 更改数据
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnUpdate_Click(object sender, EventArgs e)
- {
- if (this.txtTitle.Text.Trim().Length <= 0)
- {
- MessageBoxCustom.Show("请输入任务主题");
- return;
- }
- if (this.txtTitle.Text.Trim().Length >100)
- {
- MessageBoxCustom.Show("入任务主题不能超过100个字");
- return;
- }
- if (this.comboBoxType.Text.Trim().Length <= 0)
- {
- MessageBoxCustom.Show("选择任务优先级");
- return;
- }
- if (this.dateTimePickerEx1.DateValue.Trim().Length <= 0)
- {
- MessageBoxCustom.Show("输入任务完成期限");
- return;
- }
- if (this.comboBoxTreeViewEx1.Text.Trim().Length <= 0 || this.txtInfo.Text.Trim().Length <= 0)
- {
- MessageBoxCustom.Show("请选择办理人和输入任务内容!");
- return;
- }
- else
- {
- LYFZ.Model.Model_ErpShopAssignmente model = null;
- if (TaskRow != null)
- {
- model = ambll.GetModel(Convert.ToInt32(TaskRow.Cells["ID"].Value));
- }
- else {
- model = new Model.Model_ErpShopAssignmente();
- }
- model.Agt_ID = LYFZ.WinAPI.CustomPublicMethod.GenerateId();
- model.Agt_CompleteStatus = 0;
- model.Agt_Priority = (int)(frmTaskAssigned.Priority)Enum.Parse(typeof(frmTaskAssigned.Priority), this.comboBoxType.SelectedItem.ToString());
- model.Agt_PublishName = strUserID;
- model.Agt_PublishTime = SDateTime.Now;
- model.Agt_ManageName = this.comboBoxTreeViewEx1.Tag.ToString().Trim();
- model.Agt_Content = this.txtInfo.Text.Trim();
- model.Agt_Deadlines = Convert.ToDateTime(this.dateTimePickerEx1.DateValue.Trim());
- model.Agt_TaskTopic = this.txtTitle.Text.Trim();
- model.Agt_CreateName = strUserID;
- bool saveOk = false;
- if (model.ID > 0)
- {
- model.Agt_UpdateDatetime = SDateTime.Now;
- saveOk = ambll.Update(model);
- }
- else {
- model.Agt_CreateDatetime = SDateTime.Now;
- saveOk = ambll.Add(model);
- }
- if (saveOk)
- {
- System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(TaskAssignedPushMessage), model);
- MessageBoxCustom.Show("操作成功");
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- else
- {
- MessageBoxCustom.Show("操作失败");
- }
- }
- }
- /// <summary>
- /// 发布时推送消息
- /// </summary>
- void TaskAssignedPushMessage(object b)
- {
- try
- {
- if (b != null)
- {
- LYFZ.Model.Model_ErpShopAssignmente eModel = (LYFZ.Model.Model_ErpShopAssignmente)b;
- ambll.TaskAssignedPushMessage(eModel);
- }
- }
- catch { }
- }
- /// <summary>
- /// 窗体加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void frmReleaseTask_Load(object sender, EventArgs e)
- {
- this.comboBoxType.Items.Clear();
- this.comboBoxType.Items.AddRange(Enum.GetNames(typeof(frmTaskAssigned.Priority)));
- if (_TaskRow != null)
- {
- this.txtTitle.Text = _TaskRow.Cells[1].Value.ToString();
- this.comboBoxType.SelectedItem = _TaskRow.Cells[3].Value.ToString();//LYFZ.Software.MainBusiness.DoorCityProcess.ListItem.TextFindByValue(this.comboBoxType, _TaskRow.Cells[3].Value.ToString());
- this.dateTimePickerEx1.DateValue = _TaskRow.Cells[7].Value.ToString();
- this.comboBoxTreeViewEx1.Tag = _TaskRow.Cells[6].Tag;
- this.comboBoxTreeViewEx1.TextFindTag(_TaskRow.Cells[6].Value.ToString());
- this.txtInfo.Text = _TaskRow.Cells[2].Value.ToString();
- this.btnUpdate.Visible = true;
- }
- }
- DataGridViewRow _TaskRow = null;
- /// <summary>
- /// 当前任务DataGridViewRow数据
- /// </summary>
- public DataGridViewRow TaskRow
- {
- get { return _TaskRow; }
- set { _TaskRow = value; }
- }
- void btnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
-
- }
- }
|