Exemple #1
0
        private void grdList_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                // pnlActionButtons.Visible = false;
                lblActionHeader.Visible = false;
                if (e.RowIndex < 0)
                {
                    return;
                }
                string columnName = grdList.Columns[e.ColumnIndex].Name;
                if (columnName.Equals("Edit") || columnName.Equals("Approve") || columnName.Equals("LoadDocument") ||
                    columnName.Equals("View") || columnName.Equals("ViewDocument"))
                {
                    clearData();
                    setButtonVisibility(columnName);
                    prevsitem = new stockitem3();
                    int rowID = e.RowIndex;
                    try
                    {
                        prevsitem.StockItemID    = grdList.Rows[e.RowIndex].Cells["StockItemID"].Value.ToString();
                        prevsitem.Name           = grdList.Rows[e.RowIndex].Cells["Description"].Value.ToString();
                        prevsitem.documentStatus = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["DocumentStatus"].Value.ToString());
                        prevsitem.CreateUser     = grdList.Rows[e.RowIndex].Cells["CreateUser"].Value.ToString();
                        prevsitem.ForwarderList  = grdList.Rows[e.RowIndex].Cells["ForwarderLists"].Value.ToString();
                    }
                    catch (Exception ez)
                    {
                    }
                    //--------Load Documents
                    if (columnName.Equals("LoadDocument"))
                    {
                        string hdrString = "StockItemID" + prevsitem.StockItemID + "\n" +
                                           "StockItem name:" + prevsitem.Name;
                        string dicDir = Main.documentDirectory + "\\" + docID;
                        string subDir = prevsitem.StockItemID + "-" + prevsitem.Name;
                        FileManager.LoadDocuments load = new FileManager.LoadDocuments(dicDir, subDir, docID, hdrString);
                        load.ShowDialog();
                        this.RemoveOwnedForm(load);
                        btnCancel_Click_1(null, null);
                        return;
                    }
                    //--------
                    if (columnName.Equals("ViewDocument"))
                    {
                        return;
                    }
                    btnSave.Text = "Update";

                    //dtDate.Value = DateTime.Parse(grdList.Rows[e.RowIndex].Cells[0].Value.ToString());
                    txtStockItemID.Text           = grdList.Rows[e.RowIndex].Cells[0].Value.ToString();
                    txtName.Text                  = grdList.Rows[e.RowIndex].Cells[1].Value.ToString();
                    txtReorderLevel.Text          = grdList.Rows[e.RowIndex].Cells[2].Value.ToString();
                    cmbGroup1Select.SelectedIndex = cmbGroup1Select.FindString(grdList.Rows[e.RowIndex].Cells["Group1Code"].Value.ToString());
                    cmbGroup2Select.SelectedIndex = cmbGroup2Select.FindString(grdList.Rows[e.RowIndex].Cells["Group2Code"].Value.ToString());
                    cmbGroup3Select.SelectedIndex = cmbGroup3Select.FindString(grdList.Rows[e.RowIndex].Cells["Group3Code"].Value.ToString());
                    cmbUnit.SelectedIndex         = cmbUnit.FindStringExact(grdList.Rows[e.RowIndex].Cells["Unit"].Value.ToString());
                    if (columnName.Equals("Approve"))
                    {
                        string gd1 = cmbGroup1Select.SelectedItem.ToString().Trim().Substring(0, cmbGroup1Select.SelectedItem.ToString().Trim().IndexOf('-'));
                        string gd2 = cmbGroup2Select.SelectedItem.ToString().Trim().Substring(0, cmbGroup2Select.SelectedItem.ToString().Trim().IndexOf('-'));
                        string gd3 = cmbGroup3Select.SelectedItem.ToString().Trim().Substring(0, cmbGroup3Select.SelectedItem.ToString().Trim().IndexOf('-'));
                        string itc = gd1 + gd2 + gd3;
                        id = CreateStockItemID(itc);
                    }
                }
                pnlCVINRInner.Visible = true;
                pnlCVINROuter.Visible = true;
                pnlList.Visible       = false;
            }
            catch (Exception ex)
            {
            }
        }
