public static List <Commons.Premission> Get(Int32?IdRole) { List <Commons.Premission> obj = new List <Commons.Premission>(); using (IndexEntities db = new IndexEntities()) { List <spg_premission_Result> result = db.spg_premission(IdRole).ToList(); result.ForEach(x => { obj.Add(new Commons.Premission() { Id = x.IdPremission, IdParent = x.IdParent, IdRole = x.IdRole, RoleName = x.RoleName, Area = x.Area, Controller = x.Controller, Action = x.Action, Parameters = x.Parameters, Name = x.Name, Description = x.Description }); }); } return(obj); }
public static List <Commons.Reports.ItemReport> Get(Int32 IdCustomer, Int32 IdAccount, Boolean?Product) { List <Commons.Reports.ItemReport> obj = new List <Commons.Reports.ItemReport>(); using (IndexEntities db = new IndexEntities()) { List <spg_Report_Item_Result> result = db.spg_Report_Item(IdCustomer, IdAccount, Product).ToList(); result.ForEach(x => { obj.Add(new Commons.Reports.ItemReport() { IdCustomer = x.IdCustomer, IdAccount = x.IdAccount, IdItem = x.IdItem, ItemName = x.ItemName, ItemDescription = x.ItemDescription, ItemCode = x.ItemCode, ItemBarCode = x.ItemBarCode, AccountingItem = x.AccountingItem, UM_Name = x.UM_Name, IsProduct = x.IsProduct, Formula = x.Formula, CustomerName = x.CustomerName, ImporterCode = x.ImporterCode, Nit = x.Nit, PersonCode = x.PersonCode, Address = x.Address, PhoneNumber = x.PhoneNumber }); }); } return(obj); }
public static List <Commons.PremissionTree> getTree(Int32?IdRole) { List <Commons.PremissionTree> obj = new List <Commons.PremissionTree>(); using (IndexEntities db = new IndexEntities()) { List <spg_PremissionByRole_Result> result = db.spg_PremissionByRole(IdRole).ToList(); List <spg_PremissionByRole_Result> childs = result; result.Where(z => z.IdParent == 0).ToList().ForEach(x => { obj.Add(new Commons.PremissionTree() { Id = x.Id, IdParent = null, Name = x.Name, Assigned = (x.PremissionAssigned == 1) ? true : false, Image = x.Image, HasChildren = getChilds(childs.Where(a => a.IdParent == x.Id).ToList(), IdRole) }); }); } return(obj); }
public static List <Commons.Field> GetDetail(Int32?IdFileInfo) { List <Commons.Field> obj = new List <Commons.Field>(); using (IndexEntities db = new IndexEntities()) { List <spg_FieldsDetailDisplay_Result> result = db.spg_FieldsDetailDisplay(IdFileInfo).ToList(); result.ForEach(x => { obj.Add(new Commons.Field() { Id = x.IdField, IdFileInfoConfig = x.IdFileInfoConfig, IdMaster = x.IdMaster, IdTable = x.IdTable, DataBaseName = x.DataBaseName, FieldName = x.FieldName, HtmlObject = x.ObjectHtml, IsRequeried = x.IsRequeried, IsRequeriedInternal = x.IsRequiredInternal, IsUsed = x.IsUsed, Label = x.Label, TableName = x.TableName }); }); } return(obj); }
public static List <Commons.Menu> Get(String RoleName, String UserName) { List <Commons.Menu> obj = new List <Commons.Menu>(); using (IndexEntities db = new IndexEntities()) { List <spg_Menu_Result> allPremission = db.spg_Menu().ToList(); List <spg_MenuByUser_Result> assignedPremission = db.spg_MenuByUser(RoleName, UserName).ToList(); treeData = new List <spg_MenuByUser_Result>(); OrderParents(allPremission, assignedPremission); } if (treeData != null && treeData.Count > 0) { treeData.ForEach(x => { obj.Add(new Commons.Menu() { Id = x.Id, Description = x.Description, Name = x.Name, Action = x.Action, Area = x.Area, Controller = x.Controller, IdParent = x.IdParent, Image = x.Image, Order = x.Order, Parameters = x.Parameters, ShowMenu = x.ShowMenu, HasCredentials = x.HasCredentials }); }); } return(obj.OrderBy(x => x.Order).ToList()); }
public static List <Commons.Formula> Get(Int32?IdFormula, Int32?IdCustomer, Int32?IdMainItem) { List <Commons.Formula> obj = new List <Commons.Formula>(); using (IndexEntities db = new IndexEntities()) { List <spg_Formula_Result> result = db.spg_Formula(IdFormula, IdCustomer, IdMainItem).ToList(); result.ForEach(x => { obj.Add(new Commons.Formula() { Id = x.Id, IdMainItem = x.IdMainItem, MainItem = x.MainItem, IdDetailItem = x.IdDetailItem, DetailItem = x.DetailItem, Quantity = x.Quantity, Decrease = x.Decrease, IdCustomer = x.IdCustomer, DisplayDetailItem = x.DisplayDetailItem, DetailAccountingItem = x.DetailAccountingItem, DisplayDetailAccountingItem = (x.DetailAccountingItem == null) ? "" : x.DisplauDetailAccountingItem, Active = x.Active }); }); } return(obj); }
public static List <Commons.Dashboard.ExpiredDetail> GetExpiredDetail(Int32 IdCustomer, Int32 IdAccount) { List <Commons.Dashboard.ExpiredDetail> obj = new List <Commons.Dashboard.ExpiredDetail>(); using (IndexEntities db = new IndexEntities()) { List <spg_DashboardExpiredDetail_Result> result = db.spg_DashboardExpiredDetail(IdCustomer, IdAccount).ToList(); result.ForEach(x => { obj.Add(new Commons.Dashboard.ExpiredDetail() { IdFileHeader = x.IdFileHeader, Document = x.Document, IdState = x.IdState, StateName = x.StateName, StartDate = x.StartDate, EndDate = x.EndDate, Days = x.Days, Label = x.Label }); }); } return(obj); }
public static List <Commons.Reports.FormulaReport> Get(Int32 IdCustomer, Int32 IdAccount, Int32?IdMainItem) { List <Commons.Reports.FormulaReport> obj = new List <Commons.Reports.FormulaReport>(); using (IndexEntities db = new IndexEntities()) { List <spg_Report_Formula_Result> result = db.spg_Report_Formula(IdCustomer, IdAccount, IdMainItem).ToList(); result.ForEach(x => { obj.Add(new Commons.Reports.FormulaReport() { Id_Formula = x.Id_Formula, Id_Producto = x.Id_Producto, Id_Materia_Prima = x.Id_Materia_Prima, Cantidad = x.Cantidad, Cantidad_Merma = x.Cantidad_Merma, Des_Producto = x.Des_Producto, Codigo_Producto = x.Codigo_Producto, Partida_Producto = x.Partida_Producto, Des_Materia = x.Des_Materia, Codigo_Materia = x.Codigo_Materia, Partida_Materia = x.Partida_Materia, Nombre_Cliente = x.Nombre_Cliente, Nit_Cliente = x.Nit_Cliente, Direccion = x.Direccion, Telefono = x.Telefono, Codigo_Cliente = x.Codigo_Cliente, Des_Unidad_Producto = x.Des_Unidad_Producto, Des_Unidad_Materia = x.Des_Unidad_Materia }); }); } return(obj); }
public static List <Commons.FileInfoConfig> GetConfig(Int32?IdFileInfoConfig, Int32?IdFileInfo, Int32?IdAccount) { List <Commons.FileInfoConfig> obj = new List <Commons.FileInfoConfig>(); using (IndexEntities db = new IndexEntities()) { List <spg_FileInfoConfig_Result> result = db.spg_FileInfoConfig(IdFileInfoConfig, IdFileInfo, IdAccount).ToList(); result.ForEach(x => { obj.Add(new Commons.FileInfoConfig() { Id = x.IdFileInfoConfig, IdFileInfo = x.IdFileInfo, FileInfoName = x.FileInfoName, IdFileInfoType = x.IdFileType, FileInfoTypeName = x.FileTypeName, IdAccount = x.IdAccount, AccountName = x.AccountName, DropDownName = x.DropDownListName, Addition = (x.IsSubstract == true) ? false : true, Substraction = (x.IsSubstract == true) ? true : false, UseAttached = x.UseAttached, UseRawMaterial = x.LoadRawMaterial, Transmissible = x.Transmissible, UseExpired = x.UseExpired, Active = x.Active }); }); } return(obj); }
public static Commons.DischargeParameters GetParameters(Int32 IdFileDetail) { Commons.DischargeParameters obj = new Commons.DischargeParameters(); using (IndexEntities db = new IndexEntities()) { spg_DischargeParameters_Result result = db.spg_DischargeParameters(IdFileDetail).FirstOrDefault(); if (result != null) { obj = new Commons.DischargeParameters() { IdFileDetail = result.IdFileDetail, TransactionLine = result.TransactionLine, IdFileInfoConfig = result.IdFileInfoConfig, IdFileHeader = result.IdFileHeader, IdDocument = result.IdDocument, DocumentName = result.DocumentName, IdCustomer = result.IdCustomer, CustomerName = result.CustomerName, AccountingItem = result.AccountingItem, IdItem = result.IdItem, Code = result.Code, ItemName = result.ItemName, IdAccount = result.IdAccount, AccountName = result.AccountName, UseFormula = result.UseFormula, IsSubstract = result.IsSubstract, LoadRawMaterial = result.LoadRawMaterial }; } } return(obj); }
public static List <Commons.Freeze> GetSingle(Int32 IdFileDetail) { List <Commons.Freeze> obj = new List <Commons.Freeze>(); using (IndexEntities db = new IndexEntities()) { List <spg_FreezeRegister_Result> result = db.spg_FreezeRegister(IdFileDetail).ToList(); result.ForEach(x => { obj.Add(new Commons.Freeze() { Id = x.IdFileDetail, ItemName = x.ItemName, TransactionLine = x.TransactionLine, Quantity = x.Quantity, Stock = (Decimal)x.Stock, Discharge = x.Discharge, Balance = (x.Balance == null) ? 0 : (Decimal)x.Balance, IsFrozen = (Boolean)x.IsFrozen }); }); } return(obj); }
public static List <Commons.Resolution> Get(Int32?IdResolution, Int32?IdCustomer, Int32?IdAccount) { List <Commons.Resolution> obj = new List <Commons.Resolution>(); using (IndexEntities db = new IndexEntities()) { List <spg_Resolution_Result> result = db.spg_Resolution(IdResolution).ToList(); result.ForEach(x => { obj.Add(new Commons.Resolution() { Id = x.Id, IdCustomer = x.IdCustomer, IdAccount = x.IdAccount, Name = x.Name, Description = x.Description, RateDate = x.RateDate }); }); } if (IdCustomer != null) { obj = obj.Where(x => x.IdCustomer == IdCustomer).ToList(); } if (IdAccount != null) { obj = obj.Where(x => x.IdAccount == x.IdAccount).ToList(); } return(obj); }
public static Commons.User MobileLogin(Commons.UserLogin model) { Commons.User obj = new Commons.User(); using (IndexEntities db = new IndexEntities()) { sp_MobileLogin_Result result = db.sp_MobileLogin(model.Username, Functionalities.Security.Cryptography.Encrypt(model.Password)).FirstOrDefault(); if (result != null) { obj.Id = result.IdPerson; obj.FirstName = result.FirstName; obj.LastName = result.LastName; obj.Nit = result.Nit; obj.SitePassword = result.SitePassword; obj.PasswordReset = result.PasswordReset; obj.OAuthSite = result.OAuthSite; obj.OAuthMobile = result.OAuthMobile; obj.Active = result.Active; obj.UserName = result.UserName; obj.Roles = Role.Get(result.UserName); } else { obj = null; } } return(obj); }
private static List <Commons.AccountingItemTree> getChilds(List <spg_AccountingItemTree_Result> data, Int32?IdResolution, List <spg_AccountingItemTree_Result> totalData) { List <Commons.AccountingItemTree> result = new List <Commons.AccountingItemTree>(); using (IndexEntities db = new IndexEntities()) { data.ForEach(x => { result.Add(new Commons.AccountingItemTree() { Id = x.Id, AccountingItem_ = x.AccountingItem, Description = x.AccountingItem + " - " + x.Description, Parent = x.Parent, Level = x.Level, CustomDuties = x.CustomDuties, Usable = x.Usable, Assigned = x.Assigned, //HasChildren = getChilds(db.spg_AccountingItemTree(IdResolution).Where(b => b.Parent == x.AccountingItem).ToList(), IdResolution) HasChildren = getChilds(totalData.Where(y => y.Parent == x.AccountingItem).ToList(), IdResolution, totalData) }); }); } return(result); }
public static List <Commons.AccountingItem> Get(Int32?IdAccountingItem, Int32?IdResolution) { List <Commons.AccountingItem> obj = new List <Commons.AccountingItem>(); using (IndexEntities db = new IndexEntities()) { List <spg_AccountingItems_Result> result = db.spg_AccountingItems(IdAccountingItem, IdResolution).ToList(); result.ForEach(x => { obj.Add(new Commons.AccountingItem() { Id = x.Id, IdResolution = x.IdResolution, ResolutionName = x.ResolutionName, AccountingItem_ = x.AccountingItem, Description = x.Description, Parent = x.Parent, IdParent = x.IdParent, ParentDescription = x.ParentDescription, Level = x.Level, CustomDuties = x.CustomDuties, Usable = x.Usable, AccountingItemDisplay = x.AccountingItemDisplay, ParentAccountingItem = x.ParentAccountingItem, ParentAccountingItemDisplay = x.ParentAccountingItemDisplay }); }); } return(obj); }
public static List <Commons.AccountingItemTree> getTree(Int32?IdResolution) { List <Commons.AccountingItemTree> obj = new List <Commons.AccountingItemTree>(); using (IndexEntities db = new IndexEntities()) { List <spg_AccountingItemTree_Result> result = db.spg_AccountingItemTree(IdResolution).ToList(); List <spg_AccountingItemTree_Result> childs = result; result.Where(z => z.Parent == null).ToList().ForEach(x => { obj.Add(new Commons.AccountingItemTree() { Id = x.Id, AccountingItem_ = x.AccountingItem, Description = x.AccountingItem + " - " + x.Description, Parent = x.Parent, Level = x.Level, CustomDuties = x.CustomDuties, Usable = x.Usable, Assigned = x.Assigned, HasChildren = getChilds(childs.Where(a => a.Parent == x.AccountingItem).ToList(), IdResolution, result) }); }); } return(obj); }
public static List <Commons.Customer> Get(Int32?IdCustomer) { List <Commons.Customer> obj = new List <Commons.Customer>(); using (IndexEntities db = new IndexEntities()) { List <spg_Customer_Result> result = db.spg_Customer(IdCustomer, true).ToList(); result.ForEach(x => { obj.Add(new Commons.Customer() { Id = x.IdPerson, EnterpriseName = x.Name, Nit = x.Nit, LegalRepresentative = x.LegalRepresentative, PersonCode = x.PersonCode, ImporterCode = x.ImporterCode, ExporterCode = x.ExporterCode, BondEndDate = x.BondEndDate, Observations = x.Observations }); }); } return(obj); }
public static List <Commons.Adjustment> Get(Int32 IdFileDetailStock, Int32 IdFileDetailSubstract) { List <Commons.Adjustment> obj = new List <Commons.Adjustment>(); using (IndexEntities db = new IndexEntities()) { List <spg_Adjustment_Result> result = db.spg_Adjustment(IdFileDetailStock, IdFileDetailSubstract).ToList(); result.ForEach(x => { obj.Add(new Commons.Adjustment() { IdFileItemDischarge = x.IdFileItemDischarge, IdFileDetailSubstract = x.IdFileDetailSubstract, IdFileDetailStock = x.IdFileDetailStock, IdItem = x.IdItem, IdState = x.IdState, StateName = x.StateName, Quantity = x.Quantity, Decrease = x.Decrease, RegisterDate = x.RegisterDate }); }); } return(obj); }
public static List <Commons.DischargeRawMaterial> GetRawMaterials(Int32 IdFileDetail, Int32 IdAccount, Int32 IdCustomer, Int32 IdItem, Boolean UseFormula) { List <Commons.DischargeRawMaterial> obj = new List <Commons.DischargeRawMaterial>(); using (IndexEntities db = new IndexEntities()) { List <spg_DischargeRawMaterial_Result> result = db.spg_DischargeRawMaterial(IdFileDetail, IdAccount, IdCustomer, IdItem, UseFormula).ToList(); result.ForEach(x => { obj.Add(new Commons.DischargeRawMaterial() { IdFileDetail = x.IdFileDetail, IdFormula = x.IdFormula, IdParentItem = x.IdParentItem, IdItem = x.IdItem, AccountingItem = x.AccountingItem, ItemName = x.ItemName, Quantity = x.Quantity, Decrease = x.Decrease, UseFormula = x.UseFormula, CurrentQuantity = x.CurrentQuantity, CurrentDecrease = x.CurrentDecrease, QuantityLabel = (x.UseFormula == true) ? FormatDecimal(x.CurrentQuantity, "#.000") + "/" + FormatDecimal(x.Quantity, "#.000") : FormatDecimal(x.CurrentQuantity, "#.000"), DecreaseLabel = (x.UseFormula == true) ? FormatDecimal(x.CurrentDecrease, "#.000") + "/" + FormatDecimal(x.Decrease, "#.000") : FormatDecimal(x.CurrentDecrease, "#.000"), DisplayAccountingItem = x.DisplayAccountingItem, DisplayItemName = x.DisplayItemName }); }); } return(obj); }
public static Commons.Parameters Get() { Commons.Parameters obj = new Commons.Parameters(); using (IndexEntities db = new IndexEntities()) { spg_Parameters_Result result = db.spg_Parameters().FirstOrDefault(); obj.IVA = result.IVA; obj.ExpirateDateMonts = result.ExpirateDateMonts; obj.DefaultCurrency = result.DefaultCurrency; obj.OpaFrecuencySeconds = result.OpaFrecuencySeconds; obj.OpaDelaySeconds = result.OpaDelaySeconds; obj.OpaServiceUrl = result.OpaServiceUrl; obj.OpaServiceUser = result.OpaServiceUser; obj.OpaServicePassword = result.OpaServicePassword; obj.DaysToExpire = result.DaysToExpire; obj.MailingUser = result.MailingUser; obj.MailingPassword = result.MailingPassword; obj.MailingServer = result.MailingServer; obj.MailingPort = result.MailingPort; obj.MailingUseSsl = result.MailingUseSsl; obj.MailingDisplayName = result.MailingDisplayName; obj.MailingIsHtml = result.MailingIsHtml; obj.OpaEmailBody = result.OpaEmailBody; obj.MailingCC = result.MailingCC; obj.MailingCCO = result.MailingCCO; } return(obj); }
public static List <Commons.User> Get(String UserName) { List <Commons.User> obj = new List <Commons.User>(); using (IndexEntities db = new IndexEntities()) { List <spg_User_Result> result = db.spg_User(UserName).ToList(); result.ForEach(x => { obj.Add(new Commons.User() { Id = x.IdPerson, FirstName = x.FirstName, LastName = x.LastName, Nit = x.Nit, UserName = x.UserName, SitePassword = Functionalities.Security.Cryptography.Decrypt(x.SitePassword), Active = x.Active, MobilePassword = Functionalities.Security.Cryptography.Decrypt(x.MobilePassword), OAuthMobile = x.OAuthMobile, OAuthSite = x.OAuthSite, PasswordReset = x.PasswordReset }); }); } return(obj); }
public static List <Commons.DischargeResume> GetResume(Int32 IdFileDetail) { List <Commons.DischargeResume> obj = new List <Commons.DischargeResume>(); using (IndexEntities db = new IndexEntities()) { List <spg_DischargeDetailResume_Result> result = db.spg_DischargeDetailResume(IdFileDetail).ToList(); result.ForEach(x => { obj.Add(new Commons.DischargeResume() { Id = x.Id, IdFileHeader = x.IdFileHeader, IdFileDetailSubstract = x.IdFileDetailSubstract, IdFileDetailStock = x.IdFileDetailStock, IdState = x.IdState, IdItem = x.IdItem, TransactionLine = (Int32)x.TransactionLine, DocumentName = x.DocumentName, InventoryQuantity = x.InventoryQuantity, Stock = x.Stock, Quantity = x.Quantity, Decrease = x.Decrease, ItemName = x.ItemName, AccountingItem = x.AccountingItem, Cif = x.CIFcost, Dai = (Decimal)x.CustomDuties, Iva = x.Iva, StateName = x.StateName, TransactionDate = x.TransactionDate }); }); } return(obj); }
public static Boolean ItemStartEnd(spg_QueueItems_Result model, Boolean IsStart) { using (IndexEntities db = new IndexEntities()) { db.spu_ItemStartEndProccessTime(model.IdOpaDetail, IsStart); return(true); } }
public static Boolean SetDocumentStateChange(spg_Queue_Result model, Int32 IdState) { using (IndexEntities db = new IndexEntities()) { db.spu_DocumentChangeState(model.IdOpaHeader, IdState); return(true); } }
public static Boolean SetItemStateChange(spg_QueueItems_Result model) { using (IndexEntities db = new IndexEntities()) { db.spu_ItemChangeState(model.IdOpaDetail, model.IdState); return(true); } }
public static Boolean SetDocumentToProccess(spg_Queue_Result model) { using (IndexEntities db = new IndexEntities()) { db.spu_BatchToProccess(model.IdOpaHeader); return(true); } }
public static Boolean IsProccessExists() { using (IndexEntities db = new IndexEntities()) { Boolean result = (Boolean)db.spg_Execute().FirstOrDefault(); return(result); } }
public static Boolean DocumentStartEnd(spg_Queue_Result model, Boolean IsStart) { using (IndexEntities db = new IndexEntities()) { db.spu_DocumentStartEndProccessTime(model.IdOpaHeader, IsStart); return(true); } }
public static List <Commons.FileHeader> Get(Int32?IdFileHeader, Int32?IdCustomer, Int32?IdAccount, Int32?IdFileInfoConfig) { List <Commons.FileHeader> obj = new List <Commons.FileHeader>(); using (IndexEntities db = new IndexEntities()) { List <spg_FileHeader_Result> result = db.spg_FileHeader(IdFileHeader, IdCustomer, IdAccount, IdFileInfoConfig).ToList(); result.ForEach(x => { obj.Add(new Commons.FileHeader() { Id = x.Id, IdCustomer = x.IdCustomer, IdFileInfoConfig = x.IdFileInfoConfig, FileInfoName = x.FileName, Operation = x.Operation, LoadRawMaterial = x.LoadRawMaterial, IsSubstract = x.IsSubstract, IdDocument = x.IdDocument, AuthorizationDate = x.AuthorizationDate, ExpantionDate = x.ExpantionDate, ExpirationDate = x.ExpirationDate, DocumentDate = x.DocumentDate, ArrivalDate = x.ArrivalDate, ExchangeRate = x.ExchangeRate, Insurance = x.Insurance, Cargo = x.Cargo, IdCustom = x.IdCustom, CustomName = x.CustomName, IdCountry = x.IdCountry, CountryName = x.CountryName, IdWarranty = x.IdWarranty, WarrantyName = x.WarrantyName, IdCellar = x.IdCellar, CellarName = x.CellarName, IdState = x.IdState, StateName = x.StateName, IdCurrency = x.IdCurrency, CurrencyName = x.CurrencyName, IdResolution = x.IdResolution, ResolutionName = x.ResolutionName, IdAccount = x.IdAccount, AccounName = x.AccountName, Reviewed = x.Reviewed, RegisterUser = x.RegisterUser, CreateDate = x.CreateDate, UpdateDate = x.UpdateDate, CifTotal = x.CIFTotal, LinesTotal = x.LinesTotal, UseAttached = x.UseAttached, Facturas = x.Facturas, ConfigActive = x.ConfigActive }); }); } return(obj); }
public static Boolean Delete(Commons.User model) { using (IndexEntities db = new IndexEntities()) { db.spd_user(model.UserName); } return(true); }