FrmPieceStyleCommissionScheme.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.InitialSet.WageSet
  10. {
  11. public partial class FrmPieceStyleCommissionScheme : LYFZ.Software.UI.InitialSet.WageSet.FrmPieceStyleCommissionScheme
  12. {
  13. public FrmPieceStyleCommissionScheme()
  14. {
  15. this.cmbtreevSc_ClassName.ComboBoxTree_NodeMouseClick += cmbtreevSc_ClassName_ComboBoxTree_NodeMouseClick;
  16. }
  17. /// <summary>
  18. /// 窗体加载事件
  19. /// </summary>
  20. /// <param name="sender"></param>
  21. /// <param name="e"></param>
  22. protected override void FrmPieceStyleCommissionScheme_Load(object sender, EventArgs e)
  23. {
  24. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBBBABBEBAIHGDCB", this.cmbtreevSc_ClassName, IsFirstNodeNull: true);
  25. }
  26. /// <summary>
  27. /// 关闭
  28. /// </summary>
  29. /// <param name="sender"></param>
  30. /// <param name="e"></param>
  31. protected override void btnClose_Click(object sender, EventArgs e)
  32. {
  33. this.Close();
  34. }
  35. /// <summary>
  36. /// 设置
  37. /// </summary>
  38. /// <param name="sender"></param>
  39. /// <param name="e"></param>
  40. protected override void btnSet_Click(object sender, EventArgs e)
  41. {
  42. LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet set = new InitialSet.FrmSystemSet();
  43. set.Version = "Version";
  44. set.TypeName = "BEBBBABBEBAIHGDCB";
  45. if (set.ShowDialog() == DialogResult.OK)
  46. { this.FrmPieceStyleCommissionScheme_Load(this, null); }
  47. }
  48. /// <summary>
  49. /// 文本框设置
  50. /// </summary>
  51. /// <param name="sender"></param>
  52. /// <param name="e"></param>
  53. protected override void txtWcs_Percentage_KeyPress(object sender, KeyPressEventArgs e)
  54. {
  55. if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar))
  56. { e.Handled = true; }
  57. else if (Char.IsPunctuation(e.KeyChar))
  58. {
  59. if (e.KeyChar == '.')
  60. {
  61. if (((System.Windows.Forms.TextBox)sender).Text.LastIndexOf('.') != -1)
  62. { e.Handled = true; }
  63. }
  64. else
  65. { e.Handled = true; }
  66. }
  67. }
  68. /// <summary>
  69. /// 选择文本框
  70. /// </summary>
  71. /// <param name="sender"></param>
  72. /// <param name="e"></param>
  73. void cmbtreevSc_ClassName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  74. {
  75. try
  76. {
  77. LYFZ.BLL.BLL_ErpWageCommissionSet bll = new BLL.BLL_ErpWageCommissionSet();
  78. DataTable dt = bll.GetList("Wcs_TypeCode='" + this.cmbtreevSc_ClassName.Tag.ToString().Trim() + "'").Tables[0];
  79. if (dt.Rows.Count > 0)
  80. { txtWcs_Percentage.Text = dt.Rows[0]["Wcs_Percentage"].ToString(); }
  81. else
  82. { txtWcs_Percentage.Text = ""; }
  83. }
  84. catch (Exception ex)
  85. { MessageBoxCustom.Show(ex.Message); }
  86. }
  87. /// <summary>
  88. /// 保存
  89. /// </summary>
  90. /// <param name="sender"></param>
  91. /// <param name="e"></param>
  92. protected override void btnOk_Click(object sender, EventArgs e)
  93. {
  94. try
  95. {
  96. LYFZ.BLL.BLL_ErpWageCommissionSet bll = new BLL.BLL_ErpWageCommissionSet();
  97. LYFZ.Model.Model_ErpWageCommissionSet model = new Model.Model_ErpWageCommissionSet();
  98. if (string.IsNullOrEmpty(this.cmbtreevSc_ClassName.Text.Trim()))
  99. { MessageBoxCustom.Show("请选择工作内容!"); return; }
  100. if (string.IsNullOrEmpty(txtWcs_Percentage.Text))
  101. { MessageBoxCustom.Show("请输入数字!"); return; }
  102. DataTable dt = bll.GetList("Wcs_TypeCode='" + this.cmbtreevSc_ClassName.Tag.ToString().Trim() + "'").Tables[0];
  103. bool IsSaveed = false;
  104. if (dt.Rows.Count == 0)
  105. {
  106. // 增加
  107. model.Wcs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  108. model.Wcs_Type = "计件式提成";
  109. model.Wcs_TypeCode = this.cmbtreevSc_ClassName.Tag.ToString().Trim();
  110. // model.Wcs_PerformanceBeginValue = null;
  111. // model.Wcs_PerformanceEndValue = Convert.ToInt32(txtWcs_PerformanceEndValue.Text);
  112. model.Wcs_Percentage = Convert.ToDecimal(txtWcs_Percentage.Text);
  113. model.Wcs_PerformanceHight = true;
  114. // model.Wcs_Rule = ""; Convert.ToInt32(model.Wcs_PerformanceBeginValue) + "-" + Convert.ToInt32(model.Wcs_PerformanceEndValue) + " 提:" + Convert.ToDecimal(model.Wcs_Percentage)+"%";
  115. model.Wcs_CreateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  116. IsSaveed = bll.Add(model);
  117. }
  118. else
  119. {
  120. // 修改
  121. if (bll.UpdateWcs_Percentage(txtWcs_Percentage.Text, "Wcs_TypeCode='" + this.cmbtreevSc_ClassName.Tag.ToString().Trim() + "'") > 0)
  122. { IsSaveed = true; }
  123. }
  124. if (IsSaveed)
  125. {
  126. MessageBoxCustom.Show("保存成功!");
  127. txtWcs_Percentage.Text = "";
  128. this.FrmPieceStyleCommissionScheme_Load(this, null);
  129. }
  130. }
  131. catch (Exception ex)
  132. { MessageBoxCustom.Show(ex.Message); }
  133. }
  134. }
  135. }