Beispiel #1
0
        //****************************************************************************************************
        //加载
        private void FrmWorkerTypeEdit_Load(object sender, EventArgs e)
        {
            if (intId == 0)
            {
                this.Text = "添加" + this.Text;
            }
            else
            {
                this.Text = "修改" + this.Text;

                DataRow dr = new ModWorkerType().setWhere("id > 0", true).getFind(intId);
                if (dr == null)
                {
                    Function.showMessage("记录为空");
                    this.Close();
                }
                else
                {
                    txtWorkerType.Text = dr["workerType"].ToString();
                    chkIsPass.Checked  = Convert.ToBoolean(dr["isPass"]);
                }
            }
        }
Beispiel #2
0
        //****************************************************************************************************
        //员工类型
        public static void setWorkerType(ComboBox cmb, Object value = null)
        {
            DataTable dt = new ModWorkerType().getSelect();

            DataRow dr = dt.NewRow();

            dr["id"]         = 0;
            dr["workerType"] = "--请选择员工类型--";
            dt.Rows.InsertAt(dr, 0);

            cmb.DataSource    = dt;
            cmb.ValueMember   = "id";
            cmb.DisplayMember = "workerType";

            if (value == null)
            {
                cmb.SelectedValue = 0;
            }
            else
            {
                cmb.SelectedValue = Convert.ToInt32(value);
            }
        }
Beispiel #3
0
        //****************************************************************************************************
        private void showData()
        {
            DataTable dt = new ModWorkerType().setWhere("id > 0", true).getSelect();

            if (dt == null)
            {
                btnUpdate.Enabled = false;
            }
            else
            {
                btnUpdate.Enabled = true;

                int intIndex = 0;
                if (grd.Rows.Count > 0)
                {
                    intIndex = grd.CurrentRow.Index;
                }

                grd.AutoGenerateColumns = false;
                grd.DataSource          = dt;
                grd.Rows[intIndex].Cells[1].Selected = true;
            }
        }