예제 #1
0
        internal static IList <CATEGORY_TRANSLATION> VerifyIsUniversal(IList <CATEGORY_TRANSLATION> catsT, int id)
        {
            bool isUniversal = TranslationBL.CheckIfUniversal(catsT);
            int  count       = catsT.Count();

            if (isUniversal)
            {
                List <CATEGORY_TRANSLATION> result = new List <CATEGORY_TRANSLATION>();
                catsT[0].categoryId = id;
                //change language with universal
                catsT[0].languageId = LanguageBL.FindUniversalId();

                result.Add(catsT[0]);

                return(result);
            }
            else
            {
                foreach (var item in catsT)
                {
                    item.categoryId = id;
                }
                return(catsT);
            }
        }
예제 #2
0
        internal static IList <MESSAGE_TRANSLATION> VerifyIsUniversal(IList <MESSAGE_TRANSLATION> messagesTrans, int id)
        {
            bool isUniversal = TranslationBL.CheckIfUniversal(messagesTrans);
            int  count       = messagesTrans.Count();

            if (isUniversal)
            {
                List <MESSAGE_TRANSLATION> result = new List <MESSAGE_TRANSLATION>();
                messagesTrans[0].messageId = id;
                //change language with universal
                messagesTrans[0].languageId = LanguageBL.FindUniversalId();

                result.Add(messagesTrans[0]);

                return(result);
            }
            else
            {
                foreach (var item in messagesTrans)
                {
                    item.messageId = id;
                }
                return(messagesTrans);
            }
        }
예제 #3
0
        internal static IList <SHOP_TRANSLATION> VerifyIsUniversal(IList <SHOP_TRANSLATION> shopsTrans, int id)
        {
            bool isUniversal = TranslationBL.CheckIfUniversal(shopsTrans);
            int  count       = shopsTrans.Count();

            if (isUniversal)
            {
                List <SHOP_TRANSLATION> result = new List <SHOP_TRANSLATION>();
                shopsTrans[0].shopId = id;
                //change language with universal
                shopsTrans[0].languageId = LanguageBL.FindUniversalId();

                result.Add(shopsTrans[0]);

                return(result);
            }
            else
            {
                foreach (var item in shopsTrans)
                {
                    item.shopId = id;
                }
                return(shopsTrans);
            }
        }
예제 #4
0
        internal static IList <PRODUCT_TRANSLATION> VerifyIsUniversal(IList <PRODUCT_TRANSLATION> productsTrans, int id)
        {
            bool isUniversal = TranslationBL.CheckIfUniversal(productsTrans);
            int  count       = productsTrans.Count();

            if (isUniversal)
            {
                List <PRODUCT_TRANSLATION> result = new List <PRODUCT_TRANSLATION>();
                productsTrans[0].productId = id;
                //change language with universal
                productsTrans[0].languageId = LanguageBL.FindUniversalId();
                if (productsTrans[0].description == null)
                {
                    productsTrans[0].description = " - ";
                }
                result.Add(productsTrans[0]);

                return(result);
            }
            else
            {
                foreach (var item in productsTrans)
                {
                    item.productId = id;
                }
                return(productsTrans);
            }
        }
예제 #5
0
 internal static IList <SPP_ParentCategoriesTransDistinct_Result> FindCatsParentList(string language)
 {
     using (IDalSearch dal = new DalSearch())
     {
         int lang = LanguageBL.FindIdLanguageByShortForm(language);
         return(dal.GetAllCats(lang));
     }
 }
예제 #6
0
 internal static IList <SPP_ProductTrans_Result> FindProductListByIdCat(string argument, string language)
 {
     using (IDalSearch dal = new DalSearch())
     {
         int id   = int.Parse(argument);
         int lang = LanguageBL.FindIdLanguageByShortForm(language);
         return(dal.GetAllProductByIdCat(id, lang));
     }
 }
예제 #7
0
 internal static IList <SPP_ChildCategoriesOfParent_Result> FindCatsChildList(string argument, string language)
 {
     using (IDalSearch dal = new DalSearch())
     {
         int id   = int.Parse(argument);
         int lang = LanguageBL.FindIdLanguageByShortForm(language);
         return(dal.GetAllCats(id, lang));
     }
 }
예제 #8
0
파일: ProductBL.cs 프로젝트: Zedsk/MyPOS2
 internal static IList <SPP_ProductTrans_Result> FindAllProduct(string language)
 {
     using (IDalProduct dal = new DalProduct())
     {
         int lang;
         if (int.TryParse(language, out int codeL))
         {
             lang = codeL;
         }
         else
         {
             lang = LanguageBL.FindIdLanguageByShortForm(language);
         }
         return(dal.GetAllProduct(lang));
     }
 }
