2015-04-04 46 views
-1

以下代碼在文件結尾處給出預期的錯誤#endregion指令。我已經身體檢查過,但所有}都匹配。#endregion指令預期但是}匹配

namespace Labour 
{ 
    public partial class frm_GP_ProjectLPO : Form 
    { 
     #region PublicVariables 
     // int inNarrationCount = 0; 
     // string strCashOrParty = string.Empty; 
     // string strPrefix = string.Empty; 
     // string strSuffix = string.Empty; 
     // string strVoucherNo = string.Empty; 
     // string strOrderNo = string.Empty; 
     // string strBarcode = string.Empty; 
     // string strStatus = string.Empty; 
     // //ArrayList lstArrOfRemove = new ArrayList(); 
     // string tableName = "PurchaseOrderMaster"; 
     // string strProductCode = string.Empty; 
     // public static bool isEdit = false; 
     decimal decPurchaseOrderMasterId = 0; 
     decimal decPurchaseOrderDetailId = 0; 
     decimal decPurchaseOrderMasterIdentity = 0; 
     decimal decPurchaseSuffixPrefixId = 0; 
     decimal decPurchaseOrderTypeId = 0; 
     decimal decPurchaseVoucherId = 0; 
     decimal decCurrentRate = 0; 
     decimal decCurrentConversionRate = 0; 
     // bool isValueChange = true; 
     bool isAutomatic = false; 
     // bool isValueChanged = false; 
     // bool isDoAfterGridFill = true; 
     // bool isAmountcalc = true; 
     // bool isCheck = false; 
     // frmLedgerPopup frmLedgerPopupObj; 
     // frmProductSearchPopup frmProductSearchPopupObj; 
     // DataGridViewTextBoxEditingControl TextBoxControl; 
     // frmPurchaseOrderRegister frmPurchaseOrderRegisterObj; 
     // frmPurchaseOrderReport frmPurchaseOrderReportObj; 
     // frmVoucherSearch objVoucherSearch = null; 
     // frmDayBook frmDayBookObj = null; 
     // frmVoucherWiseProductSearch objfrmVoucherproduct = null; 
     // TransactionsGeneralFill TransactionGeneralFillObj = new TransactionsGeneralFill(); 
     // AutoCompleteStringCollection ProductNames = new AutoCompleteStringCollection(); 
     // AutoCompleteStringCollection ProductCodes = new AutoCompleteStringCollection(); 
     // DataTable dtblunitconversionViewAll = new DataTable(); 
     // DataTable dtbl = new DataTable(); 
     // #endregion 
     // #region Functions 




     string fileName = "", fileSaveDir = @"C:\Docs"; 
     ProjectSP OProjectSP = new ProjectSP(); 
     CommonFunctions OCommonFunctions = new CommonFunctions(); 
     bool ISLoadComplete = false, ErrorExist = false, ISEdit = false; 
     decimal ProjectLPOID = 0; 
     public frm_GP_ProjectLPO() 
     { 
      InitializeComponent(); 
     } 
     public frm_GP_ProjectLPO(decimal projectLPOID) 
     { 
      InitializeComponent(); 
      ProjectLPOID = projectLPOID; 
     } 


     private void frm_GP_ProjectLPO_Load(object sender, EventArgs e) 
     { 
      LaodCombos(); 
      cmbLpoType.SelectedItem = "Customer"; 
      cmbSupplier.Visible = false; 
      lblSupplier.Visible = false; 
      if (ProjectLPOID > 0) 
      { 
       LoadSelectedQoutation(); 
       LoadSeletcedQuotationDetail(); 
      } 
     } 
     private void LoadSeletcedQuotationDetail() 
     { 
      dgvEmployeeDetail.DataSource = OCommonFunctions.SelectData("sp_GP_tbl_GP_ProjectLPODetailSelectForGrid", "@projetlpomasterid", ProjectLPOID.ToString()); 
     } 

