Example #1
0
 public static void ChangePassword(string mail, string password)
 {
     using (BubisDEntities db = new BubisDEntities())
     {
         Users user = db.Users.FirstOrDefault(l => l.USER_Mail.ToLower() == mail.ToLower());
         user.USER_Pass = password;
         db.SaveChanges();
     }
 }
Example #2
0
 public static void SetMonitoringType(Monitoring_Types mnt_type)
 {
     using (BubisDEntities db = new BubisDEntities())
     {
         var mnt = db.Monitoring_Types.First(l => l.MNT_Type == mnt_type.MNT_Type);
         mnt.MNT_Enabled = mnt_type.MNT_Enabled;
         db.SaveChanges();
     }
 }
        public static void VerifyOrderVersion(int id, bool isCurrent)
        {
            using (BubisDEntities db = new BubisDEntities())
            {
                Orders_Versions version = db.Orders_Versions.FirstOrDefault(l => l.VERS_Id == id);
                version.VERS_IsVerify = true;
                version.VERS_IsCurrent = isCurrent;

                db.SaveChanges();
            }
        }
        public static void VerifyOrdersVersions(IEnumerable<int> ids, bool isCurrent)
        {
            using (BubisDEntities db = new BubisDEntities())
            {
                var collAuths = db.Orders_Versions.Where(l => ids.Contains(l.VERS_Id));
                foreach (Orders_Versions version in collAuths)
                {
                    version.VERS_IsVerify = true;
                    version.VERS_IsCurrent = isCurrent;
                }

                db.SaveChanges();
            }
        }
        public void Liquidate(List<SellingCommission> collCommissions)
        {
            // obtengo la última cotización del dolar
            decimal? lastQuotation = AccountsManager.GetLastQuotationU();

            // variables para la recursividad
            SellingCommission commission;
            AccountsConcepts concept;
            AccountsConcepts_Versions concept_version;
            Accounts account;
            Accounts_Versions account_version;

            IEnumerable<int> collIds = collCommissions.Select(l => l.ORDR_Id);
            using (BubisDEntities db = new BubisDEntities())
            {
                var collOrders = db.Orders.Where(l => collIds.Contains(l.ORDR_Id));
                foreach (var order in collOrders)
                {
                    commission = collCommissions.First(l => l.ORDR_Id == order.ORDR_Id);
                    order.ORDR_IsLiquidateForVendor = true;
                    order.ORDR_LiquidateForVendorDate = commission.ORDR_LiquidateDate;
                    order.ORDR_LiquidateForVendorDateRegistered = commission.ORDR_LiquidateDateRegistered;

                    concept = db.AccountsConcepts.Add(new AccountsConcepts() { VERS_MustApprove = false, Accounts_Versions = null, AccountsConcepts_Versions = null });
                    concept_version = db.AccountsConcepts_Versions.Add(new AccountsConcepts_Versions()
                    {
                        VERS_IsVerify = true,
                        VERS_IsCurrent = true,
                        VERS_Active = true,
                        ACT_TYPE_Id = "EPC",
                        ACT_GROUP_Id = "EPC",
                        ACT_CPT_Id = concept.ACT_CPT_Id,
                        ACT_CPT_Description = string.Format("Egresos por Comisión - {0} - {1} - {2} - {3}", commission.VND_Name, commission.COMP_Name, commission.CLT_Name, commission.ORDR_Code),
                        Accounts_Groups = null,
                        Accounts_Types = null,
                        AccountsConcepts = null,
                        Audit = null
                    });

                    account = db.Accounts.Add(new Accounts() { VERS_MustApprove = false, Accounts_Versions = null });
                    account_version = db.Accounts_Versions.Add(new Accounts_Versions()
                    {
                        VERS_IsVerify = true,
                        VERS_IsCurrent = true,
                        VERS_Active = true,
                        ACT_Id = account.ACT_Id,
                        ACT_CPT_Id = concept.ACT_CPT_Id,
                        ACT_Date = commission.ORDR_LiquidateDate.Value,
                        ACT_Amount = commission.VND_Total.Value,
                        ACT_Amount_U__ = commission.VND_Total.Value,
                        ACT_Quotation_U__ = lastQuotation.Value,
                        Accounts = null,
                        AccountsConcepts = null,
                        Audit = null
                    });

                    db.SaveChanges();
                }
            }
        }
 public void UpdateAMLA(int orderId, decimal? amla, int? porc)
 {
     using (BubisDEntities db = new BubisDEntities())
     {
         var order = db.Orders.FirstOrDefault(l => l.ORDR_Id == orderId);
         order.ORDR_AMLAManualForVendor = amla;
         order.ORDR_PorcManualForVendor = porc;
         db.SaveChanges();
     }
 }