private void fillProductionStatusCumbo(int status)
        {
            try
            {
                StatusCatalogueDB.fillStatusCatalogueCombo(cmbProductionStatus, "PRODUCTIONPLAN"); // adding all status availble

                Dictionary <string, Structures.ComboBoxItem> CmbDict = new Dictionary <string, Structures.ComboBoxItem>();
                foreach (var item in cmbProductionStatus.Items)
                {
                    Structures.ComboBoxItem val = ((Structures.ComboBoxItem)item);
                    string id = ((Structures.ComboBoxItem)val).HiddenValue;
                    CmbDict.Add(id, val);
                }
                if (status == 1) // approved
                {
                    cmbProductionStatus.Items.Clear();
                    //cmbProductionStatus.Items.Add(CmbDict["2"]); //For start
                    cmbProductionStatus.Items.Add(CmbDict["3"]); //For Cancel
                    cmbProductionStatus.Items.Add(CmbDict["4"]); //For halt
                }
                else if (status == 2)                            // started
                {
                    cmbProductionStatus.Items.Clear();
                    cmbProductionStatus.Items.Add(CmbDict["99"]); //For complete
                    cmbProductionStatus.Items.Add(CmbDict["3"]);  //For cancel
                    cmbProductionStatus.Items.Add(CmbDict["4"]);  //For halt
                }
                else if (status == 4)                             //Halted
                {
                    cmbProductionStatus.Items.Clear();
                    cmbProductionStatus.Items.Add(CmbDict["5"]); //For Resume
                    cmbProductionStatus.Items.Add(CmbDict["4"]); //For Cancel
                }
                else if (status == 5)                            // Resumed
                {
                    cmbProductionStatus.Items.Clear();
                    //cmbProductionStatus.Items.Add(CmbDict["2"]); //For start
                    cmbProductionStatus.Items.Add(CmbDict["3"]);  //For Halt
                    cmbProductionStatus.Items.Add(CmbDict["4"]);  //For Cancel
                    cmbProductionStatus.Items.Add(CmbDict["99"]); //For complete
                }
            }
            catch (Exception ex)
            {
            }
            if (status.Equals("1"))
            {
                cmbProductionStatus.Items.Add("2-Halted");
                cmbProductionStatus.Items.Add("3-Canceled");
                cmbProductionStatus.Items.Add("99-Completed");
            }
            else if (status.Equals("2"))
            {
                cmbProductionStatus.Items.Add("1-Production Stage");
            }
        }
Beispiel #2
0
        //grid
        private void showProjectDataGridView()
        {
            try
            {
                frmPopup = new Form();
                frmPopup.StartPosition = FormStartPosition.CenterScreen;
                frmPopup.BackColor     = Color.CadetBlue;

                frmPopup.MaximizeBox     = false;
                frmPopup.MinimizeBox     = false;
                frmPopup.ControlBox      = false;
                frmPopup.FormBorderStyle = FormBorderStyle.FixedSingle;
                frmPopup.Size            = new Size(850, 370);



                Label lblstat = new Label();
                lblstat.Location  = new System.Drawing.Point(10, 5);
                lblstat.AutoSize  = true;
                lblstat.Text      = "Search by Status";
                lblstat.Font      = new System.Drawing.Font("Microsoft Sans Serif", 9, FontStyle.Bold);
                lblstat.ForeColor = Color.Black;
                frmPopup.Controls.Add(lblstat);



                cmbprojectstat          = new ComboBox();
                cmbprojectstat.Size     = new Size(200, 18);
                cmbprojectstat.Location = new System.Drawing.Point(160, 3);

                cmbprojectstat.DropDownStyle = ComboBoxStyle.DropDownList;
                StatusCatalogueDB.fillStatusCatalogueCombo(cmbprojectstat, "PROJECT");
                cmbprojectstat.Items.Add("All");
                cmbprojectstat.SelectedIndexChanged += new System.EventHandler(this.cmbprojectstatchanged);
                cmbprojectstat.SelectedIndex         = cmbprojectstat.FindString("Approved");
                frmPopup.Controls.Add(cmbprojectstat);

                Label lblSearch = new Label();
                lblSearch.Location  = new System.Drawing.Point(450, 5);
                lblSearch.AutoSize  = true;
                lblSearch.Text      = "Search by Name";
                lblSearch.Font      = new System.Drawing.Font("Microsoft Sans Serif", 9, FontStyle.Bold);
                lblSearch.ForeColor = Color.Black;
                frmPopup.Controls.Add(lblSearch);

                txtSearch              = new TextBox();
                txtSearch.Size         = new Size(220, 18);
                txtSearch.Location     = new System.Drawing.Point(600, 3);
                txtSearch.Font         = new System.Drawing.Font("Microsoft Sans Serif", 9, FontStyle.Regular);
                txtSearch.ForeColor    = Color.Black;
                txtSearch.TextChanged += new System.EventHandler(this.txtSearch_TextChangedInDocGridList);
                txtSearch.TabIndex     = 0;
                txtSearch.Focus();
                frmPopup.Controls.Add(txtSearch);

                Button lvOK = new Button();
                lvOK.BackColor = Color.Tan;
                lvOK.Text      = "OK";
                lvOK.Location  = new System.Drawing.Point(20, 335);
                lvOK.Click    += new System.EventHandler(this.grddocOK_Click1);
                frmPopup.Controls.Add(lvOK);

                Button lvCancel = new Button();
                lvCancel.Text      = "CANCEL";
                lvCancel.BackColor = Color.Tan;
                lvCancel.Location  = new System.Drawing.Point(110, 335);
                lvCancel.Click    += new System.EventHandler(this.grdCancel_Click1);
                frmPopup.Controls.Add(lvCancel);
                frmPopup.ShowDialog();
            }
            catch (Exception ex)
            {
            }
        }