示例#1
0
        /*MDataset, документы на складе 
         по номеру периода, подгрузка построчно нужна*/
        public bool FillTableStockDocuments(MDataSet.ReceiptMasterDataTable source, int numPeriods)
        {
         
            MDataSet.ReceiptMasterDataTable _tmpMaster = new MDataSet.ReceiptMasterDataTable();
          //  MDataSet.ReceiptDetailDataTable _tmpDetail = new MDataSet.ReceiptDetailDataTable();
            try
               {
                  this.receiptMasterTableAdapter.FillByPeriodNum(_tmpMaster, numPeriods);
              
            }
                    catch (SqlException sqlerr)
                    {
                        if (sqlerr.Class < 17)
                        {
                            MessageBox.Show(sqlerr.Message);
                        }
                        else

                            caughtGlobalError(sqlerr);

                        Log("FillTableStockDocuments(MDataSet.ReceiptMasterDataTable source) ERROR" + sqlerr.Message + " " + sqlerr.Source + sqlerr.InnerException.Message);  
  
                        return false;
                    }
                    catch (Exception err)
                    {
                        MessageBox.Show(err.Message);
                        Log("FillTableStockDocuments(MDataSet.ReceiptMasterDataTable source) ERROR" + err.Message + " " + err.Source +err.InnerException.Message);  
  
                        return false;
                    }
                    finally
                    {
                        this.mDataSet.ReceiptMaster.Merge(_tmpMaster);
                      

                    }
                    return true;



                }
示例#2
0
        private void onReceiptMasterDBCError(DBConcurrencyException dbcx)
        {
            try
            {
                MDataSet.ReceiptMasterDataTable _tmp = new MDataSet.ReceiptMasterDataTable();


                this.receiptMasterTableAdapter.FillByPeriodNum(_tmp, 0);
                this.mDataSet.ReceiptMaster.Merge(_tmp);

                dbcx.Row.RowError = "";

            }
            catch (Exception err)

            {
                MessageBox.Show(err.Message);

                MainForm.Log("onReceiptMasterDBCError" + err.Message);
            }

        }
示例#3
0
        /*MDataset, документы на складе, из открытого периода, новые, X дней*/
        public bool FillTableStockDocuments(MDataSet.ReceiptMasterDataTable source,DateTime begin)
        {
            MDataSet.ReceiptMasterDataTable _tmpMaster = new MDataSet.ReceiptMasterDataTable();
            MDataSet.ReceiptDetailDataTable _tmpDetail = new MDataSet.ReceiptDetailDataTable();
            MDataSet.ProductDataTable _prod = new MDataSet.ProductDataTable();
          
            try
            {
  
                this.receiptMasterTableAdapter.FillByPeriod(_tmpMaster,begin);
                
           /*     foreach(DataRow masRow in _tmpMaster )
                {

                    MDataSet.ManufacturerDataTable _man = new MDataSet.ManufacturerDataTable();

                    
                    this.manufacturerTableAdapter.FillByReceiptMasterRef(_man, (masRow as MDataSet.ReceiptMasterRow).ID);



                    this.productTableAdapter.FillByReceiptId(_prod, (masRow as MDataSet.ReceiptMasterRow).ID);
                 
                 //   this.manufacturerTableAdapter.FillByReceiptMasterRef(_man , (masRow as MDataSet.ReceiptMasterRow).ID);

                    
                    this.mDataSet.Product.Merge(_prod);
                    this.mDataSet.Manufacturer.Merge(_man);
                   
                }


                this.receiptDetailTableAdapter.FillByPeriod(_tmpDetail, begin);
                this.mDataSet.ReceiptDetail.Merge(_tmpDetail);*/
                this.mDataSet.ReceiptMaster.Merge(_tmpMaster);
           

            }

            catch (SqlException sqlerr)
            {
                if (sqlerr.Class < 17)
                {
                    MessageBox.Show(sqlerr.Message);
                }
                else

                    caughtGlobalError(sqlerr);


                Log("FillTableStockDocuments(MDataSet.ReceiptMasterDataTable source) ERROR" + sqlerr.Message + " " + sqlerr.Source + sqlerr.InnerException.Message);  
  
                return false;
            }
            catch (Exception err)
            {
                DataRow[] dr = this.mDataSet.Manufacturer.GetErrors();

                DataColumn[] dc =  dr[0].GetColumnsInError();
                
                MessageBox.Show(err.Message);

                Log("FillTableStockDocuments(MDataSet.ReceiptMasterDataTable source) ERROR" + err.Message + " " + err.Source );  
  

                return false;
            }
            finally
            {
                

            }
            return true;



        }
示例#4
0
        /*FillNew + Merge + FillDetailsById*/
        public bool RefreshData(MDataSet.ReceiptMasterRow sourceRow) 
        {
            MDataSet.ReceiptMasterDataTable _ReceiptMasterDataTable = new MDataSet.ReceiptMasterDataTable();
            MDataSet.ReceiptDetailDataTable _ReceiptDetailDataTable = new MDataSet.ReceiptDetailDataTable();
            MDataSet.ProductDataTable _productDataTable = new MDataSet.ProductDataTable();

        //    MDataSet.ReceiptRemainsDataTable _ReceiptRemainsDataTable = new MDataSet.ReceiptRemainsDataTable();

            
            try
            {
                this.productTableAdapter.FillByReceiptId(_productDataTable, sourceRow.ID);
                this.receiptMasterTableAdapter.FillNew(_ReceiptMasterDataTable);

                this.receiptDetailTableAdapter.FillByReceiptMasterRef(_ReceiptDetailDataTable, sourceRow.ID);
                
                
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                Log("RefreshData(MDataSet.ReceiptMasterRow sourceRow)  ERROR" + err.Message + " " + err.Source + err.InnerException.Message);  
  
                return false;
            }
            finally
            {
                this.mDataSet.Product.Merge(_productDataTable);
                this.mDataSet.ReceiptMaster.Merge(_ReceiptMasterDataTable);
               
                    this.mDataSet.ReceiptDetail.Merge(_ReceiptDetailDataTable);
                    this.mDataSet.ReceiptMaster.AcceptChanges();
                    this.mDataSet.ReceiptDetail.AcceptChanges();
                
                this.mDataSet.ReceiptMaster.AcceptChanges();
            }
            return true;
        }