Ignore:
Timestamp:
Aug 30, 2010, 2:51:30 PM (14 years ago)
Author:
Sam Habiel
Message:

Changes in handling of Divisions. Now prompts if more than one division assigned to user.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNet/DSelectDivision.cs

    r815 r923  
    3030                private void InitializeComponent()
    3131                {
    32                         this.pnlPageBottom = new System.Windows.Forms.Panel();
    33                         this.cmdCancel = new System.Windows.Forms.Button();
    34                         this.cmdOK = new System.Windows.Forms.Button();
    35                         this.pnlDescription = new System.Windows.Forms.Panel();
    36                         this.grpDescriptionResourceGroup = new System.Windows.Forms.GroupBox();
    37                         this.lblDescriptionResourceGroup = new System.Windows.Forms.Label();
    38                         this.lstDivision = new System.Windows.Forms.ListBox();
    39                         this.label1 = new System.Windows.Forms.Label();
    40                         this.pnlPageBottom.SuspendLayout();
    41                         this.pnlDescription.SuspendLayout();
    42                         this.grpDescriptionResourceGroup.SuspendLayout();
    43                         this.SuspendLayout();
    44                         //
    45                         // pnlPageBottom
    46                         //
    47                         this.pnlPageBottom.Controls.Add(this.cmdCancel);
    48                         this.pnlPageBottom.Controls.Add(this.cmdOK);
    49                         this.pnlPageBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
    50                         this.pnlPageBottom.Location = new System.Drawing.Point(0, 262);
    51                         this.pnlPageBottom.Name = "pnlPageBottom";
    52                         this.pnlPageBottom.Size = new System.Drawing.Size(456, 40);
    53                         this.pnlPageBottom.TabIndex = 7;
    54                         //
    55                         // cmdCancel
    56                         //
    57                         this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    58                         this.cmdCancel.Location = new System.Drawing.Point(376, 8);
    59                         this.cmdCancel.Name = "cmdCancel";
    60                         this.cmdCancel.Size = new System.Drawing.Size(56, 24);
    61                         this.cmdCancel.TabIndex = 4;
    62                         this.cmdCancel.Text = "Cancel";
    63                         //
    64                         // cmdOK
    65                         //
    66                         this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
    67                         this.cmdOK.Location = new System.Drawing.Point(296, 8);
    68                         this.cmdOK.Name = "cmdOK";
    69                         this.cmdOK.Size = new System.Drawing.Size(64, 24);
    70                         this.cmdOK.TabIndex = 3;
    71                         this.cmdOK.Text = "OK";
    72                         this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
    73                         //
    74                         // pnlDescription
    75                         //
    76                         this.pnlDescription.Controls.Add(this.grpDescriptionResourceGroup);
    77                         this.pnlDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
    78                         this.pnlDescription.Location = new System.Drawing.Point(0, 190);
    79                         this.pnlDescription.Name = "pnlDescription";
    80                         this.pnlDescription.Size = new System.Drawing.Size(456, 72);
    81                         this.pnlDescription.TabIndex = 8;
    82                         //
    83                         // grpDescriptionResourceGroup
    84                         //
    85                         this.grpDescriptionResourceGroup.Controls.Add(this.lblDescriptionResourceGroup);
    86                         this.grpDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
    87                         this.grpDescriptionResourceGroup.Location = new System.Drawing.Point(0, 0);
    88                         this.grpDescriptionResourceGroup.Name = "grpDescriptionResourceGroup";
    89                         this.grpDescriptionResourceGroup.Size = new System.Drawing.Size(456, 72);
    90                         this.grpDescriptionResourceGroup.TabIndex = 1;
    91                         this.grpDescriptionResourceGroup.TabStop = false;
    92                         this.grpDescriptionResourceGroup.Text = "Description";
    93                         //
    94                         // lblDescriptionResourceGroup
    95                         //
    96                         this.lblDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
    97                         this.lblDescriptionResourceGroup.Location = new System.Drawing.Point(3, 16);
    98                         this.lblDescriptionResourceGroup.Name = "lblDescriptionResourceGroup";
    99                         this.lblDescriptionResourceGroup.Size = new System.Drawing.Size(450, 53);
    100                         this.lblDescriptionResourceGroup.TabIndex = 0;
    101                         this.lblDescriptionResourceGroup.Text = "Use this panel to select the Division.";
    102                         //
    103                         // lstDivision
    104                         //
    105                         this.lstDivision.Location = new System.Drawing.Point(40, 48);
    106                         this.lstDivision.Name = "lstDivision";
    107                         this.lstDivision.Size = new System.Drawing.Size(384, 121);
    108                         this.lstDivision.TabIndex = 9;
    109                         //
    110                         // label1
    111                         //
    112                         this.label1.Location = new System.Drawing.Point(40, 24);
    113                         this.label1.Name = "label1";
    114                         this.label1.Size = new System.Drawing.Size(240, 16);
    115                         this.label1.TabIndex = 10;
    116                         this.label1.Text = "Select Division:";
    117                         //
    118                         // DSelectDivision
    119                         //
    120                         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    121                         this.ClientSize = new System.Drawing.Size(456, 302);
    122                         this.Controls.Add(this.label1);
    123                         this.Controls.Add(this.lstDivision);
    124                         this.Controls.Add(this.pnlDescription);
    125                         this.Controls.Add(this.pnlPageBottom);
    126                         this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
    127                         this.Name = "DSelectDivision";
    128                         this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
    129                         this.Text = "Select Division";
    130                         this.pnlPageBottom.ResumeLayout(false);
    131                         this.pnlDescription.ResumeLayout(false);
    132                         this.grpDescriptionResourceGroup.ResumeLayout(false);
    133                         this.ResumeLayout(false);
     32            this.pnlPageBottom = new System.Windows.Forms.Panel();
     33            this.cmdCancel = new System.Windows.Forms.Button();
     34            this.cmdOK = new System.Windows.Forms.Button();
     35            this.pnlDescription = new System.Windows.Forms.Panel();
     36            this.grpDescriptionResourceGroup = new System.Windows.Forms.GroupBox();
     37            this.lblDescriptionResourceGroup = new System.Windows.Forms.Label();
     38            this.lstDivision = new System.Windows.Forms.ListBox();
     39            this.label1 = new System.Windows.Forms.Label();
     40            this.pnlPageBottom.SuspendLayout();
     41            this.pnlDescription.SuspendLayout();
     42            this.grpDescriptionResourceGroup.SuspendLayout();
     43            this.SuspendLayout();
     44            //
     45            // pnlPageBottom
     46            //
     47            this.pnlPageBottom.Controls.Add(this.cmdCancel);
     48            this.pnlPageBottom.Controls.Add(this.cmdOK);
     49            this.pnlPageBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
     50            this.pnlPageBottom.Location = new System.Drawing.Point(0, 262);
     51            this.pnlPageBottom.Name = "pnlPageBottom";
     52            this.pnlPageBottom.Size = new System.Drawing.Size(456, 40);
     53            this.pnlPageBottom.TabIndex = 7;
     54            //
     55            // cmdCancel
     56            //
     57            this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     58            this.cmdCancel.Location = new System.Drawing.Point(376, 8);
     59            this.cmdCancel.Name = "cmdCancel";
     60            this.cmdCancel.Size = new System.Drawing.Size(56, 24);
     61            this.cmdCancel.TabIndex = 4;
     62            this.cmdCancel.Text = "Cancel";
     63            //
     64            // cmdOK
     65            //
     66            this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
     67            this.cmdOK.Location = new System.Drawing.Point(296, 8);
     68            this.cmdOK.Name = "cmdOK";
     69            this.cmdOK.Size = new System.Drawing.Size(64, 24);
     70            this.cmdOK.TabIndex = 3;
     71            this.cmdOK.Text = "OK";
     72            this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
     73            //
     74            // pnlDescription
     75            //
     76            this.pnlDescription.Controls.Add(this.grpDescriptionResourceGroup);
     77            this.pnlDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
     78            this.pnlDescription.Location = new System.Drawing.Point(0, 190);
     79            this.pnlDescription.Name = "pnlDescription";
     80            this.pnlDescription.Size = new System.Drawing.Size(456, 72);
     81            this.pnlDescription.TabIndex = 8;
     82            //
     83            // grpDescriptionResourceGroup
     84            //
     85            this.grpDescriptionResourceGroup.Controls.Add(this.lblDescriptionResourceGroup);
     86            this.grpDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
     87            this.grpDescriptionResourceGroup.Location = new System.Drawing.Point(0, 0);
     88            this.grpDescriptionResourceGroup.Name = "grpDescriptionResourceGroup";
     89            this.grpDescriptionResourceGroup.Size = new System.Drawing.Size(456, 72);
     90            this.grpDescriptionResourceGroup.TabIndex = 1;
     91            this.grpDescriptionResourceGroup.TabStop = false;
     92            this.grpDescriptionResourceGroup.Text = "Description";
     93            //
     94            // lblDescriptionResourceGroup
     95            //
     96            this.lblDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
     97            this.lblDescriptionResourceGroup.Location = new System.Drawing.Point(3, 16);
     98            this.lblDescriptionResourceGroup.Name = "lblDescriptionResourceGroup";
     99            this.lblDescriptionResourceGroup.Size = new System.Drawing.Size(450, 53);
     100            this.lblDescriptionResourceGroup.TabIndex = 0;
     101            this.lblDescriptionResourceGroup.Text = "Use this panel to select the Division.";
     102            //
     103            // lstDivision
     104            //
     105            this.lstDivision.Location = new System.Drawing.Point(40, 48);
     106            this.lstDivision.Name = "lstDivision";
     107            this.lstDivision.Size = new System.Drawing.Size(384, 121);
     108            this.lstDivision.TabIndex = 9;
     109            this.lstDivision.DoubleClick += new System.EventHandler(this.lstDivision_DoubleClick);
     110            //
     111            // label1
     112            //
     113            this.label1.Location = new System.Drawing.Point(40, 24);
     114            this.label1.Name = "label1";
     115            this.label1.Size = new System.Drawing.Size(240, 16);
     116            this.label1.TabIndex = 10;
     117            this.label1.Text = "Select Division:";
     118            //
     119            // DSelectDivision
     120            //
     121            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     122            this.ClientSize = new System.Drawing.Size(456, 302);
     123            this.Controls.Add(this.label1);
     124            this.Controls.Add(this.lstDivision);
     125            this.Controls.Add(this.pnlDescription);
     126            this.Controls.Add(this.pnlPageBottom);
     127            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
     128            this.Name = "DSelectDivision";
     129            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
     130            this.Text = "Select Division";
     131            this.pnlPageBottom.ResumeLayout(false);
     132            this.pnlDescription.ResumeLayout(false);
     133            this.grpDescriptionResourceGroup.ResumeLayout(false);
     134            this.ResumeLayout(false);
    134135
    135136                }
     
    165166                #region Methods
    166167
    167                 public void InitializePage(DataTable dtDivisions, string sDUZ2)
     168                public void InitializePage(DataTable dtDivisions)
    168169                {
    169170                        m_dtDivisions = dtDivisions;
    170                         m_sDUZ2 = sDUZ2;
    171171                        UpdateDialogData(true);
    172172                }
     
    181181                        if (b == true) //move member vars into controls
    182182                        {
    183                                 this.lstDivision.DataSource = m_dtDivisions;
     183                m_dtDivisions.DefaultView.Sort="DEFAULT ASC";
     184                this.lstDivision.DataSource = m_dtDivisions.DefaultView;
    184185                                lstDivision.DisplayMember = "FACILITY_NAME";
    185186                                lstDivision.ValueMember = "FACILITY_IEN";
    186                                 lstDivision.SelectedValue = m_sDUZ2;
     187                lstDivision.SelectedIndex = m_dtDivisions.DefaultView.Find(1);
    187188                        }
    188189                        else //move control data into member vars
     
    217218                private void cmdOK_Click(object sender, System.EventArgs e)
    218219                {
     220            if (lstDivision.SelectedIndex < 0) {
     221                this.lblDescriptionResourceGroup.Text="Must select a division";
     222                this.lblDescriptionResourceGroup.ForeColor = Color.Red;
     223                this.DialogResult = DialogResult.None; //forestall acceptance.
     224                return;
     225            }
    219226                        this.UpdateDialogData(false);
    220227                        return;
    221228                }
     229
     230        private void lstDivision_DoubleClick(object sender, EventArgs e)
     231        {
     232            if (lstDivision.SelectedIndex < 0) {
     233                this.lblDescriptionResourceGroup.Text = "Must select a division";
     234                this.lblDescriptionResourceGroup.ForeColor = Color.Red;
     235                return;
     236            }
     237            this.UpdateDialogData(false);
     238            this.DialogResult = DialogResult.OK;
     239            return;
     240        }
     241
     242
    222243        }
    223244}
Note: See TracChangeset for help on using the changeset viewer.