本文整理汇总了C#中AceSoft.RetailPlus.Data.Products.BaseUnitID方法的典型用法代码示例。如果您正苦于以下问题:C# Products.BaseUnitID方法的具体用法?C# Products.BaseUnitID怎么用?C# Products.BaseUnitID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AceSoft.RetailPlus.Data.Products
的用法示例。
在下文中一共展示了Products.BaseUnitID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBaseUnitValue
public decimal GetBaseUnitValue(Int64 ProductID, Int32 UnitIDToConvert, decimal Quantity, int BranchID = 0)
{
try
{
Products clsProduct = new Products(base.Connection, base.Transaction);
//Int32 BaseUnitID = clsProduct.Details1(BranchID, ProductID).BaseUnitID;
Int32 BaseUnitID = clsProduct.BaseUnitID(ProductID);
Int32 origUnitIDToConvert = UnitIDToConvert;
decimal ConvertedUnit = Quantity;
MySqlCommand cmd = new MySqlCommand();
cmd.CommandType = System.Data.CommandType.Text;
while (BaseUnitID != UnitIDToConvert)
{
string SQL = "SELECT " +
"BaseUnitID, " +
"BottomUnitValue, " +
"BaseUnitValue " +
"FROM tblProductUnitMatrix " +
"WHERE ProductID = @ProductID " +
"AND BottomUnitID = @UnitIDToConvert ";
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@ProductID", ProductID);
cmd.Parameters.AddWithValue("@UnitIDToConvert", UnitIDToConvert);
cmd.CommandText = SQL;
System.Data.DataTable dt = new System.Data.DataTable("tblProductUnit");
base.MySqlDataAdapterFill(cmd, dt);
int iCtr = 0;
foreach(System.Data.DataRow dr in dt.Rows)
{
iCtr++;
UnitIDToConvert = Int32.Parse(dr["BaseUnitID"].ToString());
ConvertedUnit = Decimal.Parse(dr["BaseUnitValue"].ToString()) * ConvertedUnit / Decimal.Parse(dr["BottomUnitValue"].ToString());
}
if (iCtr == 0) break;
}
return ConvertedUnit;
}
catch (Exception ex)
{
throw base.ThrowException(ex);
}
}