コード例 #1
0
        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");
            }
        }
コード例 #2
0
ファイル: StatusCatalogue.cs プロジェクト: suhasrake/CSLERP
        ////private void Form1_Load(object sender, EventArgs e)
        ////{
        ////    try
        ////    {
        ////        ListDocEmpMapping();
        ////    }
        ////    catch (Exception)
        ////    {

        ////    }

        ////}
        private void ListStatCatalogues()
        {
            try
            {
                grdList.Rows.Clear();
                StatusCatalogueDB      dbrecord        = new StatusCatalogueDB();
                List <statuscatalogue> StatusCatalogue = dbrecord.getStatusCatalogue();
                foreach (statuscatalogue stat in StatusCatalogue)
                {
                    grdList.Rows.Add(stat.Rowid, stat.DocumentID, stat.DocumentName,
                                     stat.ID, stat.Description, setstatus(stat.Status));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            enableBottomButtons();
            pnlDocumentList.Visible = true;
        }
コード例 #3
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)
            {
            }
        }
コード例 #4
0
ファイル: StatusCatalogue.cs プロジェクト: suhasrake/CSLERP
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                statuscatalogue   sc   = new statuscatalogue();
                StatusCatalogueDB SCDB = new StatusCatalogueDB();

                if (txtID.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Fill Status ID.");
                }
                try
                {
                    string[] docmts = txtDocument.Text.Split('-');
                    sc.Rowid       = rowid;
                    sc.DocumentID  = docmts[1].Trim();
                    sc.ID          = Convert.ToInt32(txtID.Text.Trim());
                    sc.Description = txtDescription.Text.Trim().Replace("'", "''");
                }
                catch (Exception)
                {
                    sc.DocumentID  = "";
                    sc.ID          = 0;
                    sc.Description = "";
                    sc.Rowid       = 0;
                }

                sc.Status = getstatus(cmbStatus.SelectedItem.ToString());
                System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button;
                string btnText = btn.Text;
                if (btnText.Equals("Update"))
                {
                    if (SCDB.updateStatusCatalogue(sc))
                    {
                        MessageBox.Show("Status Catalogue Status updated");
                        closeAllPanels();
                        ListStatCatalogues();
                    }
                    else
                    {
                        MessageBox.Show("Failed to update Status Catalogue");
                    }
                }
                else if (btnText.Equals("Save"))
                {
                    if (SCDB.validateDocument(sc))
                    {
                        if (SCDB.insertStatusCatalogue(sc))
                        {
                            MessageBox.Show("Status Catalogue data Added");
                            closeAllPanels();
                            ListStatCatalogues();
                        }
                        else
                        {
                            MessageBox.Show("Failed to Insert Status Catalogue");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Data Validation failed");
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Failed Adding / Editing User Data");
            }
        }