private void AddOnePicker(UserByRol user) { if (user == null) { return; } try { ZonePickerRelation zoneUser = new ZonePickerRelation { Zone = View.Model.Record, Picker = user.User, Rank = 0, //bin.Rank, CreatedBy = App.curUser.UserName, CreationDate = DateTime.Today }; zoneUser = service.SaveZonePickerRelation(zoneUser); View.Model.PickerListReg.Insert(0, zoneUser); View.Model.PickerList.Remove(user); } catch (Exception ex) { throw ex; } }
private void OnDelete(object sender, EventArgs e) { if (View.Model.Record == null) { Util.ShowError("No record selected."); return; } try { //Borra las menu Options del Rol y luego el Rol UserByRol mr = new UserByRol { User = View.Model.Record }; foreach (UserByRol mo in service.GetUserByRol(mr)) { service.DeleteUserByRol(mo); } service.DeleteSysUser(View.Model.Record); Util.ShowMessage("Record deleted."); View.StkEdit.Visibility = Visibility.Hidden; View.Model.EntityList = service.GetSysUser(new SysUser()); } catch (Exception ex) { Util.ShowError(ex.Message); } }
public ShippingConsolePresenter(IUnityContainer container, IShippingConsoleView view) { try { View = view; this.container = container; this.service = new WMSServiceClient(); View.Model = this.container.Resolve<ShippingConsoleModel>(); //Event Delegate View.AddTaskByUser += new EventHandler<DataEventArgs<Document>>(this.OnAddTaskByUser); View.RemoveTaskByUser += new EventHandler<DataEventArgs<Document>>(this.OnRemoveTaskByUser); View.LoadPickerDocuments += new EventHandler<EventArgs>(this.OnLoadPickerDocuments); //Loading Pickers UserByRol userByRol = new UserByRol { Location = App.curLocation, Rol = new Rol { RolID = BasicRol.Picker } }; View.Model.PickerList = service.GetUserByRol(userByRol); //Loading Open Documents LoadDocuments(); } catch (Exception ex) { Util.ShowError("Error loading view.\n" + ex.Message); } }
public ShippingConsolePresenter(IUnityContainer container, IShippingConsoleView view) { try { View = view; this.container = container; this.service = new WMSServiceClient(); View.Model = this.container.Resolve <ShippingConsoleModel>(); //Event Delegate View.AddTaskByUser += new EventHandler <DataEventArgs <Document> >(this.OnAddTaskByUser); View.RemoveTaskByUser += new EventHandler <DataEventArgs <Document> >(this.OnRemoveTaskByUser); View.LoadPickerDocuments += new EventHandler <EventArgs>(this.OnLoadPickerDocuments); //Loading Pickers UserByRol userByRol = new UserByRol { Location = App.curLocation, Rol = new Rol { RolID = BasicRol.Picker } }; View.Model.PickerList = service.GetUserByRol(userByRol); //Loading Open Documents LoadDocuments(); } catch (Exception ex) { Util.ShowError("Error loading view.\n" + ex.Message); } }
public IList <UserByRol> Select(UserByRol data) { IList <UserByRol> datos = new List <UserByRol>(); datos = GetHsql(data).List <UserByRol>(); if (!Factory.IsTransactional) { Factory.Commit(); } return(datos); }
//Carga los datos a Administrar private void OnLoadToAdmin(object sender, DataEventArgs <Zone> e) { if (e.Value == null) { return; } View.Model.Record = e.Value; View.StkInfo.Visibility = Visibility.Visible; // A. Bins IList <Bin> bins = service.GetBin(new Bin { Location = e.Value.Location }); // Zone= e.Value IList <ZoneBinRelation> bins_zone = service.GetZoneBinRelation(new ZoneBinRelation { Zone = e.Value }); View.Model.SubEntityList = Bins_availables(bins, bins_zone); View.SubEntityList.Items.Refresh(); View.Model.AllowedList = bins_zone; View.AllowedList.Items.Refresh(); View.TxtSearch.Text = ""; // B. Pickers // App.curLocation UserByRol userByRol = new UserByRol { Location = e.Value.Location, Rol = new Rol { RolID = BasicRol.Picker } }; IList <UserByRol> users = service.GetUserByRol(userByRol); IList <ZonePickerRelation> users_zone = service.GetZonePickerRelation(new ZonePickerRelation { Zone = e.Value }); View.Model.PickerList = Pickers_availables(users, users_zone); View.PickerList.Items.Refresh(); View.Model.PickerListReg = users_zone; View.PickerListReg.Items.Refresh(); // C. Entities (criterias admon) View.Model.ClassEntityList = service.GetClassEntity(new ClassEntity { BlnZoneCriteria = true }); View.CriteriaList.ItemsSource = new List <Object>(); View.CriteriaListReg.ItemsSource = new List <Object>(); View.TxtSearchCriteria.Text = ""; }
private void cboPicker_SelectionChanged(object sender, SelectionChangedEventArgs e) { UserByRol selected = (UserByRol)((ComboBox)sender).SelectedItem; if (selected == null) { return; } stkPikerOrders.Visibility = Visibility.Visible; this.Model.CurPicker = selected.User; LoadPickerDocuments(sender, e); }
public override IQuery GetHsql(Object data) { StringBuilder sql = new StringBuilder("select a from UserByRol a where "); UserByRol userbyrol = (UserByRol)data; if (userbyrol != null) { Parms = new List <Object[]>(); if (userbyrol.RowID != 0) { sql.Append(" a.RowID = :id and "); Parms.Add(new Object[] { "id", userbyrol.RowID }); } if (userbyrol.User != null && userbyrol.User.UserID != 0) { sql.Append(" a.User.UserID = :id2 and "); Parms.Add(new Object[] { "id2", userbyrol.User.UserID }); } if (userbyrol.Rol != null && userbyrol.Rol.RolID != 0) { sql.Append(" a.Rol.RolID = :id1 and "); Parms.Add(new Object[] { "id1", userbyrol.Rol.RolID }); } if (userbyrol.Location != null && userbyrol.Location.LocationID != 0) { sql.Append(" a.Location.LocationID = :id3 and "); Parms.Add(new Object[] { "id3", userbyrol.Location.LocationID }); } if (userbyrol.IsDefault != null) { sql.Append(" a.IsDefault = :nom7 and "); Parms.Add(new Object[] { "nom7", userbyrol.IsDefault }); } } sql = new StringBuilder(sql.ToString()); sql.Append("1=1 order by a.RowID asc "); IQuery query = Factory.Session.CreateQuery(sql.ToString()); SetParameters(query); return(query); }
public void RemoveRol() { UserByRol pUserRol = null; string msg = ""; if (View.LvRol.SelectedItems == null) { return; } foreach (Object obj in View.LvRol.SelectedItems) { //try //{ pUserRol = (UserByRol)obj; View.Model.UserRolList.Remove((UserByRol)obj); bool deleted = false; while (!deleted) { try { service.DeleteUserByRol(pUserRol); deleted = true; } catch { } } //} //catch (Exception ex) //{ // msg += "Error trying to delete Rol: " + pUserRol.Rol.Name + ". " + ex.Message; //} } if (!string.IsNullOrEmpty(msg)) { Util.ShowError(msg); } LoadRol(); }
private void OnAddRol(object sender, EventArgs e) { Rol curRol = View.CboRol.SelectedItem as Rol; Location curLocation = View.CboLocation.SelectedItem as Location; if (curLocation == null || curRol == null) { Util.ShowError("Please enter Rol and Location."); return; } UserByRol relation = new UserByRol { User = View.Model.Record, Location = curLocation }; IList <UserByRol> list = service.GetUserByRol(relation); if (list != null && list.Count > 0) { Util.ShowError("Location was already assigned."); return; } try { relation.Rol = curRol; relation.CreationDate = DateTime.Now; relation.CreatedBy = App.curUser.UserName; relation = service.SaveUserByRol(relation); LoadRol(); } catch (Exception ex) { throw ex; } }
public IList <UserByRol> Pickers_availables(IList <UserByRol> users, IList <ZonePickerRelation> users_zone) { IList <UserByRol> users_availables = users; UserByRol user_remove = null; foreach (ZonePickerRelation ZoneUser in users_zone) { foreach (UserByRol user in users) { if (ZoneUser.Picker.UserID == user.User.UserID) { user_remove = user; } } if (user_remove != null) { users_availables.Remove(user_remove); user_remove = null; } } return(users_availables); }
public UserByRol SelectById(UserByRol data) { return((UserByRol)base.SelectById(data)); }
public Boolean Delete(UserByRol data) { return(base.Delete(data)); }
public Boolean Update(UserByRol data) { return(base.Update(data)); }
public UserByRol Save(UserByRol data) { return((UserByRol)base.Save(data)); }
private void ProcessPrintingLine(DocumentBalance printLine, String printLot, Node node, Bin bin, UserByRol userByRol) { //Tipo De impresion //1. Normal Imprime standar, sin logistica //2. Logistic (Notes tiene data) - imprime normal mas la Logistica Unit logisticUnit = null; //bool printOnlyLogistic = false; if (printLine.Notes != null && printLine.Notes.Contains("Pack")) { string[] dataLogistic = printLine.Notes.Split(':'); //El elemento [1] contiene la unidad logistica, si es cero es custom. if (dataLogistic[2].Equals(WmsSetupValues.CustomUnit)) { try { //trata de encontrar una unidad con ese baseamount logisticUnit = Factory.DaoUnit().Select( new Unit { BaseAmount = printLine.QtyPending, Company = userByRol.Location.Company, ErpCodeGroup = printLine.Unit.ErpCodeGroup } ).First(); } catch { //Obtiene la custom logisticUnit = Factory.DaoUnit().SelectById(new Unit { UnitID = int.Parse(dataLogistic[1]) }); } } else // Si no es Custom { logisticUnit = Factory.DaoUnit().SelectById(new Unit { UnitID = int.Parse(dataLogistic[1]) }); } } //Se ingresa para poder sacar el dato de la company if (printLine.Document == null) { printLine.Document = new Document { Company = userByRol.Location.Company } } ; //CReating Document Line to Send DocumentLine prnLine = new DocumentLine { Product = printLine.Product, Document = printLine.Document, Unit = printLine.Unit, Quantity = printLine.Quantity, CreatedBy = userByRol.User.UserName }; if (logisticUnit != null) { logisticUnit.BaseAmount = printLine.QtyPending; } //Obteniendo el factor logistico antes de enviar a crear los labels double logisticFactor = (logisticUnit != null) ? printLine.QtyPending : 1; //Manda a Crear los Labels IList <Label> resultList = CreateProductLabels(logisticUnit, prnLine, node, bin, logisticFactor, printLot, "", DateTime.Now) .Where(f => f.FatherLabel == null).ToList(); foreach (Label lbl in resultList) { this.listOfLabels.Add(lbl); } }
//Process the lines to Print - OBSOLETE public String GetReplacedTemplate(IList <DocumentBalance> printList, LabelTemplate template, string printLot, UserByRol userByRol) { Factory.IsTransactional = true; string result = ""; Node node = WType.GetNode(new Node { NodeID = NodeType.PreLabeled }); Bin bin = WType.GetBin(new Bin { BinCode = DefaultBin.MAIN, Location = userByRol.Location }); try { foreach (DocumentBalance printLine in printList) { result += ProcessPrintingLine(printLine, template, printLot, node, bin, userByRol); if (template.PrintEmptyLabel == true) { result += template.Empty; } } Factory.Commit(); } catch (Exception ex) { Factory.Rollback(); ExceptionMngr.WriteEvent("GetReplacedTemplate:", ListValues.EventType.Fatal, ex, null, ListValues.ErrorCategory.ErpConnection); throw new Exception(WriteLog.GetTechMessage(ex)); } return(result); }
public IList<Label> GenerateLabelsToPrint(IList<DocumentBalance> printList, String printLot, UserByRol userByRol) { try { SetService(); return SerClient.GenerateLabelsToPrint(printList.ToList(), printLot, userByRol); } catch { throw; } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
public void DeleteUserByRol(UserByRol data) { try { SetService(); SerClient.DeleteUserByRol(data); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
public UserByRol SaveUserByRol(UserByRol data) { try { SetService(); return SerClient.SaveUserByRol(data); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
private void OnAddRol(object sender, EventArgs e) { Rol curRol = View.CboRol.SelectedItem as Rol; Location curLocation = View.CboLocation.SelectedItem as Location; if (curLocation == null || curRol == null) { Util.ShowError("Please enter Rol and Location."); return; } UserByRol relation = new UserByRol { User = View.Model.Record, Location = curLocation }; IList<UserByRol> list = service.GetUserByRol(relation); if (list != null && list.Count > 0) { Util.ShowError("Location was already assigned."); return; } try { relation.Rol = curRol; relation.CreationDate = DateTime.Now; relation.CreatedBy = App.curUser.UserName; relation = service.SaveUserByRol(relation); LoadRol(); } catch (Exception ex) { throw ex; } }
//Carga los datos a Administrar private void OnLoadToAdmin(object sender, DataEventArgs<Zone> e) { if (e.Value == null) return; View.Model.Record = e.Value; View.StkInfo.Visibility = Visibility.Visible; // A. Bins IList<Bin> bins = service.GetBin(new Bin { Location = e.Value.Location }); // Zone= e.Value IList<ZoneBinRelation> bins_zone = service.GetZoneBinRelation(new ZoneBinRelation { Zone = e.Value }); View.Model.SubEntityList = Bins_availables(bins, bins_zone); View.SubEntityList.Items.Refresh(); View.Model.AllowedList = bins_zone; View.AllowedList.Items.Refresh(); View.TxtSearch.Text = ""; // B. Pickers // App.curLocation UserByRol userByRol = new UserByRol { Location = e.Value.Location , Rol = new Rol { RolID = BasicRol.Picker } }; IList<UserByRol> users = service.GetUserByRol(userByRol); IList<ZonePickerRelation> users_zone = service.GetZonePickerRelation(new ZonePickerRelation { Zone = e.Value }); View.Model.PickerList = Pickers_availables(users, users_zone); View.PickerList.Items.Refresh(); View.Model.PickerListReg = users_zone; View.PickerListReg.Items.Refresh(); // C. Entities (criterias admon) View.Model.ClassEntityList = service.GetClassEntity(new ClassEntity { BlnZoneCriteria = true }); View.CriteriaList.ItemsSource = new List<Object>(); View.CriteriaListReg.ItemsSource = new List<Object>(); View.TxtSearchCriteria.Text = ""; }
private void AddOnePicker(UserByRol user) { if (user == null) return; try { ZonePickerRelation zoneUser = new ZonePickerRelation { Zone = View.Model.Record, Picker = user.User, Rank = 0, //bin.Rank, CreatedBy = App.curUser.UserName, CreationDate = DateTime.Today }; zoneUser = service.SaveZonePickerRelation(zoneUser); View.Model.PickerListReg.Insert(0, zoneUser); View.Model.PickerList.Remove(user); } catch (Exception ex) { throw ex; } }
public IList <Label> GenerateLabelsToPrint(IList <DocumentBalance> printList, String printLot, UserByRol userByRol) { Factory.IsTransactional = true; this.listOfLabels = new List <Label>(); Node node = WType.GetNode(new Node { NodeID = NodeType.PreLabeled }); Bin bin = WType.GetBin(new Bin { BinCode = DefaultBin.MAIN, Location = userByRol.Location }); try { foreach (DocumentBalance printLine in printList) { ProcessPrintingLine(printLine, printLot, node, bin, userByRol); } Factory.Commit(); } catch (Exception ex) { Factory.Rollback(); ExceptionMngr.WriteEvent("GenerateLabelsToPrint:", ListValues.EventType.Fatal, ex, null, ListValues.ErrorCategory.Business); throw new Exception(WriteLog.GetTechMessage(ex)); } return((this.listOfLabels.Count > 0) ? this.listOfLabels : null); }
private void OnDelete(object sender, EventArgs e) { if (View.Model.Record == null) { Util.ShowError("No record selected."); return; } try { //Borra las menu Options del Rol y luego el Rol UserByRol mr = new UserByRol { User = View.Model.Record }; foreach (UserByRol mo in service.GetUserByRol(mr)) service.DeleteUserByRol(mo); service.DeleteSysUser(View.Model.Record); Util.ShowMessage("Record deleted."); View.StkEdit.Visibility = Visibility.Hidden; View.Model.EntityList = service.GetSysUser(new SysUser()); } catch(Exception ex) { Util.ShowError(ex.Message); } }
/// <summary> /// Get Print file string to print /// </summary> /// <param name="labels">List of labels to print</param> /// <param name="template">Template to use for the printing</param> /// <returns></returns> public String ProcessPrintingLine(DocumentBalance printLine, LabelTemplate template, String printLot, Node node, Bin bin, UserByRol userByRol) { string result = ""; Status status = WType.GetStatus(new Status { StatusID = EntityStatus.Active }); //Active //Obteniendo el listado de TAGS que se deben reemplazar en el template IList <LabelMapping> labelmappings = Factory.DaoLabelMapping().Select( new LabelMapping { LabelType = template.LabelType }); //Template base //int i; IList <Label> labelList = new List <Label>(); //Tipo De impresion //1. Normal Imprime standar, sin logistica //2. Logistic (Notes tiene data) - imprime normal mas la Logistica Unit logisticUnit = null; if (printLine.Notes != null && printLine.Notes.Contains("Logistic")) { string[] dataLogistic = printLine.Notes.Split(':'); //El primer elemento contiene la unidad logistica. logisticUnit = Factory.DaoUnit().SelectById(new Unit { UnitID = int.Parse(dataLogistic[1]) }); //3. Only print Logistic (notes tiene "ONLYPACK") - no imprime la normal (si las crea), solo imprime las logisticas //if (printLine.Notes.Contains("ONLYPACK")) //printOnlyLogistic = true; } //CReating Document Line to Send DocumentLine prnLine = new DocumentLine { Product = printLine.Product, Document = printLine.Document, Unit = printLine.Unit, Quantity = printLine.Quantity }; //Crea las etiquetas de la cantidad de producto a recibir Logisticas y sus Hijas double logisticFactor = (logisticUnit != null) ? (double)(logisticUnit.BaseAmount / printLine.Unit.BaseAmount) : 1; labelList = CreateProductLabels(logisticUnit, prnLine, node, bin, logisticFactor, printLot, "", DateTime.Now) .Where(f => f.FatherLabel == null).ToList(); //Reemplazando el Header if (template.Header != null) { result += ReplaceTemplate(labelmappings, template.Header, labelList[0]) + Environment.NewLine; } //Reemplazando el Body if (template.Body != null) { foreach (Label label in labelList) { result += ReplaceTemplate(labelmappings, template.Body, label) + Environment.NewLine; } } return(result); }