zoukankan      html  css  js  c++  java
  • C#switch循环实现代码共用

    void save()
            {
                if (!is数据正确()) { return; }
                List<SQLStruct> col = new List<SQLStruct>();
                col.Add(new SQLStruct("EmployeeInfo_JobNumber", this.txtNO.Text));
                col.Add(new SQLStruct("EmployeeInfo_Name", this.txtName.Text));
                col.Add(new SQLStruct("EmployeeInfo_NameJP",ClassFunction.ChineseCap(this.txtName.Text)));
                col.Add(new SQLStruct("EmployeeInfo_Use", this.txt启用员工.Checked));
                col.Add(new SQLStruct("EmployeeInfo_Sex", this.txtsex1.Checked?"先生":"女士"));


                col.Add(new SQLStruct("EmployeeInfo_EDepartmentNO", this.txt部门.SelectedValue.ToString()));
                col.Add(new SQLStruct("EmployeeInfo_PowerNO", this.txt权限.SelectedValue.ToString()));

                col.Add(new SQLStruct("EmployeeInfo_BirthIs", this.txt出生日期启用.Checked));
                col.Add(new SQLStruct("EmployeeInfo_Birth", this.txt出生年月.Value));
                col.Add(new SQLStruct("EmployeeInfo_Address", this.txtaddress.Text));
                col.Add(new SQLStruct("EmployeeInfo_Phone", this.txtTel.Text));
                col.Add(new SQLStruct("EmployeeInfo_CheckNO", this.txt考勤编号.Text));

                col.Add(new SQLStruct("EmployeeInfo_EntryDate", this.txt入职时间.Value));
                col.Add(new SQLStruct("EmployeeInfo_DepartureIs", this.txt是否离职.Checked));
                col.Add(new SQLStruct("EmployeeInfo_DepartureDate", this.txt离职时间.Value));
                col.Add(new SQLStruct("EmployeeInfo_PlayMoney", this.txtn员工计划.Value));

                string sql = "";
                switch (this.cft)
                {
                    case ClassFormType.添加:
                        this.eNO=ClassFunction.SCNO("ENO");
                        col.Add(new SQLStruct("EmployeeInfo_NO", this.eNO));
                        col.Add(new SQLStruct("EmployeeInfo_PassWord",  ClassUser.MD5员工(this.txtPass.Text, eNO)));
                        sql += SQLGet.Add(col, "EmployeeInfo");
                        break;
                    case ClassFormType.修改:
                        sql += SQLGet.Update(col, "EmployeeInfo") + " where EmployeeInfo_NO='" + this.eNO+"'";
                        txt考勤编号.Text = sql;
                        break;
                    default:
                        this.Close();
                        break;
                }
                //MessageBox.Show(sql);
                if (ClassData.UpDate(sql) > 0)
                {
                    MessageBox.Show(this.cft.ToString() + "成功!");
                    ClassData.SysLog(this.cft.ToString() + "员工【" + this.eNO + "】【" + this.txtName.Text + "】");
                    IsOK = true;
                    this.Close();
                }
                else
                {
                    MessageBox.Show(this.cft.ToString() + "失败!");
                }
            }
    ------------------------------YXToolSystem-------------------------
    using System;

    namespace YXToolSystem
    {
        public enum ClassFormType
        {
            添加 = 0,
            删除 = 1,
            修改 = 2,
            查看 = 3,
            审核 = 4,
            反审核 = 5,
        }
    }
    ------------------------------cft---eNO-------------------------------------------
    public Form员工管理添加(ClassFormType cft, string eNO)
            {
                InitializeComponent();

                //
              InterfaceSystem.ClassFormStyle.FromStyleFixedToolWindow(this);
              InterfaceSystem.ClassFormStyle.BUTB_STYE(this.butExit);
              InterfaceSystem.ClassFormStyle.BUTB_STYE(this.butOK);

                this.cft = cft;
                this.eNO = eNO;
                this.Text = "员工设置" + cft.ToString();
                this.butOK.Text = cft.ToString();
            }

  • 相关阅读:
    Qt Qaction和触发函数建立连接的方法
    Qt QChart缩放后坐标轴间隔取整
    Qt 编译时报错“退出,退出代码2”的原因
    Qt Qchart 中清空绘图
    Qt QChartView 如何放入widget
    Qt QChart之曲线图,饼状图,条形图使用
    Qt 实现控件不响应鼠标点击事件
    Qt css样式大全(整理版)
    Qt 加载qss文件
    Qt 如何处理密集型耗时的事情(频繁调用QApplication::processEvents)
  • 原文地址:https://www.cnblogs.com/qq1206583608/p/5165516.html
Copyright © 2011-2022 走看看