123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- 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;
- namespace LYFZ.Software.MainBusiness.InitialSet.WageSet
- {
- public partial class FrmPieceStyleCommissionScheme : LYFZ.Software.UI.InitialSet.WageSet.FrmPieceStyleCommissionScheme
- {
- public FrmPieceStyleCommissionScheme()
- {
- this.cmbtreevSc_ClassName.ComboBoxTree_NodeMouseClick += cmbtreevSc_ClassName_ComboBoxTree_NodeMouseClick;
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void FrmPieceStyleCommissionScheme_Load(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBBBABBEBAIHGDCB", this.cmbtreevSc_ClassName, IsFirstNodeNull: true);
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnSet_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet set = new InitialSet.FrmSystemSet();
- set.Version = "Version";
- set.TypeName = "BEBBBABBEBAIHGDCB";
- if (set.ShowDialog() == DialogResult.OK)
- { this.FrmPieceStyleCommissionScheme_Load(this, null); }
- }
- /// <summary>
- /// 文本框设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtWcs_Percentage_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- else if (Char.IsPunctuation(e.KeyChar))
- {
- if (e.KeyChar == '.')
- {
- if (((System.Windows.Forms.TextBox)sender).Text.LastIndexOf('.') != -1)
- { e.Handled = true; }
- }
- else
- { e.Handled = true; }
- }
- }
- /// <summary>
- /// 选择文本框
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevSc_ClassName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
- {
- try
- {
- LYFZ.BLL.BLL_ErpWageCommissionSet bll = new BLL.BLL_ErpWageCommissionSet();
- DataTable dt = bll.GetList("Wcs_TypeCode='" + this.cmbtreevSc_ClassName.Tag.ToString().Trim() + "'").Tables[0];
- if (dt.Rows.Count > 0)
- { txtWcs_Percentage.Text = dt.Rows[0]["Wcs_Percentage"].ToString(); }
- else
- { txtWcs_Percentage.Text = ""; }
- }
- catch (Exception ex)
- { MessageBoxCustom.Show(ex.Message); }
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnOk_Click(object sender, EventArgs e)
- {
- try
- {
- LYFZ.BLL.BLL_ErpWageCommissionSet bll = new BLL.BLL_ErpWageCommissionSet();
- LYFZ.Model.Model_ErpWageCommissionSet model = new Model.Model_ErpWageCommissionSet();
- if (string.IsNullOrEmpty(this.cmbtreevSc_ClassName.Text.Trim()))
- { MessageBoxCustom.Show("请选择工作内容!"); return; }
- if (string.IsNullOrEmpty(txtWcs_Percentage.Text))
- { MessageBoxCustom.Show("请输入数字!"); return; }
- DataTable dt = bll.GetList("Wcs_TypeCode='" + this.cmbtreevSc_ClassName.Tag.ToString().Trim() + "'").Tables[0];
- bool IsSaveed = false;
- if (dt.Rows.Count == 0)
- {
- // 增加
- model.Wcs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Wcs_Type = "计件式提成";
- model.Wcs_TypeCode = this.cmbtreevSc_ClassName.Tag.ToString().Trim();
- // model.Wcs_PerformanceBeginValue = null;
- // model.Wcs_PerformanceEndValue = Convert.ToInt32(txtWcs_PerformanceEndValue.Text);
- model.Wcs_Percentage = Convert.ToDecimal(txtWcs_Percentage.Text);
- model.Wcs_PerformanceHight = true;
- // model.Wcs_Rule = ""; Convert.ToInt32(model.Wcs_PerformanceBeginValue) + "-" + Convert.ToInt32(model.Wcs_PerformanceEndValue) + " 提:" + Convert.ToDecimal(model.Wcs_Percentage)+"%";
- model.Wcs_CreateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
- IsSaveed = bll.Add(model);
- }
- else
- {
- // 修改
- if (bll.UpdateWcs_Percentage(txtWcs_Percentage.Text, "Wcs_TypeCode='" + this.cmbtreevSc_ClassName.Tag.ToString().Trim() + "'") > 0)
- { IsSaveed = true; }
- }
- if (IsSaveed)
- {
- MessageBoxCustom.Show("保存成功!");
- txtWcs_Percentage.Text = "";
- this.FrmPieceStyleCommissionScheme_Load(this, null);
- }
- }
- catch (Exception ex)
- { MessageBoxCustom.Show(ex.Message); }
- }
- }
- }
|