Exemple #2
0
        //private void btnSave_Click(object sender, EventArgs e)
        //{


        //}

        private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                // pnlActionButtons.Visible = false;
                lblActionHeader.Visible = false;
                if (e.RowIndex < 0)
                {
                    return;
                }
                string columnName = grdList.Columns[e.ColumnIndex].Name;
                if (columnName.Equals("Edit") || columnName.Equals("TempEdit") || columnName.Equals("Approve") || columnName.Equals("LoadDocument") ||
                    columnName.Equals("View") || columnName.Equals("ViewDocument"))
                {
                    clearData();
                    setButtonVisibility(columnName);
                    prevaccode = new accountcode();
                    int rowID = e.RowIndex;

                    try
                    {
                        prevaccode.AccountCode    = grdList.Rows[e.RowIndex].Cells["AccCode"].Value.ToString();
                        prevaccode.Name           = grdList.Rows[e.RowIndex].Cells["AccName"].Value.ToString();
                        prevaccode.documentStatus = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["DocumentStatus"].Value.ToString());
                        prevaccode.CreateUser     = grdList.Rows[e.RowIndex].Cells["CreateUser"].Value.ToString();
                        prevaccode.ForwarderList  = grdList.Rows[e.RowIndex].Cells["ForwarderLists"].Value.ToString();
                    }
                    catch (Exception ez)
                    {
                    }
                    //--------Load Documents
                    if (columnName.Equals("LoadDocument"))
                    {
                        string hdrString = "Account NO" + prevaccode.AccountCode + "\n" +
                                           "Account name:" + prevaccode.Name;
                        string dicDir = Main.documentDirectory + "\\" + docID;
                        string subDir = prevaccode.AccountCode + "-" + prevaccode.Name;
                        FileManager.LoadDocuments load = new FileManager.LoadDocuments(dicDir, subDir, docID, hdrString);
                        load.ShowDialog();
                        this.RemoveOwnedForm(load);
                        btnCancel_Click_1(null, null);
                        return;
                    }
                    //--------
                    if (columnName.Equals("ViewDocument"))
                    {
                        return;
                    }

                    if (columnName.Equals("TempEdit"))
                    {
                        cmbStatus.Visible = true;
                        lblStatus.Visible = true;
                        isTempEditCLick   = true;
                    }
                    else
                    {
                        isTempEditCLick   = false;
                        cmbStatus.Visible = false;
                        lblStatus.Visible = false;
                    }
                    btnSave.Text = "Update";

                    //dtDate.Value = DateTime.Parse(grdList.Rows[e.RowIndex].Cells[0].Value.ToString());
                    txtAccCode.Text = grdList.Rows[e.RowIndex].Cells[0].Value.ToString();
                    txtName.Text    = grdList.Rows[e.RowIndex].Cells[1].Value.ToString();

                    string grp1 = grdList.Rows[e.RowIndex].Cells["GroupLevel1"].Value.ToString();
                    cmbGroup1Select.SelectedIndex = grp1.Length == 0 ? -1 : cmbGroup1Select.FindString(grp1);

                    string grp2 = grdList.Rows[e.RowIndex].Cells["GroupLevel2"].Value.ToString();
                    cmbGroup2Select.SelectedIndex = grp2.Length == 0 ? -1 : cmbGroup2Select.FindString(grp2);

                    string grp3 = grdList.Rows[e.RowIndex].Cells["GroupLevel3"].Value.ToString();
                    cmbGroup3Select.SelectedIndex = grp3.Length == 0 ? -1 : cmbGroup3Select.FindString(grp3);

                    string grp4 = grdList.Rows[e.RowIndex].Cells["GroupLevel4"].Value.ToString();
                    cmbGroup4Select.SelectedIndex = grp4.Length == 0 ? -1 : cmbGroup4Select.FindString(grp4);

                    string grp5 = grdList.Rows[e.RowIndex].Cells["GroupLevel5"].Value.ToString();
                    cmbGroup5Select.SelectedIndex = grp5.Length == 0 ? -1 : cmbGroup5Select.FindString(grp5);

                    cmbStatus.SelectedIndex =
                        cmbStatus.FindString(getstatusString(Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["Status"].Value)));
                    if (columnName.Equals("Approve"))
                    {
                        string gd1 = cmbGroup1Select.SelectedItem.ToString().Trim().Substring(0, cmbGroup1Select.SelectedItem.ToString().Trim().IndexOf('-'));
                        string gd2 = cmbGroup2Select.SelectedItem.ToString().Trim().Substring(0, cmbGroup2Select.SelectedItem.ToString().Trim().IndexOf('-'));
                        string gd3 = cmbGroup3Select.SelectedItem.ToString().Trim().Substring(0, cmbGroup3Select.SelectedItem.ToString().Trim().IndexOf('-'));
                        string gd4 = cmbGroup4Select.SelectedItem.ToString().Trim().Substring(0, cmbGroup4Select.SelectedItem.ToString().Trim().IndexOf('-'));
                        string gd5 = cmbGroup5Select.SelectedItem.ToString().Trim().Substring(0, cmbGroup5Select.SelectedItem.ToString().Trim().IndexOf('-'));
                        string itc = gd1 + gd2 + gd3 + gd4 + gd5;
                        id = CreateAccountID(itc);
                    }
                    pnlCVINRInner.Visible = true;
                    pnlCVINROuter.Visible = true;
                    pnlList.Visible       = false;
                }
                else
                {
                    return;
                }
                ////pnlCVINRInner.Visible = true;
                ////pnlCVINROuter.Visible = true;
                ////pnlList.Visible = false;
            }
            catch (Exception ex)
            {
                setButtonVisibility("init");
            }
        }
 private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex < 0)
         {
             return;
         }
         string columnName = grdList.Columns[e.ColumnIndex].Name;
         if (columnName.Equals("Finalize") || columnName.Equals("Edit") || columnName.Equals("View") || columnName.Equals("LoadDocument"))
         {
             clearData();
             setButtonVisibility(columnName);
             docID = grdList.Rows[e.RowIndex].Cells[0].Value.ToString();
             int rowID = e.RowIndex;
             btnSave.Text = "Update";
             DataGridViewRow row = grdList.Rows[rowID];
             prevsptheader               = new producttesttemplateheader();
             prevsptheader.DocumentID    = grdList.Rows[e.RowIndex].Cells["gDocumentID"].Value.ToString();
             prevsptheader.TemplateNo    = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["TemplateNo"].Value.ToString());
             prevsptheader.TemplateDate  = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["TemplateDate"].Value.ToString());
             prevsptheader.StockItemID   = grdList.Rows[e.RowIndex].Cells["StockItemID"].Value.ToString();
             prevsptheader.StockItemName = grdList.Rows[e.RowIndex].Cells["StockItemName"].Value.ToString();
             prevsptheader.ModelNo       = grdList.Rows[e.RowIndex].Cells["ModelNo"].Value.ToString();
             prevsptheader.ModelName     = grdList.Rows[e.RowIndex].Cells["ModelName"].Value.ToString();
             if (columnName.Equals("LoadDocument"))
             {
                 string hdrString = "Document Template No:" + prevsptheader.TemplateNo + "\n" +
                                    "Template Date:" + prevsptheader.TemplateDate.ToString("dd-MM-yyyy");
                 //poheader po =PurchaseOrderDB.getPODetailForMR(prevpoh.PONo, prevpoh.PODate);
                 string dicDir = Main.documentDirectory + "\\" + docID;
                 string subDir = prevsptheader.TemplateNo + "-" + prevsptheader.TemplateDate.ToString("yyyyMMddhhmmss");
                 FileManager.LoadDocuments load = new FileManager.LoadDocuments(dicDir, subDir, docID, hdrString);
                 load.ShowDialog();
                 this.RemoveOwnedForm(load);
                 btnCancel_Click_2(null, null);
                 return;
             }
             txtTemplateNo.Text  = prevsptheader.TemplateNo.ToString();
             txtStockItemId.Text = prevsptheader.StockItemID + "-" + prevsptheader.StockItemName;
             txtModelName.Text   = prevsptheader.ModelName;
             txtModelNo.Text     = prevsptheader.ModelNo;
             //+ "-" +prevsptheader.StockItemName;
             dtTemplateDate.Value = prevsptheader.TemplateDate;
             List <producttesttemplatedetail> pttempd = ProductTestTemplateDB.getProductTestTempDetail(prevsptheader);
             grdProductTestDetail.Rows.Clear();
             int i = 0;
             foreach (producttesttemplatedetail pttempdetail in pttempd)
             {
                 if (!AddProductTestTemDetailRow())
                 {
                     MessageBox.Show("Error found in Prod Temp Detail. Please correct before updating the details");
                 }
                 else
                 {
                     grdProductTestDetail.Rows[i].Cells["SINo"].Value = pttempdetail.SlNo;
                     grdProductTestDetail.Rows[i].Cells["TestDescriptionID"].Value = pttempdetail.TestDescriptionID;
                     grdProductTestDetail.Rows[i].Cells["TestDescription"].Value   = pttempdetail.TestDescription;
                     grdProductTestDetail.Rows[i].Cells["ExpectedResult"].Value    = pttempdetail.ExpectedResult;
                     grdProductTestDetail.Rows[i].Cells["Remark"].Value            = pttempdetail.Remark;
                     i++;
                 }
             }
             if (!verifyAndReworkProdDetailGridRows())
             {
                 MessageBox.Show("Error found in Product Templete details. Please correct before updating the details");
             }
             btnSave.Text       = "Update";
             pnlList.Visible    = false;
             pnlAddEdit.Visible = true;
             btnSave.Text       = "Update";
             pnlList.Visible    = false;
             pnlAddEdit.Visible = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
     }
 }
