AddMinTeamSmallForm..cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace LYFZ.Software.MainBusiness.MarketingAllPerson.SetSmallForm
  10. {
  11. public partial class AddMinTeamSmallForm : LYFZ.Software.UI.MarketingAllPerson.SetSmallForm.AddMinTeamSmallForm
  12. {
  13. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  14. LYFZ.BLL.BLL_ErpTeamMinTaskSet tstsbll = new BLL.BLL_ErpTeamMinTaskSet();
  15. public AddMinTeamSmallForm()
  16. {
  17. this.Load += AddMinTeamSmallForm_Load;
  18. this.Shown += AddMinTeamSmallForm_Shown;
  19. this.cmbtreevActivityName.ComboBoxTree_NodeMouseClick += cmbtreevActivityName_ComboBoxTree_NodeMouseClick;
  20. this.cmbtreevMaxTeamName.ComboBoxTree_NodeMouseClick += cmbtreevMaxTeamName_ComboBoxTree_NodeMouseClick;
  21. this.btnActivityNameSet.Click += btnActivityNameSet_Click;
  22. this.btnMaxTeamNameSet.Click += btnMaxTeamNameSet_Click;
  23. this.btnMinTeamNameSet.Click += btnMinTeamNameSet_Click;
  24. this.btnNew.Click += btnNew_Click;
  25. this.btnSaveed.Click += btnSaveed_Click;
  26. this.btnDelete.Click += btnDelete_Click;
  27. this.btnClose.Click += btnClose_Click;
  28. this.dgvData.CellMouseClick += dgvData_CellMouseClick;
  29. this.txtBaodiTask.KeyPress += txtBaodiTask_KeyPress;
  30. this.txtTargetTask.KeyPress += txtTargetTask_KeyPress;
  31. this.txtSprintTask.KeyPress += txtSprintTask_KeyPress;
  32. }
  33. /// <summary>
  34. /// 是否保存
  35. /// </summary>
  36. public bool IsSaveed = false;
  37. /// <summary>
  38. /// 窗体加载事件
  39. /// </summary>
  40. /// <param name="sender"></param>
  41. /// <param name="e"></param>
  42. void AddMinTeamSmallForm_Load(object sender, EventArgs e)
  43. {
  44. this.GetTeamMinTask();
  45. }
  46. /// <summary>
  47. /// 窗体加载事件
  48. /// </summary>
  49. /// <param name="sender"></param>
  50. /// <param name="e"></param>
  51. void AddMinTeamSmallForm_Shown(object sender, EventArgs e)
  52. {
  53. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamActivityName(this.cmbtreevActivityName);
  54. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamMinName(this.cmbtreevMinTeamName);
  55. }
  56. /// <summary>
  57. /// 获取小组名称列表
  58. /// </summary>
  59. /// <param name="StrActivityNumber"></param>
  60. void GetTeamMinTask(string StrActivityNumber = "", string StrMaxTeamNumber = "")
  61. {
  62. if (!string.IsNullOrEmpty(StrActivityNumber))
  63. { StrActivityNumber = "Tmit_TasNumber = '" + StrActivityNumber + "'"; }
  64. if (!string.IsNullOrEmpty(StrActivityNumber) && !string.IsNullOrEmpty(StrMaxTeamNumber))
  65. { StrActivityNumber += " And Tmit_TmxnNumber = '" + StrMaxTeamNumber + "'"; }
  66. else if (!string.IsNullOrEmpty(StrMaxTeamNumber))
  67. { StrActivityNumber = "Tmit_TmxnNumber = '" + StrMaxTeamNumber + "'"; }
  68. string StrTableName = "tb_ErpTeamMinTaskSet Left Join tb_ErpTeamActiveSet on Tas_Number = Tmit_TasNumber Left Join tb_ErpTeamMaxNameSet on Tmxn_Number = Tmit_TmxnNumber Left Join tb_ErpTeamMinNameSet on Tmin_Number = Tmit_TminNumber";
  69. string StrColumnName = "tb_ErpTeamMinTaskSet.ID,Tmit_TasNumber AS 活动名称编号,Tmit_TmxnNumber AS 大队名称编号,Tmit_TminNumber AS 小组名称编号,Tas_Name AS 活动名称,Tmxn_Name AS 大队名称,Tmin_Name AS 小组名称,Tmit_BaodiTask AS 保底任务,Tmit_TargetTask AS 目标任务,Tmit_SprintTask AS 冲刺任务";
  70. DataTable dt = orbll.GetView_Custom(StrTableName, StrWhere: StrActivityNumber, ShowColumnName: StrColumnName, filedOrder: "tb_ErpTeamMinTaskSet.ID DESC").Tables[0];
  71. this.dgvData.DataSource(dt, strHideField: "ID,活动名称编号,大队名称编号,小组名称编号");
  72. this.dgvData.FillLastColumn(true);
  73. }
  74. /// <summary>
  75. /// 获取大队任务
  76. /// </summary>
  77. void GetMaxTeamTask()
  78. {
  79. this.lblMinTeamBaodiTask.Text = "0";
  80. this.lblMinTeamTargetTask.Text = "0";
  81. this.lblMinTeamSprintTask.Text = "0";
  82. this.lblAssignBaodiTask.Text = "0";
  83. this.lblAssignTargetTask.Text = "0";
  84. this.lblAssignSprintTask.Text = "0";
  85. if (!string.IsNullOrEmpty(this.cmbtreevActivityName.Text.Trim()) && this.cmbtreevActivityName.Tag != null && !string.IsNullOrEmpty(this.cmbtreevActivityName.Tag.ToString().Trim())
  86. && !string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Text.Trim()) && this.cmbtreevMaxTeamName.Tag != null && !string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Tag.ToString().Trim()))
  87. {
  88. DataTable dt = orbll.GetView_Custom("tb_ErpTeamMaxTaskSet", StrWhere: "Tmxt_TasNumber = '" + this.cmbtreevActivityName.Tag.ToString().Trim() + "' And Tmxt_TmxnNumber = '" + this.cmbtreevMaxTeamName.Tag.ToString().Trim() + "'", ShowColumnName: "Tmxt_BaodiTask,Tmxt_TargetTask,Tmxt_SprintTask").Tables[0];
  89. DataTable dt2 = orbll.GetView_Custom("tb_ErpTeamMinTaskSet", StrWhere: "Tmit_TasNumber = '" + this.cmbtreevActivityName.Tag.ToString().Trim() + "' And Tmit_TmxnNumber = '" + this.cmbtreevMaxTeamName.Tag.ToString().Trim() + "'", ShowColumnName: "Sum(Tmit_BaodiTask) AS Tmit_BaodiTask,Sum(Tmit_TargetTask) AS Tmit_TargetTask,Sum(Tmit_SprintTask) AS Tmit_SprintTask", GroupBy: "Tmit_TasNumber,Tmit_TmxnNumber").Tables[0];
  90. if (dt.Rows.Count > 0)
  91. {
  92. this.lblMinTeamBaodiTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dt.Rows[0]["Tmxt_BaodiTask"].ToString().Trim());
  93. this.lblMinTeamTargetTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dt.Rows[0]["Tmxt_TargetTask"].ToString().Trim());
  94. this.lblMinTeamSprintTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dt.Rows[0]["Tmxt_SprintTask"].ToString().Trim());
  95. }
  96. if (dt2.Rows.Count > 0)
  97. {
  98. this.lblAssignBaodiTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dt2.Rows[0]["Tmit_BaodiTask"].ToString().Trim());
  99. this.lblAssignTargetTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dt2.Rows[0]["Tmit_TargetTask"].ToString().Trim());
  100. this.lblAssignSprintTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dt2.Rows[0]["Tmit_SprintTask"].ToString().Trim());
  101. }
  102. }
  103. }
  104. /// <summary>
  105. /// 活动名称选择加载大队
  106. /// </summary>
  107. /// <param name="sender"></param>
  108. /// <param name="e"></param>
  109. void cmbtreevActivityName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  110. {
  111. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamMaxTaskName(this.cmbtreevMaxTeamName, this.cmbtreevActivityName.Tag.ToString().Trim());
  112. this.GetTeamMinTask(this.cmbtreevActivityName.Tag.ToString().Trim());
  113. this.GetMaxTeamTask();
  114. }
  115. /// <summary>
  116. /// 大队名称选择加载小组
  117. /// </summary>
  118. /// <param name="sender"></param>
  119. /// <param name="e"></param>
  120. void cmbtreevMaxTeamName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  121. {
  122. if (!string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Text.Trim()) && this.cmbtreevMaxTeamName.Tag != null && !string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Tag.ToString().Trim()))
  123. { this.GetTeamMinTask(this.cmbtreevActivityName.Tag.ToString().Trim(), this.cmbtreevMaxTeamName.Tag.ToString().Trim()); }
  124. this.GetMaxTeamTask();
  125. }
  126. /// <summary>
  127. /// 活动设置
  128. /// </summary>
  129. /// <param name="sender"></param>
  130. /// <param name="e"></param>
  131. void btnActivityNameSet_Click(object sender, EventArgs e)
  132. {
  133. LYFZ.Software.MainBusiness.MarketingAllPerson.SetSmallForm.AddNewActiveSmallForm frm = new AddNewActiveSmallForm();
  134. frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  135. frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  136. frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  137. frm.ShowDialog();
  138. if (frm.IsSaveed)
  139. {
  140. this.cmbtreevActivityName.SetTextAndTag_ValueNull();
  141. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamActivityName(this.cmbtreevActivityName);
  142. }
  143. }
  144. /// <summary>
  145. /// 大队设置
  146. /// </summary>
  147. /// <param name="sender"></param>
  148. /// <param name="e"></param>
  149. void btnMaxTeamNameSet_Click(object sender, EventArgs e)
  150. {
  151. LYFZ.Software.MainBusiness.MarketingAllPerson.SetSmallForm.AddMaxTeamSmallForm frm = new AddMaxTeamSmallForm();
  152. frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  153. frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  154. frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  155. frm.ShowDialog();
  156. if (frm.IsSaveed)
  157. {
  158. this.cmbtreevMaxTeamName.SetTextAndTag_ValueNull();
  159. if (string.IsNullOrEmpty(this.cmbtreevActivityName.Text.Trim()))
  160. { this.cmbtreevMaxTeamName.Nodes.Clear(); }
  161. else
  162. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamMaxTaskName(this.cmbtreevMaxTeamName, this.cmbtreevActivityName.Tag.ToString().Trim()); }
  163. }
  164. }
  165. /// <summary>
  166. /// 小组设置
  167. /// </summary>
  168. /// <param name="sender"></param>
  169. /// <param name="e"></param>
  170. void btnMinTeamNameSet_Click(object sender, EventArgs e)
  171. {
  172. LYFZ.Software.MainBusiness.MarketingAllPerson.SuperSmallForm.MinTeamNameSetSuperSmallForm frm = new SuperSmallForm.MinTeamNameSetSuperSmallForm();
  173. frm.ShowDialog();
  174. if (frm.IsSaveed)
  175. {
  176. this.cmbtreevMinTeamName.SetTextAndTag_ValueNull();
  177. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamMinName(this.cmbtreevMinTeamName);
  178. }
  179. }
  180. /// <summary>
  181. /// 新建
  182. /// </summary>
  183. /// <param name="sender"></param>
  184. /// <param name="e"></param>
  185. void btnNew_Click(object sender, EventArgs e)
  186. {
  187. this.IntClickID = 0;
  188. this.cmbtreevActivityName.SetTextAndTag_ValueNull();
  189. this.cmbtreevMaxTeamName.SetTextAndTag_ValueNull();
  190. this.cmbtreevMinTeamName.SetTextAndTag_ValueNull();
  191. this.cmbtreevMaxTeamName.Nodes.Clear();
  192. this.txtBaodiTask.Text = "";
  193. this.txtTargetTask.Text = "";
  194. this.txtSprintTask.Text = "";
  195. this.btnSaveed.Text = " 保 存";
  196. }
  197. /// <summary>
  198. /// 保存
  199. /// </summary>
  200. /// <param name="sender"></param>
  201. /// <param name="e"></param>
  202. void btnSaveed_Click(object sender, EventArgs e)
  203. {
  204. if (this.cmbtreevActivityName.Tag == null)
  205. { MessageBoxCustom.Show("活动名称不能为空!"); return; }
  206. if (this.cmbtreevMaxTeamName.Tag == null)
  207. { MessageBoxCustom.Show("大队名称不能为空!"); return; }
  208. if (this.cmbtreevMinTeamName.Tag == null)
  209. { MessageBoxCustom.Show("小组名称不能为空!"); return; }
  210. if (string.IsNullOrEmpty(this.txtBaodiTask.Text.Trim()))
  211. { MessageBoxCustom.Show("保底任务不能为空!"); return; }
  212. if (string.IsNullOrEmpty(this.txtTargetTask.Text.Trim()))
  213. { MessageBoxCustom.Show("目标任务不能为空!"); return; }
  214. if (string.IsNullOrEmpty(this.txtSprintTask.Text.Trim()))
  215. { MessageBoxCustom.Show("冲刺任务不能为空!"); return; }
  216. if (Convert.ToDecimal(this.txtBaodiTask.Text.Trim()) > Convert.ToDecimal(this.txtTargetTask.Text.Trim()))
  217. { MessageBoxCustom.Show("目标任务不能小于保底任务!"); return; }
  218. if (Convert.ToDecimal(this.txtTargetTask.Text.Trim()) > Convert.ToDecimal(this.txtSprintTask.Text.Trim()))
  219. { MessageBoxCustom.Show("冲刺任务不能小于目标任务!"); return; }
  220. DateTime StrTime = SDateTime.Now;
  221. string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  222. LYFZ.Model.Model_ErpTeamMinTaskSet model = null;
  223. if (this.IntClickID <= 0)
  224. {
  225. DataTable dt = orbll.GetView_Custom("tb_ErpTeamMinTaskSet", StrWhere: "Tmit_TasNumber = '" + this.cmbtreevActivityName.Tag.ToString().Trim() + "' And Tmit_TmxtNumber = '" + this.cmbtreevMaxTeamName.Tag.ToString().Trim() + "' And Tmit_TminNumber = '" + this.cmbtreevMinTeamName.Tag.ToString().Trim() + "'", ShowColumnName: "ID").Tables[0];
  226. if (dt.Rows.Count > 0)
  227. {
  228. if (dt.Rows.Count > 1)
  229. { MessageBoxCustom.Show("数据结构混乱,无法操作!"); return; }
  230. this.IntClickID = Convert.ToInt32(dt.Rows[0]["ID"]);
  231. }
  232. }
  233. if (this.IntClickID <= 0)
  234. {
  235. if ((Convert.ToDecimal(this.txtBaodiTask.Text.Trim()) + Convert.ToDecimal(this.lblAssignBaodiTask.Text.Trim())) > Convert.ToDecimal(this.lblMinTeamBaodiTask.Text.Trim()))
  236. { MessageBoxCustom.Show("大队的所有小组总保底任务不能大于大队保底任务!"); return; }
  237. if ((Convert.ToDecimal(this.txtTargetTask.Text.Trim()) + Convert.ToDecimal(this.lblAssignTargetTask.Text.Trim())) > Convert.ToDecimal(this.lblMinTeamTargetTask.Text.Trim()))
  238. { MessageBoxCustom.Show("大队的所有小组总目标任务不能大于大队目标任务!"); return; }
  239. if ((Convert.ToDecimal(this.txtSprintTask.Text.Trim()) + Convert.ToDecimal(this.lblAssignSprintTask.Text.Trim())) > Convert.ToDecimal(this.lblMinTeamSprintTask.Text.Trim()))
  240. { MessageBoxCustom.Show("大队的所有小组总冲刺任务不能大于大队冲刺任务!"); return; }
  241. model = new Model.Model_ErpTeamMinTaskSet();
  242. model.Tmit_Number = "MIT_" + LYFZ.WinAPI.CustomPublicMethod.GenerateId().ToString().Trim();
  243. model.Tmit_TasNumber = this.cmbtreevActivityName.Tag.ToString().Trim();
  244. model.Tmit_TmxnNumber = this.cmbtreevMaxTeamName.Tag.ToString().Trim();
  245. model.Tmit_TmxtNumber = this.cmbtreevMaxTeamName.StrGetName.Trim();
  246. model.Tmit_TminNumber = this.cmbtreevMinTeamName.Tag.ToString().Trim();
  247. model.Tmit_BaodiTask = Convert.ToDecimal(this.txtBaodiTask.Text.Trim());
  248. model.Tmit_TargetTask = Convert.ToDecimal(this.txtTargetTask.Text.Trim());
  249. model.Tmit_SprintTask = Convert.ToDecimal(this.txtSprintTask.Text.Trim());
  250. model.Tmit_CreateDateTime = StrTime;
  251. model.Tmit_CreateName = StrUserID;
  252. if (MessageBoxCustom.Show("您确定要保存吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  253. { return; }
  254. if (tstsbll.Add(model))
  255. {
  256. this.IsSaveed = true;
  257. MessageBoxCustom.Show("添加成功!");
  258. this.btnNew_Click(this, null);
  259. }
  260. else
  261. { MessageBoxCustom.Show("添加失败!"); return; }
  262. }
  263. else
  264. {
  265. decimal deBaodiTask = Convert.ToDecimal(this.txtBaodiTask.Text.Trim());
  266. decimal deTargetTask = Convert.ToDecimal(this.txtTargetTask.Text.Trim());
  267. decimal deSprintTask = Convert.ToDecimal(this.txtSprintTask.Text.Trim());
  268. string StrTableName = "Sum(Tmit_BaodiTask) AS Tmit_BaodiTask,Sum(Tmit_TargetTask) AS Tmit_TargetTask,Sum(Tmit_SprintTask) AS Tmit_SprintTask";
  269. string StrWhere = "Tmit_TasNumber = '" + this.cmbtreevActivityName.Tag.ToString().Trim() + "' And Tmit_TmxnNumber = '" + this.cmbtreevMaxTeamName.Tag.ToString().Trim() + "' And ID != '" + this.IntClickID + "'";
  270. DataTable dt = orbll.GetView_Custom("tb_ErpTeamMinTaskSet", StrWhere: StrWhere, ShowColumnName: StrTableName, GroupBy: "Tmit_TasNumber,Tmit_TmxnNumber").Tables[0];
  271. if (dt.Rows.Count > 0)
  272. {
  273. deBaodiTask += Convert.ToDecimal(dt.Rows[0]["Tmit_BaodiTask"]);
  274. deTargetTask += Convert.ToDecimal(dt.Rows[0]["Tmit_TargetTask"]);
  275. deSprintTask += Convert.ToDecimal(dt.Rows[0]["Tmit_SprintTask"]);
  276. }
  277. if (deBaodiTask > Convert.ToDecimal(this.lblMinTeamBaodiTask.Text.Trim()))
  278. { MessageBoxCustom.Show("大队的所有小组总保底任务不能大于大队保底任务!"); return; }
  279. if (deTargetTask > Convert.ToDecimal(this.lblMinTeamTargetTask.Text.Trim()))
  280. { MessageBoxCustom.Show("大队的所有小组总目标任务不能大于大队目标任务!"); return; }
  281. if (deSprintTask > Convert.ToDecimal(this.lblMinTeamSprintTask.Text.Trim()))
  282. { MessageBoxCustom.Show("大队的所有小组总冲刺任务不能大于大队冲刺任务!"); return; }
  283. model = tstsbll.GetModel(this.IntClickID);
  284. model.Tmit_BaodiTask = Convert.ToDecimal(this.txtBaodiTask.Text.Trim());
  285. model.Tmit_TargetTask = Convert.ToDecimal(this.txtTargetTask.Text.Trim());
  286. model.Tmit_SprintTask = Convert.ToDecimal(this.txtSprintTask.Text.Trim());
  287. model.Tmit_UpdateDateTime = StrTime;
  288. model.Tmit_UpdateName = StrUserID;
  289. if (MessageBoxCustom.Show("您确定要修改吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  290. { return; }
  291. if (tstsbll.Update(model))
  292. {
  293. this.IsSaveed = true;
  294. MessageBoxCustom.Show("修改成功!");
  295. }
  296. else
  297. { MessageBoxCustom.Show("修改失败!"); return; }
  298. }
  299. this.AddMinTeamSmallForm_Load(this, null);
  300. this.GetMaxTeamTask();
  301. }
  302. /// <summary>
  303. /// 删除
  304. /// </summary>
  305. /// <param name="sender"></param>
  306. /// <param name="e"></param>
  307. void btnDelete_Click(object sender, EventArgs e)
  308. {
  309. if (this.IntClickID > 0)
  310. {
  311. DataTable dt = orbll.GetView_Custom("tb_ErpTeamMinTaskSet", StrWhere: "ID = '" + this.IntClickID + "'", ShowColumnName: "Tmit_TminNumber").Tables[0];
  312. if (dt.Rows.Count > 0)
  313. {
  314. dt = orbll.GetView_Custom("tb_ErpTeamPersonSet", StrWhere: "Tps_TmitNumber = '" + dt.Rows[0]["Tmit_TminNumber"].ToString().Trim() + "'", ShowColumnName: "ID").Tables[0];
  315. if (dt.Rows.Count > 0)
  316. { MessageBoxCustom.Show("此小组名称已设置了组成员,不能删除!"); return; }
  317. }
  318. if (MessageBoxCustom.Show("您确定要删除吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  319. {
  320. if (tstsbll.Delete(this.IntClickID))
  321. {
  322. this.IsSaveed = true;
  323. MessageBoxCustom.Show("删除成功!");
  324. this.btnNew_Click(this, null);
  325. }
  326. else
  327. { MessageBoxCustom.Show("删除失败!"); }
  328. }
  329. }
  330. else
  331. { MessageBoxCustom.Show("请选择你要删除的小组!"); }
  332. }
  333. /// <summary>
  334. /// 关闭
  335. /// </summary>
  336. /// <param name="sender"></param>
  337. /// <param name="e"></param>
  338. void btnClose_Click(object sender, EventArgs e)
  339. {
  340. this.Close();
  341. }
  342. int IntClickID = 0;
  343. /// <summary>
  344. /// 列表点击事件
  345. /// </summary>
  346. /// <param name="sender"></param>
  347. /// <param name="e"></param>
  348. void dgvData_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  349. {
  350. if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
  351. {
  352. if (this.dgvData.Rows.Count > 0)
  353. {
  354. this.IntClickID = Convert.ToInt32(this.dgvData.Rows[e.RowIndex].Cells["ID"].Value);
  355. this.cmbtreevActivityName.TagFindText(this.dgvData.Rows[e.RowIndex].Cells["活动名称编号"].Value.ToString().Trim());
  356. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamMaxTaskName(this.cmbtreevMaxTeamName, this.cmbtreevActivityName.Tag.ToString().Trim());
  357. this.cmbtreevMaxTeamName.TagFindText(this.dgvData.Rows[e.RowIndex].Cells["大队名称编号"].Value.ToString().Trim());
  358. this.GetMaxTeamTask();
  359. this.cmbtreevMinTeamName.TagFindText(this.dgvData.Rows[e.RowIndex].Cells["小组名称编号"].Value.ToString().Trim());
  360. this.txtBaodiTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(this.dgvData.Rows[e.RowIndex].Cells["保底任务"].Value);
  361. this.txtTargetTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(this.dgvData.Rows[e.RowIndex].Cells["目标任务"].Value);
  362. this.txtSprintTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(this.dgvData.Rows[e.RowIndex].Cells["冲刺任务"].Value);
  363. this.btnSaveed.Text = " 修 改";
  364. }
  365. }
  366. }
  367. /// <summary>
  368. /// 保底限制输入
  369. /// </summary>
  370. /// <param name="sender"></param>
  371. /// <param name="e"></param>
  372. void txtBaodiTask_KeyPress(object sender, KeyPressEventArgs e)
  373. {
  374. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  375. { e.Handled = true; }
  376. if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
  377. { e.Handled = true; }
  378. }
  379. /// <summary>
  380. /// 目标限制输入
  381. /// </summary>
  382. /// <param name="sender"></param>
  383. /// <param name="e"></param>
  384. void txtTargetTask_KeyPress(object sender, KeyPressEventArgs e)
  385. {
  386. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  387. { e.Handled = true; }
  388. if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
  389. { e.Handled = true; }
  390. }
  391. /// <summary>
  392. /// 冲刺限制输入
  393. /// </summary>
  394. /// <param name="sender"></param>
  395. /// <param name="e"></param>
  396. void txtSprintTask_KeyPress(object sender, KeyPressEventArgs e)
  397. {
  398. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  399. { e.Handled = true; }
  400. if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
  401. { e.Handled = true; }
  402. }
  403. }
  404. }