public FunctionItem(FunctionType functionType, PriceItem priceitem, TimeSpan time) { init(); FunctionType = functionType; PriceItems.Add(priceitem); Time = time; }
private bool InsertItemPrice(PriceItems PI) { bool ignoreres = true; bool cancelling = false; using (SqlConnection con = ConexionSQL.Cadenaconexion("ATX_POS")) { con.Open(); SqlCommand command = new SqlCommand(); command.Parameters.Clear(); command.Connection = con; try { if (PI.Bar_Code != null) { command.CommandText = ("Select BarCode from Items where BarCode = @CodeRefNAV"); command.Parameters.AddWithValue("@CodeRefNAV", PI.Bar_Code); string Exist = (string)command.ExecuteScalar(); if (Exist == null) { command.Parameters.Clear(); command.CommandText = "Insert into Items(ItemName,ItemCode,Barcode,Price,IdMeasure,LastDateModified,[VAT Prod_ Posting Group],NoCodeNAV) values(@ItemName, @ItemCode,@Barcode,@Price,(select IdItemMeausere from MeasureItem where ItemMeasure=@IdMeasure),@LastDateModified,@VATPG,@NoCodeNAV)"; string vatIvaGrup = ""; string NameDescription = GetItemNameDescrip(PI.Item_No, ref vatIvaGrup); command.Parameters.AddWithValue("@ItemName", NameDescription); command.Parameters.AddWithValue("@ItemCode", PI.Bar_Code); command.Parameters.AddWithValue("@BarCode", PI.Bar_Code); command.Parameters.AddWithValue("@Price", PI.Unit_Price); command.Parameters.AddWithValue("@IdMeasure", PI.Unit_of_Measure_Code); command.Parameters.AddWithValue("@LastDateModified", DateWork); command.Parameters.AddWithValue("@NoCodeNAV", PI.Item_No); command.Parameters.AddWithValue("@VATPG", vatIvaGrup); //command.Parameters.AddWithValue("@Alias","" ); //command.Parameters.AddWithValue("@NameBankNav", PI.Name.ToString()); command.ExecuteScalar(); } else if (Exist != null) { if (continueprocess) { if (remplaceall == false) { YesAllNoAll yestoall = new YesAllNoAll(); DialogResult resultYesall = yestoall.ShowDialog(); if (resultYesall == DialogResult.Cancel) { continueprocess = false; cancelling = true; } if (resultYesall == DialogResult.Yes) { remplaceall = true; } if (resultYesall == DialogResult.Ignore) { ignoreres = false; } if (resultYesall == DialogResult.OK) { yesone = true; } if (resultYesall == DialogResult.No) { noall = true; cancelling = true; } } if (continueprocess) { if (remplaceall && (noall == false)) { command.Parameters.Clear(); command.CommandText = ("UPDATE Items set Price = @Price, IdMeasure =(select IdItemMeausere from MeasureItem where ItemMeasure = @ItemMeasure), LastDateModified = @LastDateModified where BarCode = @BarCode"); command.Parameters.AddWithValue("@Price", PI.Unit_Price); command.Parameters.AddWithValue("@ItemMeasure", PI.Unit_of_Measure_Code); command.Parameters.AddWithValue("@LastDateModified", DateWork); command.Parameters.AddWithValue("@BarCode", PI.Bar_Code); command.ExecuteScalar(); } else if (yesone && ignoreres && (noall == false)) { command.Parameters.Clear(); command.CommandText = ("UPDATE Items set Price = @Price, IdMeasure =(select IdItemMeausere from MeasureItem where ItemMeasure = @ItemMeasure), LastDateModified = @LastDateModified where BarCode = @BarCode"); command.Parameters.AddWithValue("@Price", PI.Unit_Price); command.Parameters.AddWithValue("@ItemMeasure", PI.Unit_of_Measure_Code); command.Parameters.AddWithValue("@LastDateModified", DateWork); command.Parameters.AddWithValue("@BarCode", PI.Bar_Code); command.ExecuteScalar(); } } } } con.Close(); } } catch (SqlException sqlex) { MessageBox.Show(sqlex.Message); } catch (WebException webex) { MessageBox.Show(webex.Message); } } return(cancelling); }
private bool NoMatchUomIdInTable(out string sEAN13, out string sQtyInPack, out string sStdQty, out string noMatchUomIdInTable, out short UnitDecimals, out int UomID, out string sRFID, out string sError, out double dItemPrice) { dItemPrice = UnitDecimals = 0; UomID = 0; noMatchUomIdInTable = sEAN13 = sError = sQtyInPack = sRFID = sStdQty = string.Empty; var oFIProdUom = (FIProd.Uom)Activator.CreateInstance(Type.GetTypeFromProgID("FIProd.Uom")); var priceItem = PriceItems.FirstOrDefault(x => x.TypePrice == TypePrice.Zero); if (priceItem != null) { dItemPrice = priceItem.Price / priceItem.Unit; } ADODB.Recordset rsUOM = oFIProdUom.GetAll(Missing.Value, Missing.Value, BomUnit.Id);//oFIProdUom.GetAll(, , oInventTable("BomUnitID").Value) if (rsUOM.RecordCount == 0) { { noMatchUomIdInTable = "No match UOM_id in table"; return(true); } } UomID = rsUOM.get_Collect("uom_id"); UnitDecimals = 4; sRFID = string.Empty; var barCod = BarcodeItems; var rFids = barCod.Where(x => x.Type == "RFID").FirstOrDefault(); if (rFids != null) { sRFID = rFids.Barcode; } var ean13 = BarcodeItems.Where(x => x.Type == "EAN13-сбст"); var items = ean13.Select(x => new { x.Quantity, x.Barcode }).ToList(); sQtyInPack = string.Empty; sEAN13 = string.Empty; var bufStr = string.Empty; var bufSean = string.Empty; items.ForEach(x => { if (x.Quantity > 0) { bufStr += (x.Quantity + ";"); } else { bufStr += "1;"; } bufSean += (x.Barcode + ";"); }); sQtyInPack = bufStr; sEAN13 = bufSean; if (SizeType != null && SizeType.StandartPackQty > 0) { sStdQty = SizeType.StandartPackQty.ToString(); } else if (Group != null && Group.StandartPackQty > 0) { sStdQty = Group.StandartPackQty.ToString(); } else { sStdQty = "1"; } return(false); }