예제 #9
0
파일: TicketBL.cs 프로젝트: Zedsk/MyPOS2
        internal static TrTicketViewModel FillTicket(string numTransaction, string language, bool?isChange)
        {
            using (IDalTransaction dal = new DalTransaction())
            {
                //find transac
                var transac = TransactionBL.FindTransactionById(numTransaction);
                //create ticket
                TrTicketViewModel vm = new TrTicketViewModel();
                int lang;
                if (int.TryParse(language, out int codeL))
                {
                    lang = codeL;
                }
                else
                {
                    lang = LanguageBL.FindIdLanguageByShortForm(language);
                }
                vm.Language = lang.ToString();

                //if rprint search dateTicket
                DateTime d        = new DateTime(2000, 1, 1, 0, 0, 0);
                int      dCompare = DateTime.Compare(transac.transactionDateEnd, d);
                if (dCompare == 0)
                {
                    vm.DateTicket = (DateTime.Now).ToString();
                }
                else
                {
                    vm.DateTicket = transac.transactionDateEnd.ToString();
                }
                //n° transac
                vm.Transaction = numTransaction;
                //shop informations
                vm.Shop = ShopBL.FindShopById(transac.shopId, lang);
                //detail transaction
                var listDetails = TransactionBL.ListDetailsWithTot(numTransaction);
                vm.DetailsListWithTot = TranslationBL.TranslateDetailList(listDetails, lang);
                //discount or not
                if (transac.discountGlobal == null)
                {
                    vm.DiscountG = " - ";
                }
                else
                {
                    var temp      = (transac.discountGlobal * 100).ToString();
                    var tempsplit = temp.Split(',');
                    var discount  = tempsplit[0] + "%";
                    vm.DiscountG = discount;
                }

                ////VAT
                //to do --> provisoire vatId = 2 --> 21%
                int tva = 2;
                vm.VatG = VatBL.FindVatValById(tva);

                //Total transaction
                vm.TotalG = (transac.total).ToString();

                //payment method & amount
                vm.Payments = PaymentBL.FindPaymentsByTransacId(numTransaction);

                ////message
                var messages = FindTicketMessageById(transac.idTransaction, lang, isChange);
                vm.Messages = messages;

                return(vm);
            }
        }
예제 #10
0
 internal static void AddNewTransactionDetail(string codeProduct, string terminal, string transaction, bool minus, string language)
 {
     using (IDalTransaction dal = new DalTransaction())
     {
         //find productId with codeProduct
         PRODUCT prod;
         using (IDalProduct dalP = new DalProduct())
         {
             prod = dalP.GetProductByCode(codeProduct);
         }
         //verify if product exist in detail and Add or Remove itemDetail
         IList <TRANSACTION_DETAILS> detailList = FindTransactionDetailsListById(transaction);
         var result = VerifyProductInDetail(prod.idProduct, detailList);
         if (result)
         {
             //Product exist --> Modify qty
             foreach (var item in detailList)
             {
                 if (item.productId == prod.idProduct)
                 {
                     var newqty = 0;
                     if (minus)
                     {
                         //qty--
                         newqty = item.quantity - 1;
                         if (newqty == 0)
                         {
                             dal.DeleteDetail(item.idTransactionDetails);
                             break;
                         }
                         dal.EditQtyToDetailById(item.idTransactionDetails, newqty);
                         break;
                     }
                     else
                     {
                         //qty++
                         newqty = item.quantity + 1;
                         dal.EditQtyToDetailById(item.idTransactionDetails, newqty);
                         break;
                     }
                 }
             }
         }
         else
         {
             ////Add new detail --> param product, terminalId, transactionId, vatItem
             decimal vatItem;
             using (IDalVat dalV = new DalVat())
             {
                 vatItem = dalV.GetVatValById(prod.vatId);
             }
             int    terminalId    = int.Parse(terminal);
             int    transactionId = int.Parse(transaction);
             int    languageId    = LanguageBL.FindIdLanguageByShortForm(language);
             string name;
             using (IDalProduct dalP = new DalProduct())
             {
                 name = dalP.GetNameProductById(prod.idProduct, languageId);
             }
             dal.CreateDetail(prod, terminalId, transactionId, vatItem, name);
         }
     }
 }