     private void LaodCombos() 
     { 
      OCommonFunctions.FillCombo("ledgerName", "ledgerId", "tbl_AccountLedger where accountGroupId=26", cmbClient); 
      OCommonFunctions.FillCombo("name", "projectid", "tbl_GP_ProjectMaster where clientid = " + cmbClient.SelectedValue, cmbProject); //LoadProject 
      OCommonFunctions.FillCombo("name", "categoryid", "tbl_GP_Category ", category); 
      OCommonFunctions.FillCombo("ledgerName", "ledgerId", "tbl_AccountLedger where accountGroupId=22", cmbSupplier); 
      LoadSites(); 
      // OCommonFunctions.FillCombo("name", "siteid", "tbl_GP_SiteMaster s inner join tbl_GP_ProjectLPOMaster l on S.siteid = l.siteid and l.projectid = " + cmbProject.SelectedValue, cmbSite); //Site 

     } 
     public void LoadSites() 
     { 
      DataTable dt = OCommonFunctions.SelectData("[sp_GP_LoadSiteByProject]", "@ProjectID", Convert.ToString(cmbProject.SelectedValue)); 
      if (dt.Rows.Count > 0) 
      { 
       cmbSite.DataSource = dt; 
       cmbSite.DisplayMember = "name"; 
       cmbSite.ValueMember = "siteid"; 
      } 
     } 
     private void LoadSelectedQoutation() 
     { 

      if (ProjectLPOID > 0) 
      { 
       ProjectLPOMasterInfo oProjectLPOMasterInfo = OProjectSP.ProjectLPOMasterView(ProjectLPOID); 
       ProjectLPOID = oProjectLPOMasterInfo.projetlpomasterid; 

       try { cmbProject.SelectedValue = oProjectLPOMasterInfo.projectid; } 
       catch (Exception ex) { } 
       try { dtpDate.Value = oProjectLPOMasterInfo.date; } 
       catch (Exception ex) { } 
       try { dtpFromDate.Value = oProjectLPOMasterInfo.fromdate; } 
       catch (Exception es) { } 
       try { dtpTODate.Value = oProjectLPOMasterInfo.todate; } 
       catch (Exception ed) { } 
       try { cmbSite.SelectedValue = oProjectLPOMasterInfo.siteid; } 
       catch (Exception ex) { } 
       try { txtLPONumber.Text = oProjectLPOMasterInfo.lponumber; } 
       catch (Exception ex) { } 
       try { cmbSupplier.SelectedValue = oProjectLPOMasterInfo.supplierid; } 
       catch (Exception ex) { } 
       try 
       { 
        if (oProjectLPOMasterInfo.Lpotype == 1) 
        { 
         cmbLpoType.SelectedItem = "Customer"; 
        } 
        else 
        { 
         cmbLpoType.SelectedItem = "Supplier"; 
        } 
       } 
       catch (Exception ex) { } 
      } 
     } 



