Exemplo n.º 1
0
        public void ImportMedicament()
        {
            var table = new DS_Medicament.SP_GetMedicamentDataTable();

            table.SetAllowDBNull(true);
            foreach (var row in ds_Import.T_Info10)
            {
                if (row.IsMedicamentNameNull() || row.MedicamentName.Trim().Length == 0)
                {
                    continue;
                }
                //ზედმეტ ასოებს აშორებს.
                row.MedicamentName = row.MedicamentName.Replace("\n", string.Empty).Replace("\t", string.Empty).Trim();

                var newRow = table.NewSP_GetMedicamentRow();
                newRow.Name = row.MedicamentName;
                table.AddSP_GetMedicamentRow(newRow);
            }


            table.PrimaryKey = null;
            table.RemoveColumns(table.MedicamentIDColumn,
                                table.StandardCostColumn,
                                table.ListPriceColumn,
                                table.DealerPriceColumn,
                                table.DiscountPctColumn,
                                table.TaxRateColumn,
                                table.ValidDateColumn,
                                table.CountryCodeColumn,
                                table.BrandIDColumn,
                                table.SerieColumn,
                                table.StatusColumn,
                                table.ModifiedUserIDColumn,
                                table.ModifiedDateColumn,
                                table.ApproverUserIDColumn);

            var newTable = table.SelectDistinct(true, table.Columns, table.NameColumn);
            var xmlTable = newTable.PackAlternationTypedDataTable(dataRowState: DataRowState.Added, addActionColumn: true);

            ImportManager.ImportDataTable(ObjectNames.Medicament, xmlTable);
            ImportManager.InitID(ds_Import.T_Info10, ObjectNames.Medicament, ds_Import.T_Info10.MedicamentIDColumn.ColumnName, false, null, ds_Import.T_Info10.MedicamentNameColumn.ColumnName);
        }
Exemplo n.º 2
0
        private void ImportMedicament()
        {
            var table = new DS_Medicament.SP_GetMedicamentDataTable();

            table.SetAllowDBNull(true);
            foreach (var row in ds_Import.PurchaseOrderDetail)
            {
                if (row.IsMedicamentNameNull() || row.MedicamentName.Trim().Length == 0)
                {
                    continue;
                }
                //ზედმეტ ასოებს აშორებს.
                row.MedicamentName = row.MedicamentName.Replace("\n", string.Empty).Replace("\t", string.Empty).Trim();

                var newRow = table.NewSP_GetMedicamentRow();
                if (!row.IsMedicamentSubcategoryIDNull())
                {
                    newRow.MedicamentSubcategoryID = row.MedicamentSubcategoryID;
                }
                if (!row.IsMedicamentNameNull())
                {
                    newRow.Name = row.MedicamentName;
                }
                if (!row.IsProductNumberNull())
                {
                    newRow.ProductNumber = row.ProductNumber;
                }
                if (!row.IsMakeFlagNull())
                {
                    newRow.MakeFlag = row.MakeFlag;
                }
                if (!row.IsFinishedGoodsFlagNull())
                {
                    newRow.FinishedGoodsFlag = row.FinishedGoodsFlag;
                }
                if (!row.IsColorNull())
                {
                    newRow.Color = row.Color;
                }
                if (!row.IsSafetyStockLevelNull())
                {
                    newRow.SafetyStockLevel = row.SafetyStockLevel;
                }
                if (!row.IsReorderPointNull())
                {
                    newRow.ReorderPoint = row.ReorderPoint;
                }
                if (!row.IsStandardCostNull())
                {
                    newRow.StandardCost = row.StandardCost;
                }
                if (!row.IsListPriceNull())
                {
                    newRow.ListPrice = row.ListPrice;
                }
                if (!row.IsDealerPriceNull())
                {
                    newRow.DealerPrice = row.DealerPrice;
                }
                if (!row.IsDiscountPctNull())
                {
                    newRow.DiscountPct = row.DiscountPct;
                }
                if (!row.IsTaxRateNull())
                {
                    newRow.TaxRate = row.TaxRate;
                }
                if (!row.IsSizeNull())
                {
                    newRow.Size = row.Size;
                }
                if (!row.IsSizeRangeNull())
                {
                    newRow.SizeRange = row.SizeRange;
                }
                if (!row.IsSizeUnitMeasureCodeNull())
                {
                    newRow.SizeUnitMeasureCode = row.SizeUnitMeasureCode;
                }
                if (!row.IsWeightNull())
                {
                    newRow.Weight = row.Weight;
                }
                if (!row.IsWeightUnitMeasureCodeNull())
                {
                    newRow.WeightUnitMeasureCode = row.WeightUnitMeasureCode;
                }
                if (!row.IsDaysToManufactureNull())
                {
                    newRow.DaysToManufacture = row.DaysToManufacture;
                }
                if (!row.IsProductLineNull())
                {
                    newRow.ProductLine = row.ProductLine;
                }
                if (!row.IsClassNull())
                {
                    newRow.Class = row.Class;
                }
                if (!row.IsStyleNull())
                {
                    newRow.Style = row.Style;
                }
                if (!row.IsProductModelIDNull())
                {
                    newRow.ProductModelID = row.ProductModelID;
                }
                if (!row.IsSellStartDateNull())
                {
                    newRow.SellStartDate = row.SellStartDate;
                }
                if (!row.IsSellEndDateNull())
                {
                    newRow.SellEndDate = row.SellEndDate;
                }
                if (!row.IsDiscontinuedDateNull())
                {
                    newRow.DiscontinuedDate = row.DiscontinuedDate;
                }
                if (!row.IsUnitsInStockNull())
                {
                    newRow.UnitsInStock = row.UnitsInStock;
                }
                //if (!row.IsValidDateNull())
                //    newRow.ValidDate = row.ValidDate;
                //if (!row.IsCountryCodeNull())
                //    newRow.CountryCode = row.CountryCode;
                //if (!row.IsBrandIDNull())
                //    newRow.BrandID = row.BrandID;
                //if (!row.IsSerieNull())
                //    newRow.Serie = row.Serie;

                //newRow.Status = (byte)Statuses.Pending;
                //newRow.ModifiedUserID = GlobalVariable.UserID;
                //newRow.ModifiedDate = GlobalVariable.ServerDateTime;

                table.AddSP_GetMedicamentRow(newRow);
            }


            table.PrimaryKey = null;
            table.RemoveColumns(table.MedicamentIDColumn,
                                //table.StandardCostColumn,
                                //table.ListPriceColumn,
                                //table.DealerPriceColumn,
                                //table.DiscountPctColumn,
                                //table.TaxRateColumn,
                                table.ValidDateColumn,
                                table.CountryCodeColumn,
                                table.BrandIDColumn,
                                table.SerieColumn,
                                table.StatusColumn,
                                table.ModifiedUserIDColumn,
                                table.ModifiedDateColumn,
                                table.ApproverUserIDColumn);

            var newTable = table.SelectDistinct(true, table.Columns, table.NameColumn);
            var xmlTable = newTable.PackAlternationTypedDataTable <DataTable>(dataRowState: DataRowState.Added, addActionColumn: true);

            ImportManager.ImportDataTable(ObjectNames.Medicament, xmlTable);
            ImportManager.InitID(ds_Import.PurchaseOrderDetail, ObjectNames.Medicament, ds_Import.PurchaseOrderDetail.MedicamentIDColumn.ColumnName, false, null, ds_Import.PurchaseOrderDetail.MedicamentNameColumn.ColumnName);
        }