Exemple #4
0
        private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                string columnName = grdList.Columns[e.ColumnIndex].Name;
                if (columnName.Equals("Edit") || columnName.Equals("Approve") || columnName.Equals("LoadDocument") ||
                    columnName.Equals("View"))
                {
                    clearData();
                    setButtonVisibility(columnName);
                    // QIHeaderDB qidb = new QIHeaderDB();
                    int rowID = e.RowIndex;
                    btnSave.Text = "Update";
                    DataGridViewRow row = grdList.Rows[rowID];
                    prevpmodel               = new productmodels();
                    prevpmodel.rowID         = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["RowID"].Value.ToString());
                    prevpmodel.StockItemID   = grdList.Rows[e.RowIndex].Cells["StockItem"].Value.ToString();
                    prevpmodel.StockItemName = grdList.Rows[e.RowIndex].Cells["StockItemName"].Value.ToString();
                    prevpmodel.ModelNo       = grdList.Rows[e.RowIndex].Cells["ModelNo"].Value.ToString();
                    prevpmodel.ModelName     = grdList.Rows[e.RowIndex].Cells["ModelName"].Value.ToString();
                    prevpmodel.Remarks       = grdList.Rows[e.RowIndex].Cells["Remarks"].Value.ToString();
                    //--------Load Documents
                    if (columnName.Equals("LoadDocument"))
                    {
                        string hdrString = "Model No:" + prevpmodel.ModelNo + "\n" +
                                           "Model Detail:" + prevpmodel.ModelName + "\n" +
                                           "Product ID:" + prevpmodel.StockItemID + "\n" +
                                           "Product Name:" + prevpmodel.StockItemName;
                        string dicDir = Main.documentDirectory + "\\" + docID;
                        string subDir = prevpmodel.StockItemID + "-" + prevpmodel.ModelNo;
                        FileManager.LoadDocuments load = new FileManager.LoadDocuments(dicDir, subDir, docID, hdrString);
                        load.ShowDialog();
                        this.RemoveOwnedForm(load);
                        btnCancel_Click_2(null, null);
                        return;
                    }
                    //--------
                    prevpmodel.Status         = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["gStatus"].Value.ToString());
                    prevpmodel.CreateTime     = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["gCreateTime"].Value.ToString());
                    prevpmodel.CreateUser     = grdList.Rows[e.RowIndex].Cells["gCreateUser"].Value.ToString();
                    prevpmodel.CreatorName    = grdList.Rows[e.RowIndex].Cells["Creator"].Value.ToString();
                    prevpmodel.ForwardUser    = grdList.Rows[e.RowIndex].Cells["ForwardUser"].Value.ToString();
                    prevpmodel.ApproveUser    = grdList.Rows[e.RowIndex].Cells["ApproveUser"].Value.ToString();
                    prevpmodel.DocumentStatus = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["DocumentStatusNo"].Value.ToString());
                    prevpmodel.ForwarderName  = grdList.Rows[e.RowIndex].Cells["Forwarder"].Value.ToString();
                    prevpmodel.ApproverName   = grdList.Rows[e.RowIndex].Cells["Approver"].Value.ToString();
                    prevpmodel.ForwarderList  = grdList.Rows[e.RowIndex].Cells["Forwarders"].Value.ToString();
                    txtModelName.Text         = prevpmodel.ModelName.ToString();
                    txtModelNo.Text           = prevpmodel.ModelNo.ToString();
                    txtRemarks.Text           = prevpmodel.Remarks;
                    txtStockItemID.Text       = prevpmodel.StockItemID + "-" + prevpmodel.StockItemName;
                    btnSave.Text       = "Update";
                    pnlList.Visible    = false;
                    pnlAddEdit.Visible = true;

                    btnSave.Text            = "Update";
                    pnlList.Visible         = false;
                    pnlAddEdit.Visible      = true;
                    tabControl1.SelectedTab = tabProductModel;
                    tabControl1.Visible     = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
        }