public override IQuery GetHsql(Object data) { StringBuilder sql = new StringBuilder("select a from ZoneBinRelation a where "); ZoneBinRelation zoneRel = (ZoneBinRelation)data; if (zoneRel != null) { Parms = new List <Object[]>(); if (zoneRel.Zone != null && zoneRel.Zone.ZoneID != 0) { sql.Append(" a.Zone.ZoneID = :id and "); Parms.Add(new Object[] { "id", zoneRel.Zone.ZoneID }); } if (zoneRel.Bin != null && zoneRel.Bin.BinID != 0) { sql.Append(" a.Bin.BinID = :id1 and "); Parms.Add(new Object[] { "id1", zoneRel.Bin.BinID }); } if (zoneRel.BinType != 0) { sql.Append(" a.BinType = :id2 and "); Parms.Add(new Object[] { "id2", zoneRel.BinType }); } } sql = new StringBuilder(sql.ToString()); sql.Append(" 1=1 order by a.Rank asc "); IQuery query = Factory.Session.CreateQuery(sql.ToString()); SetParameters(query); return(query); }
private void AddBin(Bin bin) { if (bin == null) { return; } try { ZoneBinRelation zoneBin = new ZoneBinRelation { Zone = View.Model.Record, Bin = bin, Rank = 0, //bin.Rank, CreatedBy = App.curUser.UserName, CreationDate = DateTime.Today }; zoneBin = service.SaveZoneBinRelation(zoneBin); View.Model.AllowedList.Insert(0, zoneBin); View.Model.SubEntityList.Remove(bin); } catch (Exception ex) { throw ex; } }
public IList <ZoneBinRelation> Select(ZoneBinRelation data) { IList <ZoneBinRelation> datos = new List <ZoneBinRelation>(); datos = GetHsql(data).List <ZoneBinRelation>(); if (!Factory.IsTransactional) { Factory.Commit(); } return(datos); }
private void RemoveBin(ZoneBinRelation Zonebin) { if (Zonebin == null) { return; } try { service.DeleteZoneBinRelation(Zonebin); View.Model.AllowedList.Remove(Zonebin); View.Model.SubEntityList.Add(Zonebin.Bin); } catch (Exception ex) { throw ex; } }
private void OnAssignBinToProduct(object sender, DataEventArgs <Bin> e) { if (e.Value == null) { return; } Bin assignLocation = e.Value; //try //{ assignLocation = service.GetBin(new Bin { BinCode = e.Value, Location = App.curLocation }).First(); } //catch { assignLocation = null; } //if (assignLocation == null) //{ // Util.ShowError("Bin " + e.Value + " is not valid."); // return; //} //Assign Bin to Product try { assignLocation.ModifiedBy = App.curUser.UserName; int binDirection = View.CboBinDirection.SelectedItem == null ? 0 : (int)View.CboBinDirection.SelectedValue; ZoneBinRelation zonBin = new ZoneBinRelation { Bin = assignLocation, BinType = (short)binDirection, CreatedBy = App.curUser.UserName, }; try { zonBin.MinUnitCapacity = Double.Parse(View.MinStock.Text); } catch {} try { zonBin.UnitCapacity = Double.Parse(View.MaxStock.Text); } catch { } service.AssignBinToProduct(View.Model.Record, zonBin); ShowProductStock(); } catch (Exception ex) { Util.ShowError("Bin could not be assigned.\n" + ex.Message); } }
private void RemoveBin() { if (View.LvStock.SelectedItems == null) { return; } ZoneBinRelation zBin = null; //ZoneBinRelation proStock = null; string msg = ""; foreach (Object obj in View.LvStock.SelectedItems) { try { zBin = (ZoneBinRelation)obj; View.Model.ProductBinRelation.Remove(zBin); zBin = service.GetZoneBinRelation(new ZoneBinRelation { Bin = zBin.Bin, Zone = zBin.Zone }).First(); service.DeleteZoneBinRelation(zBin); } catch (Exception ex) { msg += "Error trying to delete Bin: " + zBin.Bin + ". " + ex.Message; } } View.LvStock.Items.Refresh(); if (!string.IsNullOrEmpty(msg)) { Util.ShowError(msg); } ShowProductStock(); }
public void AssignBinToProduct(Product product, ZoneBinRelation zoneBin) { try { SetService(); SerClient.AssignBinToProduct(product, zoneBin); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
public void DeleteZoneBinRelation(ZoneBinRelation data) { try { SetService(); SerClient.DeleteZoneBinRelation(data); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
public ZoneBinRelation SaveZoneBinRelation(ZoneBinRelation data) { try { SetService(); return SerClient.SaveZoneBinRelation(data); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
private void OnAssignBinToProduct(object sender, DataEventArgs<Bin> e) { if (e.Value == null) return; Bin assignLocation = e.Value; //try //{ assignLocation = service.GetBin(new Bin { BinCode = e.Value, Location = App.curLocation }).First(); } //catch { assignLocation = null; } //if (assignLocation == null) //{ // Util.ShowError("Bin " + e.Value + " is not valid."); // return; //} //Assign Bin to Product try { assignLocation.ModifiedBy = App.curUser.UserName; int binDirection = View.CboBinDirection.SelectedItem == null ? 0 : (int)View.CboBinDirection.SelectedValue; ZoneBinRelation zonBin = new ZoneBinRelation { Bin = assignLocation, BinType = (short)binDirection, CreatedBy = App.curUser.UserName, }; try { zonBin.MinUnitCapacity = Double.Parse(View.MinStock.Text); } catch {} try { zonBin.UnitCapacity = Double.Parse(View.MaxStock.Text); } catch { } service.AssignBinToProduct(View.Model.Record, zonBin); ShowProductStock(); } catch (Exception ex) { Util.ShowError("Bin could not be assigned.\n" + ex.Message); } }
private void RemoveBin(ZoneBinRelation Zonebin) { if (Zonebin == null) return; try { service.DeleteZoneBinRelation(Zonebin); View.Model.AllowedList.Remove(Zonebin); View.Model.SubEntityList.Add(Zonebin.Bin); } catch (Exception ex) { throw ex; } }
public ZoneBinRelation SelectById(ZoneBinRelation data) { return((ZoneBinRelation)base.SelectById(data)); }
public Boolean Delete(ZoneBinRelation data) { return(base.Delete(data)); }
public Boolean Update(ZoneBinRelation data) { return(base.Update(data)); }
public ZoneBinRelation Save(ZoneBinRelation data) { return((ZoneBinRelation)base.Save(data)); }
private void OnAssignBinToProduct(object sender, DataEventArgs<string> e) { Bin assignLocation; try { assignLocation = service.GetBin(new Bin { BinCode = e.Value, Location = App.curLocation }).First(); } catch { assignLocation = null; } if (assignLocation == null) { Util.ShowError(Util.GetResourceLanguage("BIN") + " " + e.Value + Util.GetResourceLanguage("IS_NOT_VALID")); return; } //Assign Bin to Product try { assignLocation.ModifiedBy = App.curUser.UserName; int binDirection = View.CboBinDirection.SelectedItem == null ? 0 : (int)View.CboBinDirection.SelectedValue; //int.Parse(((DictionaryEntry)View.CboBinDirection.SelectedItem).Key.ToString()); // ZoneBinRelation zonBin = new ZoneBinRelation { Bin = assignLocation, BinType = (short)binDirection, CreatedBy = App.curUser.UserName, }; //try { zonBin.MinUnitCapacity = Double.Parse(View.MinStock.Text); } //catch { } //try { zonBin.UnitCapacity = Double.Parse(View.MinStock.Text); } //catch { } service.AssignBinToProduct(View.Model.Product, zonBin); ShowProductStock(); } catch (Exception ex) { Util.ShowError(Util.GetResourceLanguage("BIN_COULD_NOT_BE_ASSIGNED") + "\n" + ex.Message); } }
private void AddBin(Bin bin) { if (bin == null) return; try { ZoneBinRelation zoneBin = new ZoneBinRelation { Zone = View.Model.Record, Bin = bin, Rank = 0, //bin.Rank, CreatedBy = App.curUser.UserName, CreationDate = DateTime.Today }; zoneBin = service.SaveZoneBinRelation(zoneBin); View.Model.AllowedList.Insert(0, zoneBin); View.Model.SubEntityList.Remove(bin); } catch (Exception ex) { throw ex; } }