本文整理汇总了C#中AceSoft.RetailPlus.Data.Products.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# Products.Insert方法的具体用法?C# Products.Insert怎么用?C# Products.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AceSoft.RetailPlus.Data.Products
的用法示例。
在下文中一共展示了Products.Insert方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Upload
private void Upload()
{
if( ( txtPath.PostedFile != null ) && ( txtPath.PostedFile.ContentLength > 0 ) )
{
string fn = System.IO.Path.GetFileName(txtPath.PostedFile.FileName);
string SaveLocation = "/RetailPlus/temp/uploaded_" + fn;
txtPath.PostedFile.SaveAs(SaveLocation);
XmlTextReader reader = new XmlTextReader(SaveLocation);
reader.WhitespaceHandling = WhitespaceHandling.None;
Stock clsStock = new Stock();
clsStock.GetConnection();
string strStockTransactionNo = null;
long StockID = 0;
long ContactID = 0;
int UnitID = 0;
long ProductGroupID = 0;
long ProductSubGroupID = 0;
long ProductID = 0;
long ProductBaseMatrixID = 0;
VariationDetails clsVariationDetails;
int VariationID = 0;
StockItemDetails clsStockItemDetails = new StockItemDetails();
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (reader.Name == "Stock")
{
strStockTransactionNo = reader.GetAttribute("TransactionNo");
StockID = clsStock.Details(reader.GetAttribute("TransactionNo")).StockID;
if (StockID > 0)
{
clsStock.CommitAndDispose();
Label1.Text = "<b>This file has already been added to inventory.<br />";
Label1.Text += "Please refer to transaction No: " + strStockTransactionNo + ".</b>";
reader.Close();
return;
}
Contacts clsContact = new Contacts(clsStock.Connection, clsStock.Transaction);
ContactID = clsContact.Details(reader.GetAttribute("ContactCode")).ContactID;
if (ContactID == 0)
{
ContactDetails clsContactDetails = new ContactDetails();
clsContactDetails.ContactCode = reader.GetAttribute("ContactCode");
clsContactDetails.ContactName = reader.GetAttribute("ContactName");
clsContactDetails.ContactGroupID = Convert.ToInt32(reader.GetAttribute("ContactGroupID"));
clsContactDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), reader.GetAttribute("ModeOfTerms"));
clsContactDetails.Terms = Convert.ToInt32(reader.GetAttribute("Terms"));
clsContactDetails.Address = reader.GetAttribute("Address");
clsContactDetails.BusinessName = reader.GetAttribute("BusinessName");
clsContactDetails.TelephoneNo = reader.GetAttribute("TelephoneNo");
clsContactDetails.Remarks = reader.GetAttribute("Remarks");
clsContactDetails.Debit = Convert.ToDecimal(reader.GetAttribute("Debit"));
clsContactDetails.Credit = Convert.ToDecimal(reader.GetAttribute("Credit"));
clsContactDetails.IsCreditAllowed = Convert.ToBoolean(reader.GetAttribute("IsCreditAllowed"));
clsContactDetails.CreditLimit = Convert.ToDecimal(reader.GetAttribute("CreditLimit"));
ContactID = clsContact.Insert(clsContactDetails);
}
StockDetails clsStockDetails = new StockDetails();
clsStockDetails.TransactionNo = reader.GetAttribute("TransactionNo");
clsStockDetails.StockTypeID = Convert.ToInt16(Constants.STOCK_TYPE_TRANSFER_FROM_BRANCH_ID);
clsStockDetails.StockDate = DateTime.Now;
clsStockDetails.SupplierID = ContactID;
clsStockDetails.Remarks = reader.GetAttribute("StockRemarks") + Environment.NewLine + "Original Stock Date: " + reader.GetAttribute("StockDate");
StockItemDetails[] itemDetails = new StockItemDetails[0];
clsStockDetails.StockItems = itemDetails;
StockID = clsStock.Insert(clsStockDetails);
}
else if (reader.Name == "Item")
{
Data.Unit clsUnit = new Data.Unit(clsStock.Connection, clsStock.Transaction);
UnitID = clsUnit.Details(reader.GetAttribute("ProductUnitCode")).UnitID;
if (UnitID == 0)
{
UnitDetails clsUnitDetails = new UnitDetails();
clsUnitDetails.UnitCode = reader.GetAttribute("ProductUnitCode");
clsUnitDetails.UnitName = reader.GetAttribute("ProductUnitName");
UnitID = clsUnit.Insert(clsUnitDetails);
}
ProductGroup clsProductGroup = new ProductGroup(clsStock.Connection, clsStock.Transaction);
ProductGroupID = clsProductGroup.Details(reader.GetAttribute("ProductGroupCode")).ProductGroupID;
if (ProductGroupID == 0)
{
Label1.Text += "inserting product group....";
ProductGroupDetails clsProductGroupDetails = new ProductGroupDetails();
clsProductGroupDetails.ProductGroupCode = reader.GetAttribute("ProductGroupCode");
clsProductGroupDetails.ProductGroupName = reader.GetAttribute("ProductGroupName");
clsProductGroupDetails.UnitDetails = new UnitDetails
//.........这里部分代码省略.........
示例2: imgProductQuickAdd_Click
protected void imgProductQuickAdd_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
try
{
if (!string.IsNullOrEmpty(txtProductCode.Text))
{
ProductDetails clsDetails = new ProductDetails();
clsDetails.ProductCode = txtProductCode.Text;
clsDetails.BarCode = txtProductCode.Text;
clsDetails.ProductDesc = txtProductCode.Text;
clsDetails.ProductGroupID = ProductGroup.DEFAULT_GROUP_ID;
clsDetails.ProductSubGroupID = ProductSubGroup.DEFAULT_SUB_GROUP_ID;
clsDetails.BaseUnitID = Data.Unit.DEFAULT_UNIT_ID;
clsDetails.Price = 0;
clsDetails.PurchasePrice = 0;
clsDetails.IncludeInSubtotalDiscount = true;
clsDetails.VAT = Constants.DEFAULTS_VAT;
clsDetails.EVAT = 0;
clsDetails.LocalTax = 0;
clsDetails.Quantity = 0;
clsDetails.MinThreshold = 0;
clsDetails.MaxThreshold = 0;
clsDetails.SupplierID = Contacts.DEFAULT_SUPPLIER_ID;
clsDetails.IsItemSold = true;
clsDetails.WillPrintProductComposition = false;
Products clsProduct = new Products();
long id = clsProduct.Insert(clsDetails);
clsDetails.ProductID = id;
long lngUID = long.Parse(Session["UID"].ToString());
InvAdjustmentDetails clsInvAdjustmentDetails = new InvAdjustmentDetails();
clsInvAdjustmentDetails.UID = lngUID;
clsInvAdjustmentDetails.InvAdjustmentDate = DateTime.Now;
clsInvAdjustmentDetails.ProductID = id;
clsInvAdjustmentDetails.ProductCode = clsDetails.ProductCode;
clsInvAdjustmentDetails.Description = clsDetails.ProductDesc;
clsInvAdjustmentDetails.VariationMatrixID = 0;
clsInvAdjustmentDetails.MatrixDescription = null;
clsInvAdjustmentDetails.UnitID = clsDetails.BaseUnitID;
clsInvAdjustmentDetails.UnitCode = cboProductUnit.SelectedItem.Text;
clsInvAdjustmentDetails.QuantityBefore = 0;
clsInvAdjustmentDetails.QuantityNow = clsDetails.Quantity;
clsInvAdjustmentDetails.MinThresholdBefore = 0;
clsInvAdjustmentDetails.MinThresholdNow = clsDetails.MinThreshold;
clsInvAdjustmentDetails.MaxThresholdBefore = 0;
clsInvAdjustmentDetails.MaxThresholdNow = clsDetails.MaxThreshold;
clsInvAdjustmentDetails.Remarks = "newly added. beginning balance.";
InvAdjustment clsInvAdjustment = new InvAdjustment(clsProduct.Connection, clsProduct.Transaction);
clsInvAdjustment.Insert(clsInvAdjustmentDetails);
clsProduct.InheritSubGroupVariations(clsDetails.ProductSubGroupID, clsDetails.ProductID);
clsProduct.CommitAndDispose();
cmdProductCode_Click(null, null);
}
}
catch { }
}
示例3: Import
private void Import()
{
if (txtPath.HasFile)
{
string fn = System.IO.Path.GetFileName(txtPath.PostedFile.FileName);
if (fn.Contains("_" + Constants.PURCHASE_ORDER_CODE) == false)
{
string stScript = "<Script>";
stScript += "window.alert('Please select a VALID Transfer In file to upload.')";
stScript += "</Script>";
Response.Write(stScript);
return;
}
string SaveLocation = "/RetailPlus/temp/uploaded_" + fn;
txtPath.PostedFile.SaveAs(SaveLocation);
XmlTextReader xmlReader = new XmlTextReader(SaveLocation);
xmlReader.WhitespaceHandling = WhitespaceHandling.None;
TransferOut clsTransferOut = new TransferOut();
clsTransferOut.GetConnection();
TransferOutDetails clsTransferOutDetails = new TransferOutDetails();
TransferOutItem clsTransferOutItem = new TransferOutItem(clsTransferOut.Connection, clsTransferOut.Transaction);
TransferOutItemDetails clsTransferOutItemDetails;
Contacts clsContact = new Contacts(clsTransferOut.Connection, clsTransferOut.Transaction);
ContactDetails clsContactDetails;
ContactGroups clsContactGroup = new ContactGroups(clsTransferOut.Connection, clsTransferOut.Transaction);
ContactGroupDetails clsContactGroupDetails;
Data.Unit clsUnit = new Data.Unit(clsTransferOut.Connection, clsTransferOut.Transaction);
UnitDetails clsUnitDetails;
ProductGroup clsProductGroup = new Data.ProductGroup(clsTransferOut.Connection, clsTransferOut.Transaction);
ProductGroupDetails clsProductGroupDetails;
ProductSubGroup clsProductSubGroup = new Data.ProductSubGroup(clsTransferOut.Connection, clsTransferOut.Transaction);
ProductSubGroupDetails clsProductSubGroupDetails;
Products clsProduct = new Products(clsTransferOut.Connection, clsTransferOut.Transaction);
ProductDetails clsProductDetails;
ProductVariations clsProductVariation = new ProductVariations(clsTransferOut.Connection, clsTransferOut.Transaction);
ProductVariationDetails clsProductVariationDetails;
Branch clsBranch = new Branch(clsTransferOut.Connection, clsTransferOut.Transaction);
BranchDetails clsBranchDetails;
long lngProductID = 0; long lngProductCtr = 0;
while (xmlReader.Read())
{
switch (xmlReader.NodeType)
{
case XmlNodeType.Element:
if (xmlReader.Name == "TransferOutDetails")
{
clsTransferOutDetails.TransferOutNo = lnkTransferOutNo.Text;
clsTransferOutDetails.TransferOutDate = DateTime.Parse(lblTransferOutDate.Text);
clsTransferOutDetails.SupplierCode = xmlReader.GetAttribute("SupplierCode").ToString();
clsTransferOutDetails.SupplierContact = xmlReader.GetAttribute("SupplierContact").ToString();
clsTransferOutDetails.SupplierAddress = xmlReader.GetAttribute("SupplierAddress").ToString();
clsTransferOutDetails.SupplierTelephoneNo = xmlReader.GetAttribute("SupplierTelephoneNo").ToString();
clsTransferOutDetails.SupplierModeOfTerms = int.Parse(xmlReader.GetAttribute("SupplierModeOfTerms").ToString());
clsTransferOutDetails.SupplierTerms = int.Parse(xmlReader.GetAttribute("SupplierTerms").ToString());
clsTransferOutDetails.SupplierID = clsContact.Details(xmlReader.GetAttribute("SupplierCode").ToString()).ContactID;
if (clsTransferOutDetails.SupplierID == 0)
{
clsContactDetails = new ContactDetails();
clsContactDetails.ContactCode = clsTransferOutDetails.SupplierCode;
clsContactDetails.ContactName = xmlReader.GetAttribute("SupplierName").ToString();
clsContactDetails.BusinessName = clsTransferOutDetails.SupplierContact;
clsContactDetails.Address = clsTransferOutDetails.SupplierAddress;
clsContactDetails.TelephoneNo = clsTransferOutDetails.SupplierTelephoneNo;
clsContactDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), clsTransferOutDetails.SupplierModeOfTerms.ToString());
clsContactDetails.Terms = clsTransferOutDetails.SupplierTerms;
clsContactDetails.Remarks = "Added in from Imported TransferOut #";
clsContactDetails.ContactGroupID = int.Parse(Contacts.DEFAULT_SUPPLIER_ID.ToString("d"));
clsContactDetails.DateCreated = DateTime.Now;
clsTransferOutDetails.SupplierID = clsContact.Insert(clsContactDetails);
}
clsTransferOutDetails.RequiredDeliveryDate = DateTime.Parse(xmlReader.GetAttribute("RequiredDeliveryDate").ToString());
clsTransferOutDetails.BranchID = clsBranch.Details(xmlReader.GetAttribute("BranchCode")).BranchID;
if (clsTransferOutDetails.BranchID == 0)
{
clsBranchDetails = new BranchDetails();
clsBranchDetails.BranchCode = xmlReader.GetAttribute("BranchCode");
clsBranchDetails.BranchName = xmlReader.GetAttribute("BranchName");
clsBranchDetails.Address = xmlReader.GetAttribute("BranchAddress");
clsBranchDetails.DBIP = xmlReader.GetAttribute("BranchDBIP");
clsBranchDetails.DBPort = xmlReader.GetAttribute("BranchDBPort");
clsBranchDetails.Remarks = xmlReader.GetAttribute("BranchRemarks");
clsTransferOutDetails.BranchID = clsBranch.Insert(clsBranchDetails);
}
//.........这里部分代码省略.........
示例4: SaveRecord
private Int64 SaveRecord()
{
ProductDetails clsDetails = new ProductDetails();
clsDetails.ProductCode = txtProductCode.Text;
clsDetails.BarCode = txtBarcode.Text;
clsDetails.BarCode2 = txtBarcode2.Text;
clsDetails.BarCode3 = txtBarcode3.Text;
clsDetails.ProductDesc = txtProductDesc.Text;
clsDetails.ProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value);
clsDetails.ProductSubGroupID = Convert.ToInt64(cboProductSubGroup.SelectedItem.Value);
clsDetails.BaseUnitID = Convert.ToInt32(cboProductUnit.SelectedItem.Value);
clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text);
clsDetails.WSPrice = Convert.ToDecimal(txtWSPrice.Text);
clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text);
clsDetails.PercentageCommision = Convert.ToDecimal(txtPercentageCommision.Text);
clsDetails.IncludeInSubtotalDiscount = chkIncludeInSubtotalDiscount.Checked;
clsDetails.VAT = Convert.ToDecimal(txtVAT.Text);
clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text);
clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text);
clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text);
clsDetails.MinThreshold = Convert.ToDecimal(txtMinThreshold.Text);
clsDetails.MaxThreshold = Convert.ToDecimal(txtMaxThreshold.Text);
clsDetails.SupplierID = Convert.ToInt64(cboSupplier.SelectedItem.Value);
clsDetails.IsItemSold = Convert.ToBoolean(chkIsItemSold.Checked);
clsDetails.WillPrintProductComposition = Convert.ToBoolean(chkWillPrintProductComposition.Checked);
Products clsProduct = new Products();
Int64 id = clsProduct.Insert(clsDetails);
clsDetails.ProductID = id;
long lngUID = long.Parse(Session["UID"].ToString());
InvAdjustmentDetails clsInvAdjustmentDetails = new InvAdjustmentDetails();
clsInvAdjustmentDetails.UID = lngUID;
clsInvAdjustmentDetails.InvAdjustmentDate = DateTime.Now;
clsInvAdjustmentDetails.ProductID = id;
clsInvAdjustmentDetails.ProductCode = clsDetails.ProductCode;
clsInvAdjustmentDetails.Description = clsDetails.ProductDesc;
clsInvAdjustmentDetails.VariationMatrixID = 0;
clsInvAdjustmentDetails.MatrixDescription = null;
clsInvAdjustmentDetails.UnitID = clsDetails.BaseUnitID;
clsInvAdjustmentDetails.UnitCode = cboProductUnit.SelectedItem.Text;
clsInvAdjustmentDetails.QuantityBefore = 0;
clsInvAdjustmentDetails.QuantityNow = clsDetails.Quantity;
clsInvAdjustmentDetails.MinThresholdBefore = 0;
clsInvAdjustmentDetails.MinThresholdNow = clsDetails.MinThreshold;
clsInvAdjustmentDetails.MaxThresholdBefore = 0;
clsInvAdjustmentDetails.MaxThresholdNow = clsDetails.MaxThreshold;
clsInvAdjustmentDetails.Remarks = "newly added. beginning balance.";
InvAdjustment clsInvAdjustment = new InvAdjustment(clsProduct.Connection, clsProduct.Transaction);
clsInvAdjustment.Insert(clsInvAdjustmentDetails);
if (chkVariations.Checked == true)
{
clsProduct.InheritSubGroupVariations(clsDetails.ProductSubGroupID, clsDetails.ProductID);
}
if (chkVariationsMatrix.Checked == true)
{
if (chkVariations.Checked == false)
{
clsProduct.InheritSubGroupVariations(clsDetails.ProductSubGroupID, clsDetails.ProductID);
}
clsProduct.InheritSubGroupVariationsMatrix(clsDetails.ProductSubGroupID, clsDetails.ProductID, clsDetails);
}
if (chkUnitMatrix.Checked == true)
{
clsProduct.InheritSubGroupUnitMatrix(clsDetails.ProductSubGroupID, clsDetails.ProductID);
}
// Aug 26, 2011 : Lemu
// Update Required Inventory Days (RID)
clsDetails.RID = Convert.ToInt64(txtRID.Text);
clsProduct.UpdateRID(clsDetails.ProductID, clsDetails.RID);
clsProduct.CommitAndDispose();
return 0;
}
示例5: Upload1
private void Upload1()
{
//string fn = System.IO.Path.GetFileName(TextBox1.Text);
//string SaveLocation = "/RetailPlus/temp/uploaded_" + fn;
//System.IO.File.Copy(TextBox1.Text, SaveLocation);
//txtPath.PostedFile.SaveAs(SaveLocation);
XmlTextReader xmlReader = new XmlTextReader(TextBox1.Text);
xmlReader.WhitespaceHandling = WhitespaceHandling.None;
Branch clsBranch = new Branch();
BranchDetails clsBranchDetails = clsBranch.Details(Convert.ToInt16(cboBranchUpload.SelectedItem.Value.ToString()));
clsBranch.CommitAndDispose();
RemoteBranchInventory clsBranchInventory = new RemoteBranchInventory();
clsBranchInventory.GetConnectionToBranch(clsBranchDetails.DBIP);
Contacts clsBranchContact = new Contacts(clsBranchInventory.Connection, clsBranchInventory.Transaction);
ContactDetails clsBranchContactDetails;
ContactGroups clsBranchContactGroup = new ContactGroups(clsBranchInventory.Connection, clsBranchInventory.Transaction);
ContactGroupDetails clsContactGroupDetails;
Data.Unit clsBranchUnit = new Data.Unit(clsBranchInventory.Connection, clsBranchInventory.Transaction);
UnitDetails clsUnitDetails;
ProductGroup clsBranchProductGroup = new Data.ProductGroup(clsBranchInventory.Connection, clsBranchInventory.Transaction);
ProductGroupDetails clsBranchProductGroupDetails;
ProductSubGroup clsBranchProductSubGroup = new Data.ProductSubGroup(clsBranchInventory.Connection, clsBranchInventory.Transaction);
ProductSubGroupDetails clsBranchProductSubGroupDetails;
//Data.Variation clsBranchVariation = new Variation(clsBranchInventory.Connection, clsBranchInventory.Transaction);
Products clsBranchProduct = new Products(clsBranchInventory.Connection, clsBranchInventory.Transaction);
ProductDetails clsBranchProductDetails;
ProductVariations clsBranchProductVariation = new ProductVariations(clsBranchInventory.Connection, clsBranchInventory.Transaction);
ProductVariationDetails clsBranchProductVariationDetails;
long lngBranchProductID = 0; long lngProductCtr = 0; long lngProductInserted = 0;
while (xmlReader.Read())
{
switch (xmlReader.NodeType)
{
case XmlNodeType.Element:
if (xmlReader.Name == "Item")
{
lngProductCtr++;
clsBranchProductDetails = new ProductDetails();
clsBranchProductDetails.BarCode = xmlReader.GetAttribute("BarCode");
clsBranchProductDetails.ProductCode = xmlReader.GetAttribute("ProductCode");
lblError.Text += "Checking <b>" + clsBranchProductDetails.ProductCode + "</b> if exist... ";
//check product by barcode
clsBranchProductDetails.ProductID = clsBranchProduct.Details(Constants.BRANCH_ID_MAIN, clsBranchProductDetails.BarCode).ProductID;
lngBranchProductID = clsBranchProductDetails.ProductID;
if (clsBranchProductDetails.ProductID != 0)
{
lblError.Text += " [Y] barcode exist... next item...<br />";
break;
}
//check product by product code
clsBranchProductDetails.ProductID = clsBranchProduct.Details(Constants.BRANCH_ID_MAIN, clsBranchProductDetails.ProductCode).ProductID;
lngBranchProductID = clsBranchProductDetails.ProductID;
if (clsBranchProductDetails.ProductID != 0)
{
clsBranchProduct.UpdateBarcode(clsBranchProductDetails.ProductID, clsBranchProductDetails.BarCode);
lblError.Text += " [Y] barcode not exist, product code exist. barcode updated. next item...<br />";
break;
}
lblError.Text += " [N] inserting product... ";
clsBranchProductDetails.BarCode = xmlReader.GetAttribute("BarCode");
clsBranchProductDetails.ProductDesc = xmlReader.GetAttribute("ProductDesc");
clsBranchProductDetails.ProductGroupCode = xmlReader.GetAttribute("ProductGroupCode");
clsBranchProductDetails.ProductGroupName = xmlReader.GetAttribute("ProductGroupName");
clsBranchProductDetails.ProductSubGroupCode = xmlReader.GetAttribute("ProductSubGroupCode");
clsBranchProductDetails.ProductSubGroupName = xmlReader.GetAttribute("ProductSubGroupName");
clsBranchProductDetails.BaseUnitCode = xmlReader.GetAttribute("BaseUnitCode");
clsBranchProductDetails.BaseUnitName = xmlReader.GetAttribute("BaseUnitName");
clsBranchProductDetails.DateCreated = DateTime.Now;
clsBranchProductDetails.Price = Convert.ToDecimal(xmlReader.GetAttribute("Price"));
clsBranchProductDetails.PurchasePrice = Convert.ToDecimal(xmlReader.GetAttribute("PurchasePrice"));
clsBranchProductDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(xmlReader.GetAttribute("IncludeInSubtotalDiscount"));
clsBranchProductDetails.VAT = Convert.ToDecimal(xmlReader.GetAttribute("VAT"));
clsBranchProductDetails.EVAT = Convert.ToDecimal(xmlReader.GetAttribute("EVAT"));
clsBranchProductDetails.LocalTax = Convert.ToDecimal(xmlReader.GetAttribute("LocalTax"));
clsBranchProductDetails.Quantity = 0;
clsBranchProductDetails.MinThreshold = Convert.ToDecimal(xmlReader.GetAttribute("MinThreshold"));
clsBranchProductDetails.MaxThreshold = Convert.ToDecimal(xmlReader.GetAttribute("MaxThreshold"));
clsBranchProductDetails.ChartOfAccountIDPurchase = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDPurchase"));
clsBranchProductDetails.ChartOfAccountIDSold = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDSold"));
clsBranchProductDetails.ChartOfAccountIDInventory = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDInventory"));
clsBranchProductDetails.ChartOfAccountIDTaxPurchase = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDTaxPurchase"));
clsBranchProductDetails.ChartOfAccountIDTaxSold = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDTaxSold"));
//.........这里部分代码省略.........
示例6: SynchronizeFromBranch
private void SynchronizeFromBranch()
{
try
{
lblError.Text = string.Empty;
Branch clsBranch = new Branch();
BranchDetails clsBranchDetails = clsBranch.Details(Convert.ToInt16(cboSynchronizeFromBranch.SelectedItem.Value.ToString()));
clsBranch.CommitAndDispose();
if (IPAddress.IsOpen(clsBranchDetails.DBIP, int.Parse(clsBranchDetails.DBPort)) == false)
{
lblError.Text = "Sorry cannot connect to Branch '" + cboSynchronizeFromBranch.SelectedItem.Text + "'. Please check you connection to IP Address :" + clsBranchDetails.DBIP + ". <br /><br />";
lblError.Text += "HOW TO CHECK : <br /><br />";
lblError.Text += " 1. Open command prompt<br />";
lblError.Text += " 2. Type ping[space][IP Address]<br /><br />";
lblError.Text += "If the answer is 'Request timed out.' then contact system administrator.<br />";
lblError.Text += "Else if the answer is 'Reply...' Follow the next steps.<br /><br />";
lblError.Text += " 3. Type telnet[space][IP Address][sapce][IP Port]<br /><br />";
return;
}
Session.Timeout = 60 * 60 * 30;
Products clsProduct = new Products();
clsProduct.GetConnection();
ProductDetails clsProductDetails;
ContactGroups clsContactGroup = new ContactGroups(clsProduct.Connection, clsProduct.Transaction);
Contacts clsContact = new Contacts(clsProduct.Connection, clsProduct.Transaction);
Data.Unit clsUnit = new Data.Unit(clsProduct.Connection, clsProduct.Transaction);
Data.ProductGroup clsProductGroup = new Data.ProductGroup(clsProduct.Connection, clsProduct.Transaction);
Data.ProductSubGroup clsProductSubGroup = new Data.ProductSubGroup(clsProduct.Connection, clsProduct.Transaction);
Data.Variation clsVariation = new Variation(clsProduct.Connection, clsProduct.Transaction);
RemoteBranchInventory clsBranchInventory = new RemoteBranchInventory();
clsBranchInventory.GetConnectionToBranch(clsBranchDetails.DBIP, clsBranchDetails.DBPort);
Products clsBranchProduct = new Products(clsBranchInventory.Connection, clsBranchInventory.Transaction);
ProductDetails[] arrBranchProductDetails = clsBranchProduct.List();
ContactGroups clsBranchContactGroup = new ContactGroups(clsBranchInventory.Connection, clsBranchInventory.Transaction);
Contacts clsBranchContact = new Contacts(clsBranchInventory.Connection, clsBranchInventory.Transaction);
Data.Unit clsBranchUnit = new Data.Unit(clsBranchInventory.Connection, clsBranchInventory.Transaction);
Data.ProductGroup clsBranchProductGroup = new Data.ProductGroup(clsBranchInventory.Connection, clsBranchInventory.Transaction);
Data.ProductSubGroup clsBranchProductSubGroup = new Data.ProductSubGroup(clsBranchInventory.Connection, clsBranchInventory.Transaction);
Data.Variation clsBranchVariation = new Variation(clsBranchInventory.Connection, clsBranchInventory.Transaction);
foreach (ProductDetails clsBranchProductDetails in arrBranchProductDetails)
{
clsProductDetails = clsBranchProductDetails;
try
{
clsProductDetails.ProductID = clsProduct.Details(clsProductDetails.BarCode).ProductID;
if (clsProductDetails.ProductID != 0)
{
lblError.Text += clsProductDetails.BarCode + " already exist.<br /><br />";
clsProduct.UpdatePurchasing(clsProductDetails.ProductID, clsBranchProductDetails.MatrixID, clsProductDetails.SupplierID, clsProductDetails.BaseUnitID, clsProductDetails.PurchasePrice);
clsProduct.UpdateSellingPrice(clsProductDetails.ProductID, clsBranchProductDetails.MatrixID, clsProductDetails.SupplierID, clsProductDetails.BaseUnitID, clsProductDetails.Price, clsProductDetails.Price1, clsProductDetails.Price2, clsProductDetails.Price3, clsProductDetails.Price4, clsProductDetails.Price5);
}
else
{
clsProductDetails.ProductID = clsProduct.DetailsByCode(Constants.BRANCH_ID_MAIN, clsProductDetails.BarCode).ProductID;
if (clsProductDetails.ProductID != 0)
{
lblError.Text += clsProductDetails.ProductCode + " already exist.<br /><br />";
clsProduct.UpdateBarcode(clsProductDetails.ProductID, clsProductDetails.BarCode);
clsProduct.UpdatePurchasing(clsProductDetails.ProductID, clsBranchProductDetails.MatrixID, clsProductDetails.SupplierID, clsProductDetails.BaseUnitID, clsProductDetails.PurchasePrice);
clsProduct.UpdateSellingPrice(clsProductDetails.ProductID, clsBranchProductDetails.MatrixID, clsProductDetails.SupplierID, clsProductDetails.BaseUnitID, clsProductDetails.Price, clsProductDetails.Price1, clsProductDetails.Price2, clsProductDetails.Price3, clsProductDetails.Price4, clsProductDetails.Price5);
}
else
{
clsProductDetails.SupplierID = clsContact.Details(clsProductDetails.SupplierCode).ContactID;
if (clsProductDetails.SupplierID == 0)
{
ContactDetails clsBranchContactDetails = clsBranchContact.Details(clsProductDetails.SupplierCode);
if (clsContactGroup.Details(clsBranchContactDetails.ContactGroupID).ContactGroupID == 0)
{
ContactGroupDetails clsBranchContactGroupDetails = clsBranchContactGroup.Details(clsBranchContactDetails.ContactGroupID);
clsBranchContactDetails.ContactGroupID = clsContactGroup.Insert(clsBranchContactGroupDetails);
}
clsProductDetails.SupplierID = clsContact.Insert(clsBranchContactDetails);
}
clsProductDetails.BaseUnitID = clsUnit.Details(clsProductDetails.BaseUnitCode).UnitID;
if (clsProductDetails.BaseUnitID == 0)
{
UnitDetails clsBranchUnitDetails = clsBranchUnit.Details(clsBranchProductDetails.BaseUnitID);
clsProductDetails.BaseUnitID = clsUnit.Insert(clsBranchUnitDetails);
}
clsProductDetails.ProductGroupID = clsProductGroup.Details(clsProductDetails.ProductGroupCode).ProductGroupID;
if (clsProductDetails.ProductGroupID == 0)
{
ProductGroupDetails clsBranchProductGroupDetails = clsBranchProductGroup.Details(clsBranchProductDetails.ProductGroupID);
clsProductDetails.ProductGroupID = clsProductGroup.Insert(clsBranchProductGroupDetails);
}
clsProductDetails.ProductSubGroupID = clsProductSubGroup.Details(clsProductDetails.ProductSubGroupCode).ProductSubGroupID;
if (clsProductDetails.ProductSubGroupID == 0)
//.........这里部分代码省略.........