     private void btnSave_Click(object sender, EventArgs e) 
     { 
      try 
      { 
       SaveFunction(); 

       if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text)) 
       { 

        if (!ValidateData()) 
        { 
         if (!DataExist()) 
         { 
          if (Messages.SaveMessage()) 
          { 
           if (SaveProjectLPO() > 0) 
           { 
            Clear(); 
            // LoadFullEmployee(); 
            RefreshList(); 
            Messages.SavedMessage(); 
           } 

          } 
         } 
         else 
         { 
          MessageBox.Show("LPO already exist"); 
         } 
        } 
       } 
       else 
       { 
        Messages.NoPrivillageMessage(); 
       } 
      } 
      catch (Exception ex) 
      { 
       MessageBox.Show("Cus20:" + ex.Message, "EasyERP", MessageBoxButtons.OK, MessageBoxIcon.Information); 
      } 
     } 

     private void Clear() 
     { 
      //txtName.Text = ""; 
      //txtPhone.Text = ""; 
     } 
     private void RefreshList() 
     { 
      frm_GP_ProjectLPOList frm = Application.OpenForms["frm_GP_ProjectLPOList"] as frm_GP_ProjectLPOList; 
      frm.LaodFullProjectLPO(); 
     } 

     /// <summary> 
     /// Print function 
     /// </summary> 
     /// <param name="decMasterId"></param> 
     public void Print(decimal decMasterId) 
     { 
      try 
      { 
       PurchaseOrderMasterSP spPurchaseOrderMaster = new PurchaseOrderMasterSP(); 
       DataSet dsPurchaseOrder = spPurchaseOrderMaster.PurchaseOrderPrinting(decMasterId); 
       frmReport frmReport = new frmReport(); 
       frmReport.MdiParent = formMDI.MDIObj; 
       frmReport.PurchaseOrderPrinting(dsPurchaseOrder); 
      } 
      catch (Exception ex) 
      { 
       MessageBox.Show("PO14:" + ex.Message, "EasyERP", MessageBoxButtons.OK, MessageBoxIcon.Information); 
      } 
     } 
     /// <summary> 
     /// Print function for dotmatrix printer 
     /// </summary> 
     /// <param name="decMasterId"></param> 
     public void PrintForDotMatrix(decimal decMasterId) 
     { 
      try 
      { 
       DataTable dtblOtherDetails = new DataTable(); 
       CompanySP spComapany = new CompanySP(); 
       dtblOtherDetails = spComapany.CompanyViewForDotMatrix(); 
       DataTable dtblGridDetails = new DataTable(); 
       dtblGridDetails.Columns.Add("SlNo"); 
       dtblGridDetails.Columns.Add("BarCode"); 
       dtblGridDetails.Columns.Add("ProductCode"); 
       dtblGridDetails.Columns.Add("ProductName"); 
       dtblGridDetails.Columns.Add("Qty"); 
       dtblGridDetails.Columns.Add("Unit"); 
       dtblGridDetails.Columns.Add("Rate"); 
       dtblGridDetails.Columns.Add("Amount"); 
       int inRowCount = 0; 
       foreach (DataGridViewRow dRow in dgvPurchaseOrder.Rows) 
       { 
        if (!dRow.IsNewRow) 
        { 
         DataRow dr = dtblGridDetails.NewRow(); 
         dr["SlNo"] = ++inRowCount; 
         if (dRow.Cells["dgvtxtBarcode"].Value != null) 
         { 
          dr["BarCode"] = Convert.ToString(dRow.Cells["dgvtxtBarcode"].Value); 
         } 
         if (dRow.Cells["dgvtxtProductCode"].Value != null) 
         { 
          dr["ProductCode"] = Convert.ToString(dRow.Cells["dgvtxtProductCode"].Value); 
         } 
         if (dRow.Cells["dgvtxtProductName"].Value != null) 
         { 
          dr["ProductName"] = Convert.ToString(dRow.Cells["dgvtxtProductName"].Value); 
         } 
         if (dRow.Cells["dgvtxtQty"].Value != null) 
         { 
          dr["Qty"] = Convert.ToString(dRow.Cells["dgvtxtQty"].Value); 
         } 
         if (dRow.Cells["dgvcmbUnit"].Value != null) 
         { 
          dr["Unit"] = Convert.ToString(dRow.Cells["dgvcmbUnit"].FormattedValue); 
         } 
         if (dRow.Cells["dgvtxtRate"].Value != null) 
         { 
          dr["Rate"] = Convert.ToString(dRow.Cells["dgvtxtRate"].Value); 
         } 
         if (dRow.Cells["dgvtxtAmount"].Value != null) 
         { 
          dr["Amount"] = Convert.ToString(dRow.Cells["dgvtxtAmount"].Value); 
         } 
         dtblGridDetails.Rows.Add(dr); 
        } 
       } 
       dtblOtherDetails.Columns.Add("voucherNo"); 
       dtblOtherDetails.Columns.Add("date"); 
       dtblOtherDetails.Columns.Add("ledgerName"); 
       dtblOtherDetails.Columns.Add("Narration"); 
       dtblOtherDetails.Columns.Add("Currency"); 
       dtblOtherDetails.Columns.Add("TotalAmount"); 
       dtblOtherDetails.Columns.Add("DueDays"); 
       dtblOtherDetails.Columns.Add("DueDate"); 
       dtblOtherDetails.Columns.Add("CustomerAddress"); 
       dtblOtherDetails.Columns.Add("CustomerTIN"); 
       dtblOtherDetails.Columns.Add("CustomerCST"); 
       dtblOtherDetails.Columns.Add("AmountInWords"); 
       dtblOtherDetails.Columns.Add("Declaration"); 
       dtblOtherDetails.Columns.Add("Heading1"); 
       dtblOtherDetails.Columns.Add("Heading2"); 
       dtblOtherDetails.Columns.Add("Heading3"); 
       dtblOtherDetails.Columns.Add("Heading4"); 
       DataRow dRowOther = dtblOtherDetails.Rows[0]; 
       dRowOther["voucherNo"] = txtLPONumber.Text; 
       dRowOther["date"] = dtpDate.Text; 
       dRowOther["ledgerName"] = cmbSupplier.Text; 
       dRowOther["Narration"] = "LPO for a period of one month"; 
       dRowOther["Currency"] = "AED"; 
       dRowOther["TotalAmount"] = "NA"; 
       dRowOther["DueDays"] = "NA"; 
       dRowOther["DueDate"] = "NA"; 
       dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); 
       AccountLedgerSP spAccountLedger = new AccountLedgerSP(); 
       AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo(); 
       infoAccountLedger = spAccountLedger.AccountLedgerView(Convert.ToDecimal(cmbSupplier.SelectedValue)); 
       dRowOther["CustomerAddress"] = (infoAccountLedger.Address.ToString().Replace("\n", ", ")).Replace("\r", ""); 
       dRowOther["CustomerTIN"] = infoAccountLedger.Tin; 
       dRowOther["CustomerCST"] = infoAccountLedger.Cst; 
       // dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotalAmount.Text), PublicVariables._decCurrencyId); 
       VoucherTypeSP spVoucherType = new VoucherTypeSP(); 
       DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decPurchaseOrderTypeId); 
       dRowOther["Declaration"] = Convert.ToString(dtblDeclaration.Rows[0]["Declaration"]); 
       dRowOther["Heading1"] = Convert.ToString(dtblDeclaration.Rows[0]["Heading1"]); 
       dRowOther["Heading2"] = Convert.ToString(dtblDeclaration.Rows[0]["Heading2"]); 
       dRowOther["Heading3"] = Convert.ToString(dtblDeclaration.Rows[0]["Heading3"]); 
       dRowOther["Heading4"] = Convert.ToString(dtblDeclaration.Rows[0]["Heading4"]); 
       int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); 
       PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); 
      } 
      catch (Exception ex) 
      { 
       MessageBox.Show("PO15:" + ex.Message, "EasyERP", MessageBoxButtons.OK, MessageBoxIcon.Information); 
      } 
     } 


     // save function from purchaseorder.cs 

     public void SaveFunction() 
     { 
      try 
      { 
       PurchaseOrderMasterInfo infoPurchaseOrderMaster = new PurchaseOrderMasterInfo(); 
       PurchaseOrderDetailsSP spPurchaseOrderDetails = new PurchaseOrderDetailsSP(); 
       PurchaseOrderDetailsInfo infoPurchaseOrderDetails = new PurchaseOrderDetailsInfo(); 
       PurchaseOrderMasterSP spPurchaseOrderMaster = new PurchaseOrderMasterSP(); 
       ProductInfo infoProduct = new ProductInfo(); 
       ProductSP spProduct = new ProductSP(); 
       SettingsSP spSettings = new SettingsSP(); 

       infoPurchaseOrderMaster.Date = Convert.ToDateTime(dtpDate.Text); 
       infoPurchaseOrderMaster.DueDate = Convert.ToDateTime(dtpFromDate.Text); 
       infoPurchaseOrderMaster.LedgerId = Convert.ToDecimal(cmbSupplier.SelectedValue.ToString()); 
       //if (isAutomatic == true) 
       //{ 
       // infoPurchaseOrderMaster.SuffixPrefixId = decPurchaseSuffixPrefixId; 
       // infoPurchaseOrderMaster.VoucherNo = strVoucherNo; 
       //} 
       //else 
       //{ 
       // infoPurchaseOrderMaster.SuffixPrefixId = 0; 
       // infoPurchaseOrderMaster.VoucherNo = spPurchaseOrderMaster.VoucherNoMax(decPurchaseOrderTypeId); 
       //} 
       //infoPurchaseOrderMaster.VoucherTypeId = decPurchaseOrderTypeId; 
       // infoPurchaseOrderMaster.InvoiceNo = txtOrderNo.Text; 
       infoPurchaseOrderMaster.UserId = PublicVariables._decCurrentUserId; 
       infoPurchaseOrderMaster.EmployeeId = PublicVariables._decCurrentUserId;//by default current userid used as current employeeid 
       infoPurchaseOrderMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId; 
       infoPurchaseOrderMaster.Narration = "LPO from Time Sheet"; //txtNarration.Text.Trim(); 
       //infoPurchaseOrderMaster.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text); 
       // infoPurchaseOrderMaster.exchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()); 
       infoPurchaseOrderMaster.Extra1 = string.Empty; 
       infoPurchaseOrderMaster.Extra2 = string.Empty; 
       //infoPurchaseOrderMaster.DeliveryPeriod = txtDelivery.Text; 
       //infoPurchaseOrderMaster.QuotationRef = txtQuotation.Text; 
       // infoPurchaseOrderMaster.ProjectRef = txtProject.Text; 
       // infoPurchaseOrderMaster.PaymentTerms = txtTerms.Text; 
       // infoPurchaseOrderMaster.Warrenty = txtWarrenty.Text; 

       decPurchaseOrderMasterIdentity = Convert.ToDecimal(spPurchaseOrderMaster.PurchaseOrderMasterAdd(infoPurchaseOrderMaster)); 
       int inRowcount = dgvPurchaseOrder.Rows.Count; 
       for (int inI = 0; inI < inRowcount - 1; inI++) 
       { 
        infoPurchaseOrderDetails.PurchaseOrderMasterId = decPurchaseOrderMasterIdentity; 
        if (dgvPurchaseOrder.Rows[inI].Cells["dgvtxtProductCode"].Value != null && dgvPurchaseOrder.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString() != "") 
        { 
         infoProduct = spProduct.ProductViewByCode(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString()); 
         infoPurchaseOrderDetails.ProductId = infoProduct.ProductId; 
        } 
        if (dgvPurchaseOrder.Rows[inI].Cells["dgvtxtQty"].Value != null && dgvPurchaseOrder.Rows[inI].Cells["dgvtxtQty"].Value.ToString() != "") 
        { 
         infoPurchaseOrderDetails.Qty = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtQty"].Value.ToString()); 
        } 
        if (dgvPurchaseOrder.Rows[inI].Cells["dgvcmbUnit"].Value != null && dgvPurchaseOrder.Rows[inI].Cells["dgvcmbUnit"].Value.ToString() != "") 
        { 
         infoPurchaseOrderDetails.UnitId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvcmbUnit"].Value); 
         infoPurchaseOrderDetails.UnitConversionId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtUnitConversionId"].Value.ToString()); 
        } 
        infoPurchaseOrderDetails.Rate = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtRate"].Value.ToString()); 
        infoPurchaseOrderDetails.Amount = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtAmount"].Value.ToString()); 
        infoPurchaseOrderDetails.SlNo = Convert.ToInt32(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtSlNo"].Value.ToString()); 
        infoPurchaseOrderDetails.Extra1 = string.Empty; 
        infoPurchaseOrderDetails.Extra2 = string.Empty; 
        spPurchaseOrderDetails.PurchaseOrderDetailsAdd(infoPurchaseOrderDetails); 
       } 
       Messages.SavedMessage(); 

       if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix") 
       { 
        PrintForDotMatrix(decPurchaseOrderMasterIdentity); 
       } 
       else 
       { 
        Print(decPurchaseOrderMasterIdentity); 
       } 

       Clear(); 
      } 
      catch (Exception ex) 
      { 
       MessageBox.Show("PO35:" + ex.Message, "EasyERP", MessageBoxButtons.OK, MessageBoxIcon.Information); 
      } 
     } 

     // Save function from purchaseorser.cs ends 
     private decimal SaveProjectLPO() 
     { 
      decimal projectLPOID = 0; 
      ProjectLPOMasterInfo oProjectLPOMasterInfo = new ProjectLPOMasterInfo(); 
      oProjectLPOMasterInfo.projetlpomasterid = ProjectLPOID; 
      try { oProjectLPOMasterInfo.projectid = Convert.ToDecimal(cmbProject.SelectedValue); } 
      catch (Exception ex) { } 
      oProjectLPOMasterInfo.date = dtpDate.Value; 
      oProjectLPOMasterInfo.fromdate = dtpFromDate.Value; 
      oProjectLPOMasterInfo.todate = dtpTODate.Value; 
      oProjectLPOMasterInfo.lponumber = txtLPONumber.Text; 
      try { oProjectLPOMasterInfo.siteid = Convert.ToDecimal(cmbSite.SelectedValue); } 
      catch (Exception ex) { } 
      try { oProjectLPOMasterInfo.supplierid = cmbLpoType.SelectedItem.ToString() == "Customer" ? 0 : Convert.ToDecimal(cmbSupplier.SelectedValue); } 
      catch (Exception ex) { } 
      try { oProjectLPOMasterInfo.filename = fileName; } 
      catch (Exception ex) { } 
      try 
      { 
       if (cmbLpoType.SelectedItem.ToString() == "Customer") 
       { 
        oProjectLPOMasterInfo.Lpotype = 1; 
       } 
       else 
       { 
        oProjectLPOMasterInfo.Lpotype = 2; 
       } 
      } 
      catch (Exception ex) { } 

      bool isEdit = false; 
      if (oProjectLPOMasterInfo.projetlpomasterid > 0) 
      { 
       isEdit = true; 
      } 

      projectLPOID = OProjectSP.ProjectLPOMasterAddOREdit(oProjectLPOMasterInfo, isEdit); 
      if (projectLPOID > 0) 
      { 
       bool isSaved = SaveLPODetail(projectLPOID); 
      } 

      return projectLPOID; 
     } 

     private bool SaveLPODetail(decimal projectLPOID) 
     { 

      decimal projectLPODetailID = 0; 
      bool isEdit = false; 

      foreach (DataGridViewRow dr in dgvEmployeeDetail.Rows) 
      { 
       ProjectLPODetailInfo oProjectLPODetailInfo = new ProjectLPODetailInfo(); 
       oProjectLPODetailInfo.projetlpomasterid = projectLPOID; 
       if (dr.Index != dgvEmployeeDetail.Rows.Count - 1) 
       { 
        try { oProjectLPODetailInfo.projectlpodetailid = Convert.ToDecimal(dr.Cells["projectDetailID"].Value); } 
        catch (Exception ex) { } 
        oProjectLPODetailInfo.categoryid = Convert.ToDecimal(dr.Cells["category"].Value); 
        try { oProjectLPODetailInfo.nooflabour = Convert.ToInt32(dr.Cells["NumberOFEmployee"].Value); } 
        catch (Exception ex) { } 
        try { oProjectLPODetailInfo.rate = Convert.ToDecimal(dr.Cells["reatePerHour"].Value); } 
        catch (Exception ex) { } 


        if (oProjectLPODetailInfo.projectlpodetailid > 0) 
        { 
         isEdit = true; 
        } 
        else 
        { 
         isEdit = false; 
        } 
        projectLPODetailID = OProjectSP.ProjectLPODetailAddOREdit(oProjectLPODetailInfo, isEdit); 
        if (projectLPODetailID <= 0) 
        { 
         break; 
        } 
       } 

      } 
      if (projectLPODetailID > 0) 
      { 
       return true; 
      } 
      else 
      { 
       return false; 
      } 

     } 

     private bool DataExist() 
     { 
      return false; 
     } 

     private bool ValidateData() 
     { 
      //if (txtName.Text.Trim() == string.Empty) 
      //{ 
      // Messages.InformationMessage("Enter employee name "); 
      // txtName.Focus(); 
      // return true; 
      //} 
      return false; 
     } 

     private void btnClear_Click(object sender, EventArgs e) 
     { 
      Clear(); 
     } 

     private void btnClose_Click(object sender, EventArgs e) 
     { 
      this.Close(); 
     } 

     private void btnSelect_Click(object sender, EventArgs e) 
     { 


      OpenFileDialog openFileDialog = new OpenFileDialog(); 
      openFileDialog.CheckFileExists = true; 
      openFileDialog.AddExtension = true; 
      openFileDialog.Multiselect = false; 
      string fileNewPath = ""; 
      openFileDialog.Filter = "PDF files (*.pdf)|*.pdf|JPEG Files (*.jpeg)|*.jpeg|JPG Files (*.jpg)|*.jpg"; 

      if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) 
      { 
       foreach (string fileNamepath in openFileDialog.FileNames) 
       { 
        txtFilename.Text = fileNamepath; 

       } 
      } 
      if (!String.IsNullOrEmpty(txtFilename.Text)) 
      { 
       fileName = Path.GetFileName(txtFilename.Text.Trim()); 
       fileName = txtLPONumber.Text + fileName; 
       fileNewPath = Path.Combine(fileSaveDir, fileName); 
       File.Copy(txtFilename.Text.Trim(), fileNewPath); 
      } 
      } 
      private bool SaveFile() 
      { 
      //if (txtName.Text.Trim() == string.Empty) 
      //{ 
      // Messages.InformationMessage("Enter employee name "); 
      // txtName.Focus(); 
      // return true; 
      //} 
      return false; 
     } 




     private void btnPrint_Click(object sender, EventArgs e) 
     { 
      try 
      { 
       DataSet dsLPODetails = OProjectSP.ProjectLPODetails(ProjectLPOID); 
       frmReport frmReport = new frmReport(); 
       frmReport.MdiParent = formMDI.MDIObj; 
       frmReport.ProjectLPOPrint(dsLPODetails); 
      } 
      catch (Exception ex) 
      { 
       MessageBox.Show("PO14:" + ex.Message, "EasyERP", MessageBoxButtons.OK, MessageBoxIcon.Information); 
      } 
     } 

     private void cmbProject_SelectedIndexChanged(object sender, EventArgs e) 
     { 
      cmbSite.DataSource = null; 
      if (cmbProject.SelectedIndex != -1) 
      { 
       if (cmbProject.SelectedValue.ToString() != "System.Data.DataRowView") 
       { 
        // cmbSite.DataSource = null; 
        LoadSites(); 
       } 
      } 
     } 

     private void cmbSite_SelectedIndexChanged(object sender, EventArgs e) 
     { 

     } 

     private void cmbClient_SelectedIndexChanged(object sender, EventArgs e) 
     { 
      if (cmbClient.SelectedValue.ToString() != "System.Data.DataRowView") 
      { 
       cmbProject.DataSource = null; 
       OCommonFunctions.FillCombo("name", "projectid", "tbl_GP_ProjectMaster where clientid = " + cmbClient.SelectedValue, cmbProject); 
      } 
     } 

     private void groupBox1_Enter(object sender, EventArgs e) 
     { 

     } 

     private void cmbLpoType_SelectedIndexChanged(object sender, EventArgs e) 
     { 
      if (cmbLpoType.SelectedItem.ToString() == "Supplier") 
      { 
       cmbSupplier.Visible = true; 
       lblSupplier.Visible = true; 
      } 
      else 
      { 
       cmbSupplier.Visible = false; 
       lblSupplier.Visible = false; 

      } 
     } 


    } 

} 

我試過重新啓動IDE,重新打開解決方案等,但它沒有工作。

+2

#endregion與#區域不匹配與} – Steve 2015-04-04 08:34:27

回答

1

在第3行,啓動了#region,但在第43行,匹配#endregion被註釋掉。

3

正如消息說 - 你缺少

#endregion 
在你的代碼

權開始的時候,有一個開放

#region 

是永遠不會關閉。

1

你們班開始用#region

public partial class frm_GP_ProjectLPO : Form 
{ 
    #region PublicVariables 
    . 
    . 
    . 

所以你需要一個匹配`#endregion」下面:

. 
    . 
    . 
    #endregion 
    . 
    . 
    . 
} 

,如果你想,你可以添加的區域名稱。

1

對於每個#地區標籤,您需要關閉#endregion標籤。您正在使用

#region PublicVariables 

但不能與#endregion關閉它(它被關閉,但它註釋掉)

更多的信息在這裏MSDN Region C#

+0

謝謝史蒂夫和Kyriacoss ..它的工作正常 – 2015-04-04 09:28:29