public void Insert(int DespatchNoteId,string BuyersOrderNumber,string PrintersJobNumber,string PublishipRef,string Isbn,string Title,string Impression,int? TotalQty,int? FullPallets,int? UnitsFull,int? PartPallets,int? UnitsPart,int? ParcelCount,int? UnitsPerParcel,int? ParcelsPerLayer,int? OddsCount,decimal? Height,decimal? Width,decimal? Depth,decimal? UnitNetWeight,decimal? ParcelHeight,decimal? ParcelWidth,decimal? ParcelDepth,decimal? ParcelUnitgrossweight,byte[] DespatchItemTs) { DespatchNoteItem item = new DespatchNoteItem(); item.DespatchNoteId = DespatchNoteId; item.BuyersOrderNumber = BuyersOrderNumber; item.PrintersJobNumber = PrintersJobNumber; item.PublishipRef = PublishipRef; item.Isbn = Isbn; item.Title = Title; item.Impression = Impression; item.TotalQty = TotalQty; item.FullPallets = FullPallets; item.UnitsFull = UnitsFull; item.PartPallets = PartPallets; item.UnitsPart = UnitsPart; item.ParcelCount = ParcelCount; item.UnitsPerParcel = UnitsPerParcel; item.ParcelsPerLayer = ParcelsPerLayer; item.OddsCount = OddsCount; item.Height = Height; item.Width = Width; item.Depth = Depth; item.UnitNetWeight = UnitNetWeight; item.ParcelHeight = ParcelHeight; item.ParcelWidth = ParcelWidth; item.ParcelDepth = ParcelDepth; item.ParcelUnitgrossweight = ParcelUnitgrossweight; item.DespatchItemTs = DespatchItemTs; item.Save(UserName); }
//end select title /// <summary> /// returns titleid if save is successful /// </summary> /// <param name="item"></param> /// <returns></returns> public static int InsertItem(DespatchNoteItem item) { item.ItemId = NextItemId(); db4oManager.WithContainer(container => { container.Store(item); }); return item.ItemId; }
//end select title /// <summary> /// returns titleid if save is successful /// </summary> /// <param name="item"></param> /// <returns></returns> public static int InsertItem(DespatchNoteItem item) { item.ItemId = NextItemId(); db4oManager.WithContainer(container => { container.Store(item); }); return(item.ItemId); }
/// <summary> /// update booktitle based in id /// </summary> /// <param name="item"></param> public static void UpdateItem(DespatchNoteItem item) { db4oManager.WithContainer(container => { // The office object that is passed to this procedure is not connected to // the db4o container so we first have to do that. List<DespatchNoteItem> _list = (from DespatchNoteItem i in container where i.ItemId == item.ItemId && i.DespatchNoteId == item.DespatchNoteId select i).ToList(); if (_list != null) { // Then we should pass the properties from the updated object to the // selected one. // TODO: Maybe we could make a reflection procedure for this? _list[0].BuyersOrderNumber = item.BuyersOrderNumber; _list[0].PrintersJobNumber = item.PrintersJobNumber; _list[0].PublishipRef = item.PublishipRef; _list[0].Isbn = item.Isbn; _list[0].Title = item.Title; _list[0].Impression = item.Impression; _list[0].TotalQty = item.TotalQty; _list[0].FullPallets = item.FullPallets; _list[0].UnitsFull = item.UnitsFull; _list[0].PartPallets = item.PartPallets; _list[0].UnitsPart = item.UnitsPart; _list[0].ParcelCount = item.ParcelCount; _list[0].UnitsPerParcel = item.UnitsPerParcel; _list[0].ParcelsPerLayer = item.ParcelsPerLayer; _list[0].OddsCount = item.OddsCount; _list[0].Height = item.Height; _list[0].Width = item.Width; _list[0].Depth = item.Depth; _list[0].UnitNetWeight = item.UnitNetWeight; _list[0].ParcelHeight = item.ParcelHeight; _list[0].ParcelWidth = item.ParcelWidth; _list[0].ParcelDepth = item.ParcelDepth; _list[0].ParcelUnitgrossweight = item.ParcelUnitgrossweight; container.Store(_list[0]); } }); }
/// <summary> /// update booktitle based in id /// </summary> /// <param name="item"></param> public static void UpdateItem(DespatchNoteItem item) { db4oManager.WithContainer(container => { // The office object that is passed to this procedure is not connected to // the db4o container so we first have to do that. List <DespatchNoteItem> _list = (from DespatchNoteItem i in container where i.ItemId == item.ItemId && i.DespatchNoteId == item.DespatchNoteId select i).ToList(); if (_list != null) { // Then we should pass the properties from the updated object to the // selected one. // TODO: Maybe we could make a reflection procedure for this? _list[0].BuyersOrderNumber = item.BuyersOrderNumber; _list[0].PrintersJobNumber = item.PrintersJobNumber; _list[0].PublishipRef = item.PublishipRef; _list[0].Isbn = item.Isbn; _list[0].Title = item.Title; _list[0].Impression = item.Impression; _list[0].TotalQty = item.TotalQty; _list[0].FullPallets = item.FullPallets; _list[0].UnitsFull = item.UnitsFull; _list[0].PartPallets = item.PartPallets; _list[0].UnitsPart = item.UnitsPart; _list[0].ParcelCount = item.ParcelCount; _list[0].UnitsPerParcel = item.UnitsPerParcel; _list[0].ParcelsPerLayer = item.ParcelsPerLayer; _list[0].OddsCount = item.OddsCount; _list[0].Height = item.Height; _list[0].Width = item.Width; _list[0].Depth = item.Depth; _list[0].UnitNetWeight = item.UnitNetWeight; _list[0].ParcelHeight = item.ParcelHeight; _list[0].ParcelWidth = item.ParcelWidth; _list[0].ParcelDepth = item.ParcelDepth; _list[0].ParcelUnitgrossweight = item.ParcelUnitgrossweight; container.Store(_list[0]); } }); }
//end get item data /// <summary> /// append to despatch item table /// </summary> protected void save_item() { int _despatchnoteId = Request.QueryString["idn"] != null ? wwi_func.vint(Request.QueryString["idn"].Replace(",","").ToString()) : 0; if (_despatchnoteId > 0) { DespatchNoteItem _item = new DespatchNoteItem(); _item.DespatchNoteId = _despatchnoteId; _item.PublishipRef = this.dxlblOrderNoValue.Text.ToString(); _item.Isbn = this.dxlblIsbnValue.Text.ToString(); _item.Title = this.dxlblTitleValue.Text.ToString(); _item.Impression = this.dxlblImpressionValue.Text.ToString(); _item.BuyersOrderNumber = this.dxlblBuyerRefValue.Text.ToString(); //carton details _item.ParcelHeight = this.dxtxtParcelHeight.Text.ToString() != "" ? wwi_func.vdecimal(this.dxtxtParcelHeight.Text.ToString()) : 0; _item.ParcelDepth = this.dxtxtParcelDepth.Text.ToString() != "" ? wwi_func.vdecimal(this.dxtxtParcelDepth.Text.ToString()) : 0; _item.ParcelUnitgrossweight = this.dxtxtParcelWeight.Text.ToString() != "" ? wwi_func.vdecimal(this.dxtxtParcelWeight.Text.ToString()) : 0; _item.ParcelWidth = this.dxtxtParcelWidth.Text.ToString() != "" ? wwi_func.vdecimal(this.dxtxtParcelWidth.Text.ToString()) : 0; //book details _item.UnitsPerParcel = this.dxtxtCpc.Text != "" ? wwi_func.vint(this.dxtxtCpc.Text.ToString()) : 0; _item.Height = this.dxtxtHeight.Text != "" ? wwi_func.vdecimal(this.dxtxtHeight.Text.ToString()) : 0; _item.Width = this.dxtxtWidth.Text != "" ? wwi_func.vdecimal(this.dxtxtWidth.Text.ToString()) : 0; _item.Depth = this.dxtxtDepth.Text != "" ? wwi_func.vdecimal(this.dxtxtDepth.Text.ToString()) : 0; _item.UnitNetWeight = this.dxtxtWeight.Text != "" ? wwi_func.vdecimal(this.dxtxtWeight.Text.ToString()) : 0; //user input _item.TotalQty = wwi_func.vint(this.dxtxtCopies.Text.ToString()); //copies? _item.FullPallets = wwi_func.vint(this.dxtxtFullPallets.Text.ToString()); _item.UnitsFull = wwi_func.vint(this.dxtxtUnitsFull.Text.ToString()); ; //CartonsPerFullPallet _item.PartPallets = wwi_func.vint(this.dxtxtPartPallets.Text.ToString()); _item.UnitsPart = wwi_func.vint(this.dxtxtUnitsPart.Text.ToString());//CartonsPerPartPallet _item.ParcelCount = wwi_func.vint(this.dxtxtCartonsAdd.Text.ToString()); _item.ParcelsPerLayer = wwi_func.vint(this.dxtxtPerLayer.Text.ToString()); _item.OddsCount = wwi_func.vint(this.dxtxtOdds.Text.ToString()); _item.Save(); } //end if }
//end get item data /// <summary> /// append to despatch item table /// </summary> protected void save_item() { int _despatchnoteId = Request.QueryString["idn"] != null?wwi_func.vint(Request.QueryString["idn"].Replace(",", "").ToString()) : 0; if (_despatchnoteId > 0) { DespatchNoteItem _item = new DespatchNoteItem(); _item.DespatchNoteId = _despatchnoteId; _item.PublishipRef = this.dxlblOrderNoValue.Text.ToString(); _item.Isbn = this.dxlblIsbnValue.Text.ToString(); _item.Title = this.dxlblTitleValue.Text.ToString(); _item.Impression = this.dxlblImpressionValue.Text.ToString(); _item.BuyersOrderNumber = this.dxlblBuyerRefValue.Text.ToString(); //carton details _item.ParcelHeight = this.dxtxtParcelHeight.Text.ToString() != "" ? wwi_func.vdecimal(this.dxtxtParcelHeight.Text.ToString()) : 0; _item.ParcelDepth = this.dxtxtParcelDepth.Text.ToString() != "" ? wwi_func.vdecimal(this.dxtxtParcelDepth.Text.ToString()) : 0; _item.ParcelUnitgrossweight = this.dxtxtParcelWeight.Text.ToString() != "" ? wwi_func.vdecimal(this.dxtxtParcelWeight.Text.ToString()) : 0; _item.ParcelWidth = this.dxtxtParcelWidth.Text.ToString() != "" ? wwi_func.vdecimal(this.dxtxtParcelWidth.Text.ToString()) : 0; //book details _item.UnitsPerParcel = this.dxtxtCpc.Text != "" ? wwi_func.vint(this.dxtxtCpc.Text.ToString()) : 0; _item.Height = this.dxtxtHeight.Text != "" ? wwi_func.vdecimal(this.dxtxtHeight.Text.ToString()) : 0; _item.Width = this.dxtxtWidth.Text != "" ? wwi_func.vdecimal(this.dxtxtWidth.Text.ToString()) : 0; _item.Depth = this.dxtxtDepth.Text != "" ? wwi_func.vdecimal(this.dxtxtDepth.Text.ToString()) : 0; _item.UnitNetWeight = this.dxtxtWeight.Text != "" ? wwi_func.vdecimal(this.dxtxtWeight.Text.ToString()) : 0; //user input _item.TotalQty = wwi_func.vint(this.dxtxtCopies.Text.ToString()); //copies? _item.FullPallets = wwi_func.vint(this.dxtxtFullPallets.Text.ToString()); _item.UnitsFull = wwi_func.vint(this.dxtxtUnitsFull.Text.ToString());; //CartonsPerFullPallet _item.PartPallets = wwi_func.vint(this.dxtxtPartPallets.Text.ToString()); _item.UnitsPart = wwi_func.vint(this.dxtxtUnitsPart.Text.ToString()); //CartonsPerPartPallet _item.ParcelCount = wwi_func.vint(this.dxtxtCartonsAdd.Text.ToString()); _item.ParcelsPerLayer = wwi_func.vint(this.dxtxtPerLayer.Text.ToString()); _item.OddsCount = wwi_func.vint(this.dxtxtOdds.Text.ToString()); _item.Save(); } //end if }
//end row inserting /// <summary> /// row update /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void dxgrdItemDetails_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { ASPxGridView _grd = (ASPxGridView)sender; try { //get row id string _itemid = e.Keys["item_id"].ToString(); //get log id //string _srrlogid = wwi_security.DecryptString(get_token("srrid").ToString(), "publiship"); if (!string.IsNullOrEmpty(_itemid)) { int _nitemid = wwi_func.vint(_itemid); DespatchNoteItem _item = new DespatchNoteItem(_nitemid); //_item.SrrLogId = wwi_func.vint(_srrlogid); _item.PublishipRef = e.NewValues["publiship_ref"] != null ? e.NewValues["publiship_ref"].ToString() : ""; //roughly the order they are used in asn file _item.Isbn = e.NewValues["isbn"] != null ? e.NewValues["isbn"].ToString() : ""; //itemdescription _item.Title = e.NewValues["title"] != null ? e.NewValues["title"].ToString() : ""; //unit measurements _item.Height = e.NewValues["height"] != null?wwi_func.vdecimal(e.NewValues["height"].ToString()) : 0; _item.Width = e.NewValues["width"] != null?wwi_func.vdecimal(e.NewValues["width"].ToString()) : 0; _item.Depth = e.NewValues["depth"] != null?wwi_func.vdecimal(e.NewValues["depth"].ToString()) : 0; _item.UnitNetWeight = e.NewValues["unit_net_weight"] != null?wwi_func.vdecimal(e.NewValues["unit_net_weight"].ToString()) : 0; //end itemdescription _item.Impression = e.NewValues["impression"] != null ? e.NewValues["impression"].ToString() : ""; _item.TotalQty = e.NewValues["total_qty"] != null?wwi_func.vint(e.NewValues["total_qty"].ToString()) : 0; //rerencdecoded buyers order ref - pearson's ref _item.BuyersOrderNumber = e.NewValues["buyers_order_number"] != null ? e.NewValues["buyers_order_number"].ToString() : ""; //printers order ref _item.PrintersJobNumber = e.NewValues["printers_job_number"] != null ? e.NewValues["printers_job_number"].ToString() : ""; //end referencecoded //palletdetail _item.FullPallets = e.NewValues["full_pallets"] != null?wwi_func.vint(e.NewValues["full_pallets"].ToString()) : 0; _item.UnitsFull = e.NewValues["units_full"] != null?wwi_func.vint(e.NewValues["units_full"].ToString()) : 0; _item.PartPallets = e.NewValues["part_pallets"] != null?wwi_func.vint(e.NewValues["part_pallets"].ToString()) : 0; _item.UnitsPart = e.NewValues["units_part"] != null?wwi_func.vint(e.NewValues["units_part"].ToString()) : 0; //carton detail, we can derive books per pallet as cartoncount * unitspercarton _item.ParcelCount = e.NewValues["parcel_count"] != null?wwi_func.vint(e.NewValues["parcel_count"].ToString()) : 0; _item.UnitsPerParcel = e.NewValues["units_per_parcel"] != null?wwi_func.vint(e.NewValues["units_per_parcel"].ToString()) : 0; _item.ParcelHeight = e.NewValues["parcel_height"] != null?wwi_func.vdecimal(e.NewValues["parcel_height"].ToString()) : 0; _item.ParcelWidth = e.NewValues["parcel_width"] != null?wwi_func.vdecimal(e.NewValues["parcel_width"].ToString()) : 0; _item.ParcelDepth = e.NewValues["parcel_depth"] != null?wwi_func.vdecimal(e.NewValues["parcel_depth"].ToString()) : 0; _item.ParcelUnitgrossweight = e.NewValues["parcel_unitgrossweight"] != null?wwi_func.vdecimal(e.NewValues["parcel_unitgrossweight"].ToString()) : 0; _item.ParcelsPerLayer = e.NewValues["parcels_per_layer"] != null?wwi_func.vint(e.NewValues["parcels_per_layer"].ToString()) : 0; _item.OddsCount = e.NewValues["odds_count"] != null?wwi_func.vint(e.NewValues["odds_count"].ToString()) : 0; //end palletdetail _item.Save(); //repair pallet id list delete_pallet_ids(_nitemid); append_pallet_ids(_nitemid, _item.FullPallets, _item.PartPallets, _item.TotalQty, _item.PublishipRef); } else { this.dxlblErr.Text = "Unable to find item Id"; this.dxpnlErr.ClientVisible = true; }//end if id } catch (Exception ex) { this.dxlblErr.Text = ex.Message.ToString(); this.dxpnlErr.ClientVisible = true; } finally { //MUST call this after insert or error: Specified method is not supported e.Cancel = true; _grd.CancelEdit(); bind_items_grid(); } }
//end row inserting /// <summary> /// row update /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void dxgrdItemDetails_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { ASPxGridView _grd = (ASPxGridView)sender; try { //get row id string _itemid = e.Keys["item_id"].ToString(); //get log id //string _srrlogid = wwi_security.DecryptString(get_token("srrid").ToString(), "publiship"); if (!string.IsNullOrEmpty(_itemid)) { int _nitemid = wwi_func.vint(_itemid); DespatchNoteItem _item = new DespatchNoteItem(_nitemid); //_item.SrrLogId = wwi_func.vint(_srrlogid); _item.PublishipRef = e.NewValues["publiship_ref"] != null ? e.NewValues["publiship_ref"].ToString() : ""; //roughly the order they are used in asn file _item.Isbn = e.NewValues["isbn"] != null ? e.NewValues["isbn"].ToString() : ""; //itemdescription _item.Title = e.NewValues["title"] != null ? e.NewValues["title"].ToString() : ""; //unit measurements _item.Height = e.NewValues["height"] != null ? wwi_func.vdecimal(e.NewValues["height"].ToString()) : 0; _item.Width = e.NewValues["width"] != null ? wwi_func.vdecimal(e.NewValues["width"].ToString()) : 0; _item.Depth = e.NewValues["depth"] != null ? wwi_func.vdecimal(e.NewValues["depth"].ToString()) : 0; _item.UnitNetWeight = e.NewValues["unit_net_weight"] != null ? wwi_func.vdecimal(e.NewValues["unit_net_weight"].ToString()) : 0; //end itemdescription _item.Impression = e.NewValues["impression"] != null ? e.NewValues["impression"].ToString() : ""; _item.TotalQty = e.NewValues["total_qty"] != null ? wwi_func.vint(e.NewValues["total_qty"].ToString()) : 0; //rerencdecoded buyers order ref - pearson's ref _item.BuyersOrderNumber = e.NewValues["buyers_order_number"] != null ? e.NewValues["buyers_order_number"].ToString() : ""; //printers order ref _item.PrintersJobNumber = e.NewValues["printers_job_number"] != null ? e.NewValues["printers_job_number"].ToString() : ""; //end referencecoded //palletdetail _item.FullPallets = e.NewValues["full_pallets"] != null ? wwi_func.vint(e.NewValues["full_pallets"].ToString()) : 0; _item.UnitsFull = e.NewValues["units_full"] != null ? wwi_func.vint(e.NewValues["units_full"].ToString()) : 0; _item.PartPallets = e.NewValues["part_pallets"] != null ? wwi_func.vint(e.NewValues["part_pallets"].ToString()) : 0; _item.UnitsPart = e.NewValues["units_part"] != null ? wwi_func.vint(e.NewValues["units_part"].ToString()) : 0; //carton detail, we can derive books per pallet as cartoncount * unitspercarton _item.ParcelCount = e.NewValues["parcel_count"] != null ? wwi_func.vint(e.NewValues["parcel_count"].ToString()) : 0; _item.UnitsPerParcel = e.NewValues["units_per_parcel"] != null ? wwi_func.vint(e.NewValues["units_per_parcel"].ToString()) : 0; _item.ParcelHeight = e.NewValues["parcel_height"] != null ? wwi_func.vdecimal(e.NewValues["parcel_height"].ToString()) : 0; _item.ParcelWidth = e.NewValues["parcel_width"] != null ? wwi_func.vdecimal(e.NewValues["parcel_width"].ToString()) : 0; _item.ParcelDepth = e.NewValues["parcel_depth"] != null ? wwi_func.vdecimal(e.NewValues["parcel_depth"].ToString()) : 0; _item.ParcelUnitgrossweight = e.NewValues["parcel_unitgrossweight"] != null ? wwi_func.vdecimal(e.NewValues["parcel_unitgrossweight"].ToString()) : 0; _item.ParcelsPerLayer = e.NewValues["parcels_per_layer"] != null ? wwi_func.vint(e.NewValues["parcels_per_layer"].ToString()) : 0; _item.OddsCount = e.NewValues["odds_count"] != null ? wwi_func.vint(e.NewValues["odds_count"].ToString()) : 0; //end palletdetail _item.Save(); //repair pallet id list delete_pallet_ids(_nitemid); append_pallet_ids(_nitemid, _item.FullPallets, _item.PartPallets, _item.TotalQty, _item.PublishipRef); } else { this.dxlblErr.Text = "Unable to find item Id"; this.dxpnlErr.ClientVisible = true; }//end if id } catch (Exception ex) { this.dxlblErr.Text = ex.Message.ToString(); this.dxpnlErr.ClientVisible = true; } finally { //MUST call this after insert or error: Specified method is not supported e.Cancel = true; _grd.CancelEdit(); bind_items_grid(); } }