frmReleaseBulletinBoard.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. using LYFZ.BLL;
  2. using LYFZ.ComponentLibrary;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Data.SqlClient;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Web.UI.WebControls;
  13. using System.Windows.Forms;
  14. namespace LYFZ.Software.MainBusiness.OAShopManagement
  15. {
  16. public class frmReleaseBulletinBoard : LYFZ.Software.UI.OAShopManagement.frmReleaseBulletinBoard
  17. {
  18. LYFZ.BLL.BLL_ErpOrder orbll = new BLL_ErpOrder();
  19. LYFZ.BLL.BLL_ErpShopBulletin sbbll = new LYFZ.BLL.BLL_ErpShopBulletin();
  20. LYFZ.BLL.BLL_ErpShopDesignatedAnnounced sdbll = new LYFZ.BLL.BLL_ErpShopDesignatedAnnounced();
  21. public frmReleaseBulletinBoard()
  22. {
  23. this.Load += frmReleaseBulletinBoard_Load;
  24. this.Shown += frmReleaseBulletinBoard_Shown;
  25. this.cmbSeenPeople.SelectedIndexChanged += comboBoxVisiblePeople_SelectedIndexChanged;
  26. this.btnUploadFile.Click += btnUploadFile_Click;
  27. this.btnRemoveFile.Click += btnRemoveFile_Click;
  28. this.btnDownloadFile.Click += btnDownloadFile_Click;
  29. this.btnRelease.Click += btnRelease_Click;
  30. this.btnClose.Click += btnClose_Click;
  31. this.cmbBulletinType.SelectedIndex = 0;
  32. this.cmbSeenPeople.SelectedIndex = 0;
  33. this.btnSeenPerson.Click += btnSeenPerson_Click;
  34. this.btnNext.Click += btnNext_Click;
  35. }
  36. /// <summary>
  37. /// 当前用户ID
  38. /// </summary>
  39. string EmployeeID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  40. /// <summary>
  41. /// 提示变量(true 是提示)
  42. /// </summary>
  43. public bool Prompt = false;
  44. /// <summary>
  45. /// 类型
  46. /// </summary>
  47. public string StrType = "";
  48. /// <summary>
  49. /// 公告编号
  50. /// </summary>
  51. public string StrGGNumber = "";
  52. /// <summary>
  53. /// 是否保存
  54. /// </summary>
  55. public bool IsSaveed = false;
  56. /// <summary>
  57. /// 用户集合
  58. /// </summary>
  59. DataTable dtUser = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable;
  60. /// <summary>
  61. /// 获取当前服务器路径
  62. /// </summary>
  63. LYFZ.Model.Model_Config mConfig = new LYFZ.BLL.BLL_Config().GetModel_SysConfig();
  64. /// <summary>
  65. /// 服务器路径
  66. /// </summary>
  67. string StrServerPath = @"\UploadFiles\Announcement\";
  68. /// <summary>
  69. /// 弹窗时用的数据缓存
  70. /// </summary>
  71. DataTable dtPrompt = new DataTable();
  72. LYFZ.Model.Model_ErpShopBulletin currentBulletinModel = null;
  73. /// <summary>
  74. /// 当前公告内容对象
  75. /// </summary>
  76. public LYFZ.Model.Model_ErpShopBulletin CurrentBulletinModel
  77. {
  78. get { return currentBulletinModel; }
  79. set { currentBulletinModel = value; }
  80. }
  81. LYFZ.Model.Model_ErpShopDesignatedAnnounced currentPersonModel = null;
  82. /// <summary>
  83. ///
  84. /// </summary>
  85. public LYFZ.Model.Model_ErpShopDesignatedAnnounced CurrentPersonModel
  86. {
  87. get { return currentPersonModel; }
  88. set { currentPersonModel = value; }
  89. }
  90. /// <summary>
  91. /// 窗体加载事件
  92. /// </summary>
  93. /// <param name="sender"></param>
  94. /// <param name="e"></param>
  95. void frmReleaseBulletinBoard_Load(object sender, EventArgs e)
  96. {
  97. if (Prompt)
  98. {
  99. //dtPrompt = sdbll.GetDatatable(this.EmployeeID);
  100. dtPrompt = orbll.GetView_Custom("tb_ErpShopBulletin Left Join tb_ErpShopDesignatedAnnounced on Announced_announcement = Bulletin_TheID", StrWhere: "(readID not like '%" + EmployeeID + "%' or readID is null) and (Announced_issuerID like '%" + EmployeeID + "%' or Announced_issuerID is null or Announced_issuerID = '1')", ShowColumnName: "Bulletin_TheID,Bulletin_issuerID,Bulletin_announcement,Bulletin_Title,Bulletin_content,Bulletin_ReleaseTime,Bulletin_Accessory,Announced_issuerID,readID").Tables[0];
  101. this.btnRelease.Visible = false;
  102. this.btnNext.Visible = true;
  103. if (dtPrompt.Rows.Count > 0)
  104. { this.ToViewNext(); }
  105. else
  106. { this.Close(); }
  107. }
  108. }
  109. LYFZ.BLL.BLL_ErpShopBulletin bulletinBll = new BLL_ErpShopBulletin();
  110. /// <summary>
  111. /// 窗体加载事件
  112. /// </summary>
  113. /// <param name="sender"></param>
  114. /// <param name="e"></param>
  115. void frmReleaseBulletinBoard_Shown(object sender, EventArgs e)
  116. {
  117. if (!string.IsNullOrEmpty(this.StrGGNumber))
  118. {
  119. DataTable tbl = orbll.GetView_Custom("tb_ErpShopBulletin Left Join tb_ErpShopDesignatedAnnounced on Announced_announcement = Bulletin_TheID", StrWhere: "Bulletin_TheID = '" + this.StrGGNumber + "'", ShowColumnName: "Bulletin_TheID,Bulletin_issuerID,Bulletin_announcement,Bulletin_Title,Bulletin_content,Bulletin_ReleaseTime,Bulletin_Accessory,Announced_issuerID,readID").Tables[0];
  120. this.cmbBulletinType.Text = tbl.Rows[0]["Bulletin_announcement"].ToString().Trim();
  121. this.txtBulletinTitle.Text = tbl.Rows[0]["Bulletin_Title"].ToString().Trim();
  122. if (!string.IsNullOrEmpty(tbl.Rows[0]["Announced_issuerID"].ToString().Trim()) && tbl.Rows[0]["Announced_issuerID"].ToString().Trim() != "1")
  123. {
  124. this.cmbSeenPeople.Text = "指定人员";
  125. }
  126. else
  127. {
  128. this.cmbSeenPeople.Text = "全员可见";
  129. }
  130. this.txtBulletinInfo.Text = tbl.Rows[0]["Bulletin_content"].ToString().Trim();
  131. string[] strArray = tbl.Rows[0]["Announced_issuerID"].ToString().Trim().Split(',');
  132. string StrSeenPerson = "";
  133. string StrSeenPersonNumber = "";
  134. for (int i = 0; i < strArray.Length; i++)
  135. {
  136. if (strArray[i].Trim() != LYFZ.BLL.BLL_ErpUser.Admin_20141125111443713)
  137. {
  138. StrSeenPersonNumber += strArray[i].Trim() + ",";
  139. DataRow dtRow = dtUser.Rows.Find(strArray[i].Trim());
  140. if (dtRow != null)
  141. {
  142. StrSeenPerson += dtRow["User_Name"].ToString() + ",";
  143. }
  144. }
  145. }
  146. this.txtSeenPerson.Text = StrSeenPerson.TrimEnd(',');
  147. this.txtSeenPerson.Tag = StrSeenPersonNumber.TrimEnd(',');
  148. string[] StrArrayPath = tbl.Rows[0]["Bulletin_Accessory"].ToString().Trim().Split('|');
  149. System.Windows.Forms.TreeNode root = null;
  150. for (int i = 0; i < StrArrayPath.Length; i++)
  151. {
  152. if (!string.IsNullOrEmpty(StrArrayPath[i].Trim()))
  153. {
  154. root = new System.Windows.Forms.TreeNode();
  155. root.Text = @"\" + StrArrayPath[i].Trim();
  156. root.Tag = @"\" + StrArrayPath[i].Trim();
  157. root.ForeColor = Color.Blue;
  158. this.treevFile.Nodes.Add(root);
  159. }
  160. }
  161. this.btnRelease.Text = "修改";
  162. if (tbl.Rows[0]["Bulletin_issuerID"].ToString().Trim() != this.EmployeeID && !LYFZ.BLL.BLL_ErpUser.IsAdministrator())
  163. { this.btnRelease.Enabled = false; }
  164. //this.btnRelease.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.BulletinBoardCompetence, CustomAttributes.OperatingAuthority.Update);
  165. }
  166. else
  167. {
  168. if (!Prompt)
  169. { this.cmbBulletinType.Text = this.StrType; }
  170. this.btnRelease.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.BulletinBoardCompetence, CustomAttributes.OperatingAuthority.Announcement);
  171. }
  172. }
  173. Hashtable htDataFile = new Hashtable();
  174. /// <summary>
  175. /// 可见范围选择事件
  176. /// </summary>
  177. /// <param name="sender"></param>
  178. /// <param name="e"></param>
  179. void comboBoxVisiblePeople_SelectedIndexChanged(object sender, EventArgs e)
  180. {
  181. //判断可见范围
  182. if (cmbSeenPeople.SelectedItem.ToString() == "指定人员")
  183. { this.panelOrderPerson.Visible = true; }
  184. else
  185. { this.panelOrderPerson.Visible = false; }
  186. }
  187. /// <summary>
  188. /// 选择接单人
  189. /// </summary>
  190. /// <param name="sender"></param>
  191. /// <param name="e"></param>
  192. void btnSeenPerson_Click(object sender, EventArgs e)
  193. {
  194. new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses().txtOrdersPerson(this.txtSeenPerson, false);
  195. }
  196. /// <summary>
  197. /// 选择文件
  198. /// </summary>
  199. /// <param name="sender"></param>
  200. /// <param name="e"></param>
  201. void btnUploadFile_Click(object sender, EventArgs e)
  202. {
  203. OpenFileDialog openFileDialog = new OpenFileDialog();
  204. openFileDialog.Multiselect = true;
  205. openFileDialog.Title = "选择附件";
  206. if (openFileDialog.ShowDialog() == DialogResult.OK)
  207. {
  208. string[] StrFileArray = openFileDialog.FileNames;
  209. System.Windows.Forms.TreeNode root = null;
  210. for (int i = 0; i < StrFileArray.Length; i++)
  211. {
  212. root = new System.Windows.Forms.TreeNode();
  213. root.Text = StrFileArray[i].Trim(); //new System.IO.FileInfo(StrFileArray[i].Trim()).Name;
  214. root.Tag = StrFileArray[i].Trim();
  215. root.ForeColor = Color.Red;
  216. this.treevFile.Nodes.Add(root);
  217. }
  218. }
  219. }
  220. /// <summary>
  221. /// 移除文件
  222. /// </summary>
  223. /// <param name="sender"></param>
  224. /// <param name="e"></param>
  225. void btnRemoveFile_Click(object sender, EventArgs e)
  226. {
  227. if (this.treevFile.Nodes.Count > 0)
  228. {
  229. if (this.treevFile.SelectedNode.ForeColor != Color.Red)
  230. {
  231. if (MessageBoxCustom.Show("您选择的附件已保存在服务上,你确定要移除'" + this.treevFile.SelectedNode.Text.Trim() + "'吗?", "温馨提示!", MessageBoxButtons.YesNo) == DialogResult.No)
  232. { return; }
  233. string StrTreevServerPathFile = StrServerPath + "\\" + this.StrGGNumber + "\\" + new System.IO.FileInfo(this.treevFile.SelectedNode.Tag.ToString().Trim()).Name;
  234. htDataFile[this.treevFile.SelectedNode.Tag.ToString().Trim()] = "移除";
  235. }
  236. this.treevFile.Nodes.Remove(this.treevFile.SelectedNode);
  237. }
  238. }
  239. /// <summary>
  240. /// 下载文件
  241. /// </summary>
  242. /// <param name="sender"></param>
  243. /// <param name="e"></param>
  244. void btnDownloadFile_Click(object sender, EventArgs e)
  245. {
  246. if (this.treevFile.Nodes.Count > 0)
  247. {
  248. if (this.treevFile.SelectedNode != null)
  249. {
  250. if (this.treevFile.SelectedNode.ForeColor != Color.Red)
  251. {
  252. SaveFileDialog saveFileDialog = new SaveFileDialog();
  253. string StrOldPath = this.treevFile.SelectedNode.Tag.ToString();
  254. string StrFileName = new System.IO.FileInfo(StrOldPath).Name;
  255. saveFileDialog.Filter = "压缩文件(*." + StrFileName.Split('.')[1].ToString() + ")|*." + StrFileName.Split('.')[1].ToString();
  256. saveFileDialog.FilterIndex = 1;
  257. if (saveFileDialog.ShowDialog() == DialogResult.OK)
  258. {
  259. string StrPath = saveFileDialog.FileName;
  260. LYFZ.Software.MainBusiness.TCPFileTransfer tcpFile = new MainBusiness.TCPFileTransfer();
  261. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  262. {
  263. try
  264. {
  265. backgroundWorker.ReportProgress(0, "正在连接服务器...");
  266. string ret = tcpFile.DownloadFile(StrPath, StrOldPath, backgroundWorker);
  267. MessageBoxCustom.Show(ret, backgroundWorker: backgroundWorker);
  268. }
  269. catch (Exception ex)
  270. { MessageBoxCustom.Show(ex.Message, backgroundWorker: backgroundWorker); }
  271. });
  272. }
  273. }
  274. else
  275. { MessageBoxCustom.Show("你选择的附件尚未保存,请先保存后再下载!"); }
  276. }
  277. }
  278. }
  279. /// <summary>
  280. /// 发布
  281. /// </summary>
  282. /// <param name="sender"></param>
  283. /// <param name="e"></param>
  284. void btnRelease_Click(object sender, EventArgs e)
  285. {
  286. if (string.IsNullOrEmpty(this.cmbBulletinType.Text.Trim()))
  287. { MessageBoxCustom.Show("公告类型不能为空!"); return; }
  288. if (string.IsNullOrEmpty(this.txtBulletinInfo.Text.Trim()))
  289. { MessageBoxCustom.Show("公告内容不能为空!"); return; }
  290. if (this.cmbSeenPeople.Text.Trim() == "指定人员")
  291. {
  292. if (this.txtSeenPerson.Tag == null)
  293. { MessageBoxCustom.Show("请选择公告可见人员!"); return; }
  294. }
  295. string StrNumber =String.Format("GG{0}", LYFZ.WinAPI.CustomPublicMethod.GenerateId());//SDateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(100, 1000);
  296. string SqlPath = "";
  297. for (int i = 0; i < this.treevFile.Nodes.Count; i++)
  298. {
  299. string StrTreevServerPathFile = StrServerPath + StrNumber + @"\" + new System.IO.FileInfo(this.treevFile.Nodes[i].Tag.ToString().Trim()).Name;
  300. SqlPath += StrTreevServerPathFile + "|";
  301. if (this.treevFile.Nodes[i].ForeColor == Color.Red)
  302. {
  303. htDataFile[StrTreevServerPathFile + "|" + this.treevFile.Nodes[i].Tag.ToString().Trim()] = "新增";
  304. }
  305. }
  306. // LYFZ.Model.Model_ErpShopBulletin modelBulletin = null;
  307. // LYFZ.Model.Model_ErpShopDesignatedAnnounced modelPerson = null;
  308. List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  309. if (!string.IsNullOrEmpty(this.StrGGNumber))
  310. {
  311. currentBulletinModel = sbbll.GetModel("Bulletin_TheID", this.StrGGNumber);
  312. currentBulletinModel.Bulletin_issuerID = this.EmployeeID;
  313. currentBulletinModel.Bulletin_announcement = this.cmbBulletinType.Text;
  314. currentBulletinModel.Bulletin_Title = this.txtBulletinTitle.Text;
  315. currentBulletinModel.Bulletin_content = this.txtBulletinInfo.Text;
  316. currentBulletinModel.Bulletin_ReleaseTime = SDateTime.Now;
  317. currentBulletinModel.Bulletin_Accessory = SqlPath;
  318. currentBulletinModel.Bulletin_ReleaseTime = SDateTime.Now;
  319. clist.Add(sbbll.GetUpdateCommandInfo(currentBulletinModel));
  320. CurrentPersonModel = sdbll.GetModel("Announced_announcement", this.StrGGNumber);
  321. if (this.txtSeenPerson.Tag != null)
  322. {
  323. if (!string.IsNullOrEmpty(this.txtSeenPerson.Tag.ToString().Trim()) && this.txtSeenPerson.Tag.ToString().Trim() != "1")
  324. {
  325. string[] Str = this.txtSeenPerson.Tag.ToString().Trim().Split('|')[0].Split(',');
  326. if (Str.Length > 0)
  327. {
  328. string StrOrderPerson = "";
  329. for (int i = 0; i < Str.Length; i++)
  330. { StrOrderPerson += Str[i] + ","; }
  331. StrOrderPerson += LYFZ.BLL.BLL_ErpUser.Admin_20141125111443713;
  332. CurrentPersonModel.Announced_issuerID = StrOrderPerson;
  333. }
  334. }
  335. }
  336. else
  337. { CurrentPersonModel.Announced_issuerID = "1"; }
  338. CurrentPersonModel.Announced_announcement = this.StrGGNumber;
  339. CurrentPersonModel.readID = "";
  340. clist.Add(sdbll.GetUpdateCommandInfo(CurrentPersonModel));
  341. }
  342. else
  343. {
  344. currentBulletinModel = new LYFZ.Model.Model_ErpShopBulletin();
  345. currentBulletinModel.Bulletin_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  346. currentBulletinModel.Bulletin_issuerID = this.EmployeeID;
  347. currentBulletinModel.Bulletin_announcement = this.cmbBulletinType.Text;
  348. currentBulletinModel.Bulletin_Title = this.txtBulletinTitle.Text;
  349. currentBulletinModel.Bulletin_content = this.txtBulletinInfo.Text;
  350. currentBulletinModel.Bulletin_ReleaseTime = SDateTime.Now;
  351. currentBulletinModel.Bulletin_Accessory = SqlPath;
  352. currentBulletinModel.Bulletin_TheID = StrNumber;
  353. clist.Add(sbbll.GetAddCommandInfo(currentBulletinModel));
  354. CurrentPersonModel = new Model.Model_ErpShopDesignatedAnnounced();
  355. if (this.txtSeenPerson.Tag != null)
  356. {
  357. if (!string.IsNullOrEmpty(this.txtSeenPerson.Tag.ToString().Trim()) && this.txtSeenPerson.Tag.ToString().Trim() != "1")
  358. {
  359. string[] Str = this.txtSeenPerson.Tag.ToString().Trim().Split('|')[0].Split(',');
  360. if (Str.Length > 0)
  361. {
  362. string StrOrderPerson = "";
  363. for (int i = 0; i < Str.Length; i++)
  364. { StrOrderPerson += Str[i] + ","; }
  365. StrOrderPerson += LYFZ.BLL.BLL_ErpUser.Admin_20141125111443713;
  366. CurrentPersonModel.Announced_issuerID = StrOrderPerson;
  367. }
  368. }
  369. }
  370. else
  371. { CurrentPersonModel.Announced_issuerID = "1"; }
  372. CurrentPersonModel.Announced_announcement = currentBulletinModel.Bulletin_TheID;
  373. CurrentPersonModel.readID = "";
  374. clist.Add(sdbll.GetAddCommandInfo(CurrentPersonModel));
  375. }
  376. LYFZ.Software.MainBusiness.TCPFileTransfer tcpFile = new MainBusiness.TCPFileTransfer();
  377. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  378. {
  379. backgroundWorker.ReportProgress(0, "正在连接服务器...");
  380. foreach (DictionaryEntry de in htDataFile)
  381. {
  382. try
  383. {
  384. string ret = "";
  385. if (de.Value.ToString().Trim() == "移除")
  386. { ret = tcpFile.DeleteFile(de.Key.ToString().Trim(), backgroundWorker); }
  387. else
  388. {
  389. string[] StrArray = de.Key.ToString().Trim().Split('|');
  390. ret = tcpFile.UploadFileToServer(StrArray[1].Trim(), StrArray[0].Trim(), backgroundWorker);
  391. }
  392. if (ret.IndexOf("成功") == -1)
  393. { MessageBoxCustom.Show(ret, backgroundWorker: backgroundWorker); }
  394. }
  395. catch (Exception ex)
  396. { MessageBoxCustom.Show(ex.Message, backgroundWorker: backgroundWorker); }
  397. }
  398. });
  399. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) >= 0)
  400. {
  401. this.IsSaveed = true;
  402. if (string.IsNullOrEmpty(this.StrGGNumber))
  403. { this.StrGGNumber = StrNumber; }
  404. this.htDataFile.Clear();
  405. for (int i = 0; i < this.treevFile.Nodes.Count; i++)
  406. {
  407. if (this.treevFile.Nodes[i].Text.Trim() != "" && this.treevFile.Nodes[i].ForeColor == Color.Red)
  408. {
  409. string StrNodeText = StrServerPath + @"\" + StrNumber + @"\" + new System.IO.FileInfo(this.treevFile.Nodes[i].Tag.ToString().Trim()).Name;
  410. this.treevFile.Nodes[i].Text = StrNodeText;
  411. this.treevFile.Nodes[i].Tag = StrNodeText;
  412. this.treevFile.Nodes[i].ForeColor = Color.Blue;
  413. }
  414. }
  415. MessageBoxCustom.Show("发布成功");
  416. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  417. }
  418. else
  419. { MessageBoxCustom.Show("发布失败"); }
  420. }
  421. /// <summary>
  422. /// 下一条
  423. /// </summary>
  424. /// <param name="sender"></param>
  425. /// <param name="e"></param>
  426. void btnNext_Click(object sender, EventArgs e)
  427. {
  428. if (this.dtPrompt.Rows.Count > 0)
  429. {
  430. this.ToViewNext();
  431. }
  432. }
  433. /// <summary>
  434. /// 关闭
  435. /// </summary>
  436. /// <param name="sender"></param>
  437. /// <param name="e"></param>
  438. void btnClose_Click(object sender, EventArgs e)
  439. {
  440. this.Close();
  441. }
  442. /// <summary>
  443. /// 查看下一条
  444. /// </summary>
  445. void ToViewNext(int IndexCount = 0)
  446. {
  447. this.cmbBulletinType.Text = dtPrompt.Rows[IndexCount]["Bulletin_announcement"].ToString().Trim();
  448. this.txtBulletinTitle.Text = dtPrompt.Rows[IndexCount]["Bulletin_Title"].ToString().Trim();
  449. if (!string.IsNullOrEmpty(dtPrompt.Rows[IndexCount]["Announced_issuerID"].ToString().Trim()) && dtPrompt.Rows[IndexCount]["Announced_issuerID"].ToString().Trim() != "1")
  450. { this.cmbSeenPeople.Text = "指定人员"; }
  451. else
  452. { this.cmbSeenPeople.Text = "全员可见"; }
  453. this.txtBulletinInfo.Text = dtPrompt.Rows[IndexCount]["Bulletin_content"].ToString().Trim();
  454. string[] strArray = dtPrompt.Rows[IndexCount]["Announced_issuerID"].ToString().Trim().Split(',');
  455. string StrSeenPerson = "";
  456. string StrSeenPersonNumber = "";
  457. for (int i = 0; i < strArray.Length; i++)
  458. {
  459. if (strArray[i].Trim() != LYFZ.BLL.BLL_ErpUser.Admin_20141125111443713)
  460. {
  461. StrSeenPersonNumber += strArray[i].Trim() + ",";
  462. DataRow dtRow = dtUser.Rows.Find(strArray[i].Trim());
  463. if (dtRow != null)
  464. { StrSeenPerson += dtRow["User_Name"].ToString() + ","; }
  465. }
  466. }
  467. this.txtSeenPerson.Text = StrSeenPerson.TrimEnd(',');
  468. this.txtSeenPerson.Tag = StrSeenPersonNumber.TrimEnd(',');
  469. string[] StrArrayPath = dtPrompt.Rows[IndexCount]["Bulletin_Accessory"].ToString().Trim().Split('|');
  470. System.Windows.Forms.TreeNode root = null;
  471. for (int i = 0; i < StrArrayPath.Length; i++)
  472. {
  473. if (!string.IsNullOrEmpty(StrArrayPath[i].Trim()))
  474. {
  475. root = new System.Windows.Forms.TreeNode();
  476. root.Text = "\\" + StrArrayPath[i].Trim();
  477. root.Tag = "\\" + StrArrayPath[i].Trim();
  478. root.ForeColor = Color.Blue;
  479. this.treevFile.Nodes.Add(root);
  480. }
  481. }
  482. if (sdbll.Exists("Announced_announcement", dtPrompt.Rows[IndexCount]["Bulletin_TheID"].ToString().Trim()))
  483. {
  484. ///存在
  485. Model.Model_ErpShopDesignatedAnnounced model = sdbll.GetModel("Announced_announcement", dtPrompt.Rows[IndexCount]["Bulletin_TheID"].ToString().Trim());
  486. model.readID = model.readID + EmployeeID + ",";
  487. if (!sdbll.Update(model))
  488. { MessageBoxCustom.Show("公告发生错误!"); }
  489. }
  490. this.dtPrompt.Rows.RemoveAt(IndexCount);
  491. if (dtPrompt.Rows.Count > 0)
  492. { this.Text = "发布公告:【你有:" + dtPrompt.Rows.Count + "条未读公告】"; }
  493. else
  494. {
  495. this.Text = "发布公告";
  496. this.btnNext.Enabled = false;
  497. }
  498. //this.cmbBulletinType.Text = dgv.Rows[indexlenght].Cells["公告类型"].Value.ToString();
  499. //this.txtBulletinTitle.Text = dgv.Rows[indexlenght].Cells["标题"].Value.ToString();
  500. //this.txtBulletinInfo.Text = dgv.Rows[indexlenght].Cells["内容"].Value.ToString();
  501. //if (dgv.Rows[indexlenght].Cells["文件路径"].Value.ToString() != "")
  502. //{
  503. // Shangchuan = true;
  504. //}
  505. //else { btnUploadFile.Visible = false; }
  506. //IsNullAdd(dgv.Rows[indexlenght].Cells["公告ID"].Value.ToString());
  507. }
  508. }
  509. }