Beispiel #1
0
        private void DoMyBtn(string strBtnName)
        {
            DataRow dr = gridVMain.GetFocusedDataRow();

            switch (strBtnName)
            {
            case "btnSetRoleUser":
                if (dr == null)
                {
                    return;
                }
                frmBseRoleUserEdit frm = new frmBseRoleUserEdit();
                frm.RoleId   = dr["Role_Id"].ToString();
                frm.RoleName = dr["Role_Nme"].ToString();
                frm.ShowDialog();
                break;

            case "btnSetRoleRight":
                if (dr == null)
                {
                    return;
                }
                frmBseRoleRight frm1 = new frmBseRoleRight();
                frm1.RoleId   = dr["Role_Id"].ToString();
                frm1.RoleName = dr["Role_Nme"].ToString();
                frm1.ShowDialog(this);
                break;

            case "btnSetUserRight":
                if (dr == null)
                {
                    return;
                }
                frmBseUserRight frm2 = new frmBseUserRight();
                frm2.UserId   = dr["User_Id"].ToString();
                frm2.UserName = dr["Number"].ToString() + "—" + dr["Name"].ToString();
                frm2.ShowDialog(this);
                break;

            case "btnSetUserRole":
                if (dr == null)
                {
                    return;
                }
                frmBseUserRoleEdit frm3 = new frmBseUserRoleEdit();
                frm3.UserId   = dr["User_Id"].ToString();
                frm3.UserInfo = "姓名:" + dr["Name"].ToString() + " 编号:" + dr["Number"].ToString();
                frm3.ShowDialog();
                break;

            case "btnSetUserPsw":
                if (dr == null)
                {
                    return;
                }
                string strMsg = "是否确认重置用户密码为 1 ,被重置用户:" + dr["Number"].ToString() + "—" + dr["Name"].ToString();
                if (MessageBox.Show(strMsg, "操作确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
                {
                    return;
                }

                string[] strKey = "strTableName,strTableFieldKey,strTableFieldValue,strSql,UserId,ActFlag".Split(",".ToCharArray());
                string[] strVal = new string[] { "Bse_User", "User_Id", dr["User_Id"].ToString()
                                                 , "PassWord='******'", CApplication.App.CurrentSession.UserId.ToString(), "EditPsd" };
                DataTable dtRet = this.DataRequest_By_DataTable("Share_Update_Table_Value", strKey, strVal);
                if (dtRet.Rows[0][0].ToString() == "OK")
                {
                    MessageBox.Show("重置成功.");
                }
                else
                {
                    MessageBox.Show("重置失败.");
                }
                break;

            case "btnCreateBarcodeImage":
                if (gridVMain.SelectedRowsCount <= 0)
                {
                    return;
                }

                tdCreateBarcodeImage = new Thread(new ThreadStart(CreateBarcodeImage));
                tdCreateBarcodeImage.Start();
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        private void btn_Click(object sender, EventArgs e)
        {
            SimpleButton btn = sender as SimpleButton;
            DataRow      dr  = gridVMain.GetFocusedDataRow();

            switch (btn.Name)
            {
            case "btnAdd":
                gridVMain.ClearColumnsFilter();
                gridVMain.ClearSorting();
                SetWMode("ADD");
                break;

            case "btnEdit":
                if (dr == null)
                {
                    return;
                }
                SetWMode("EDIT");
                break;

            case "btnCancel":
                if (dr == null)
                {
                    return;
                }
                blInitBound = true;
                frmDataTable.RejectChanges();    //引发gridView1_FocusedRowChanged
                frmDataTable.AcceptChanges();
                blInitBound = false;
                SetWMode("VIEW");
                gridVMain_FocusedRowChanged(gridVMain, new DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs(-1, gridVMain.FocusedRowHandle));
                break;

            case "btnSave":
                if (dr == null)
                {
                    return;
                }
                DoSave();
                break;

            case "btnSetUser":
                if (dr == null)
                {
                    return;
                }
                frmBseRoleUserEdit frm1 = new frmBseRoleUserEdit();
                frm1.RoleId   = dr["Role_Id"].ToString();
                frm1.RoleName = dr["Role_Nme"].ToString();
                frm1.ShowDialog();
                break;

            case "btnSetRight":
                if (dr == null)
                {
                    return;
                }
                frmBseRoleRight frm2 = new frmBseRoleRight();
                frm2.RoleId   = dr["Role_Id"].ToString();
                frm2.RoleName = dr["Role_Nme"].ToString();
                frm2.ShowDialog();
                break;

            default:
                break;
            }
        }