private Client ClientInit(string firstName, string lastName, ClientCategory category)
        {
            Client client = ClientInit(firstName, lastName);

            client.Category = category;
            return(client);
        }
Пример #2
0
        public void BookAvailable_Test()
        {
            dal.AddNewBook("1234567", "Book title", 1, false);
            Book book = dal.GetBookByISBN("1234567");

            ClientCategory clientCategory = new ClientCategory()
            {
                ClientCategoryName = "cat",
                MaxLoans           = 1,
                LoanDuration       = 3
            };

            Client client = new Client()
            {
                FirstName = "fn",
                LastName  = "ln",
                CIN       = "cin1",
                Category  = clientCategory,
                Email     = "email",
            };

            dal.AddNewClient(client);

            Assert.IsTrue(dal.BookAvailable("1234567"));
            dal.CreateLoan(client, book, 2);
            Assert.IsFalse(dal.BookAvailable("1234567"));
        }
Пример #3
0
        public static ClientCategory GetClientCategory(string cat)
        {
            ClientCategory clientCategory = ClientCategory.Particulier;

            switch (cat)
            {
            case "particulier":
                clientCategory = ClientCategory.Particulier;
                break;

            case "organisatie":
                clientCategory = ClientCategory.Organisation;
                break;

            case "vip":
                clientCategory = ClientCategory.Vip;
                break;

            case "concertpromotor":
                clientCategory = ClientCategory.ConcertPromotor;
                break;

            case "huwelijksplanner":
                clientCategory = ClientCategory.WeddingPlanner;
                break;

            case "evenementenbureau <":
                clientCategory = ClientCategory.EventBureau;
                break;
            }
            return(clientCategory);
        }
Пример #4
0
        private void con_OnIq(object sender, IQ iq)
        {
            if (iq.Query != null)
            {
                if (iq.Query is DiscoInfo && iq.Type == IqType.get)
                {
                    /*
                     * <iq type='get'
                     *  from='[email protected]/orchard'
                     *  to='plays.shakespeare.lit'
                     *  id='info1'>
                     * <query xmlns='http://jabber.org/protocol/disco#info'/>
                     * </iq>
                     */
                    iq.SwitchDirection();
                    iq.Type = IqType.result;

                    DiscoInfo di = iq.Query as DiscoInfo;

                    if (ClientName != null)
                    {
                        di.AddIdentity(new DiscoIdentity(ClientCategory.ToString(), this.ClientName, "client"));
                    }

                    foreach (string feature in ClientFeatures)
                    {
                        di.AddFeature(new DiscoFeature(feature));
                    }

                    xmppCon.Send(iq);
                }
            }
        }
        public void GetClientsOfCategory_test()
        {
            ClientCategory studentCategory = new ClientCategory()
            {
                ClientCategoryName = "Student",
                LoanDuration       = 15,
                MaxLoans           = 1
            };
            ClientCategory teacherCategory = new ClientCategory()
            {
                ClientCategoryName = "Teacher",
                LoanDuration       = 30,
                MaxLoans           = 2
            };

            Client client1 = ClientInit("Will", "Smith", studentCategory);
            Client client2 = ClientInit("John", "Brown", teacherCategory);
            Client client3 = ClientInit("Steave", "Davis", teacherCategory);

            dal.AddNewClient(client1);
            dal.AddNewClient(client2);
            dal.AddNewClient(client3);

            List <Client> clients = dal.GetClientsOfCategory(teacherCategory);

            Assert.AreEqual(clients.Count, 2);
        }
Пример #6
0
        protected override void Up()
        {
            this.RunCode(db =>
            {
                var ccRepo = RF.Concrete <ClientCategoryRepository>();
                var cclist = ccRepo.GetAll();
                if (cclist.Count == 0)
                {
                    using (var tran = RF.TransactionScope(ccRepo))
                    {
                        var supplier = new ClientCategory {
                            Name = ClientCategory.SupplierName
                        };
                        var customer = new ClientCategory {
                            Name = ClientCategory.CustomerName
                        };
                        RF.Save(supplier);
                        RF.Save(customer);

                        var clientRepo = RF.Concrete <ClientInfoRepository>();
                        clientRepo.Save(new ClientInfo
                        {
                            ClientCategory = supplier,
                            Name           = "新新服装加工厂",
                            FaRenDaiBiao   = "新新",
                            YouXiang       = "*****@*****.**",
                            KaiHuYinHang   = "中国银行",
                        });
                        clientRepo.Save(new ClientInfo
                        {
                            ClientCategory = supplier,
                            Name           = "乐多食品加工厂",
                            FaRenDaiBiao   = "乐多",
                            YouXiang       = "*****@*****.**",
                            KaiHuYinHang   = "中国银行",
                        });
                        clientRepo.Save(new ClientInfo
                        {
                            ClientCategory = supplier,
                            Name           = "腾飞服装有限公司",
                            FaRenDaiBiao   = "腾飞",
                            YouXiang       = "*****@*****.**",
                            KaiHuYinHang   = "中国银行",
                        });
                        clientRepo.Save(new ClientInfo
                        {
                            ClientCategory = customer,
                            Name           = "好又多商场",
                            FaRenDaiBiao   = "李海",
                            ShouJiaJiBie   = ShouJiaJiBie.JiBie_2,
                            YouXiang       = "*****@*****.**",
                            KaiHuYinHang   = "中国银行",
                        });

                        tran.Complete();
                    }
                }
            });
        }
Пример #7
0
 public Client(int clientNumber, string name, string taxNumber, ClientCategory clientCategory, Address address)
 {
     this.ClientNumber   = clientNumber;
     this.Name           = name;
     this.TaxNumber      = taxNumber;
     this.ClientCategory = clientCategory;
     this.Address        = address;
 }
Пример #8
0
        public ActionResult Update(ClientCategory category)
        {
            var cat = CSDLQLBH.GetSingleCategory(category.CatID);

            cat.CatName = category.CatName;
            CSDLQLBH.UpdateCategory(cat);
            return(RedirectToAction("Index"));
        }
Пример #9
0
        public ActionResult DeleteConfirmed(int id)
        {
            ClientCategory clientCategory = db.ClientCategories.Find(id);

            db.ClientCategories.Remove(clientCategory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public void AddNewClientCategory_test()
        {
            ClientCategory category = CategoryInit("Student", 15, 1);

            dal.AddNewClientCategory(category);

            Assert.AreEqual(dal.GetClientCategories().Count, 1);
        }
Пример #11
0
        // GET: ManagerCat/Add
        public ActionResult Add()
        {
            var c = new ClientCategory
            {
                CatName = "cat"
            };

            return(View(c));
        }
Пример #12
0
        public ActionResult Create(Client cc, HttpPostedFileBase file)
        {
            //file upload

            if (file != null && file.ContentLength > 0)
            {
                try
                {
                    string path = Path.Combine(Server.MapPath("~/Content/ProfilePictures/"),
                                               Path.GetFileName(file.FileName));
                    file.SaveAs(path);
                    ViewBag.Message = "File uploaded successfully";
                    cc.logo         = file.FileName;
                }
                catch (Exception ex)
                {
                    ViewBag.Message = "ERROR:" + ex.Message.ToString();
                    return(View());
                }
            }
            else
            {
                ViewBag.Message = "You have not specified a file.";
                return(View());
            }


            //client category affectation
            ClientCategory category = new ClientCategory
            {
                name = Request.Form["category"]
            };

            cc.clientCategory = category;

            try
            {
                HttpClient client = new HttpClient();
                //  var token=   Session["token"].ToString();

                // client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
                cc.clientType      = "NEW_CLIENT";
                client.BaseAddress = new Uri("http://localhost:18080/21meeseeks-web/rest/");

                client.PostAsJsonAsync <Client>("client", cc).ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode());
                System.Threading.Thread.Sleep(3000);


                // TODO: Add insert logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Пример #13
0
 public ActionResult Edit([Bind(Include = "ClientCat_ID,ClientCat_Type")] ClientCategory clientCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(clientCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(clientCategory));
 }
Пример #14
0
        protected override void Up()
        {
            this.RunCode(db =>
            {
                var ccRepo = RF.Concrete<ClientCategoryRepository>();
                var cclist = ccRepo.GetAll();
                if (cclist.Count == 0)
                {
                    using (var tran = RF.TransactionScope(ccRepo))
                    {
                        var supplier = new ClientCategory { Name = ClientCategory.SupplierName };
                        var customer = new ClientCategory { Name = ClientCategory.CustomerName };
                        RF.Save(supplier);
                        RF.Save(customer);

                        var clientRepo = RF.Concrete<ClientInfoRepository>();
                        clientRepo.Save(new ClientInfo
                        {
                            ClientCategory = supplier,
                            Name = "新新服装加工厂",
                            FaRenDaiBiao = "新新",
                            YouXiang = "*****@*****.**",
                            KaiHuYinHang = "中国银行",
                        });
                        clientRepo.Save(new ClientInfo
                        {
                            ClientCategory = supplier,
                            Name = "乐多食品加工厂",
                            FaRenDaiBiao = "乐多",
                            YouXiang = "*****@*****.**",
                            KaiHuYinHang = "中国银行",
                        });
                        clientRepo.Save(new ClientInfo
                        {
                            ClientCategory = supplier,
                            Name = "腾飞服装有限公司",
                            FaRenDaiBiao = "腾飞",
                            YouXiang = "*****@*****.**",
                            KaiHuYinHang = "中国银行",
                        });
                        clientRepo.Save(new ClientInfo
                        {
                            ClientCategory = customer,
                            Name = "好又多商场",
                            FaRenDaiBiao = "李海",
                            ShouJiaJiBie = ShouJiaJiBie.JiBie_2,
                            YouXiang = "*****@*****.**",
                            KaiHuYinHang = "中国银行",
                        });

                        tran.Complete();
                    }
                }
            });
        }
        public ClientCategoryDTO BuildClientCategoryDTO(ClientCategory category)
        {
            var categoryDTO = new ClientCategoryDTO {
                CategoryId   = category.CategoryId,
                CategoryName = category.CategoryName,
                CreatedAt    = category.RegisterDate,
                Active       = category.Active
            };

            return(categoryDTO);
        }
Пример #16
0
        public ActionResult Create([Bind(Include = "ClientCat_ID,ClientCat_Type")] ClientCategory clientCategory)
        {
            if (ModelState.IsValid)
            {
                db.ClientCategories.Add(clientCategory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(clientCategory));
        }
Пример #17
0
 public async Task <ClientCategory> PostClientCategory(ClientCategory category)
 {
     _context.ClientCategories.Add(category);
     try
     {
         await _context.SaveChangesAsync();
     }
     catch
     {
         return(null);
     }
     return(category);
 }
 public async Task <bool> UpdateClientCategory(ClientCategory category)
 {
     _context.Entry(category).State = EntityState.Modified;
     try
     {
         await _context.SaveChangesAsync();
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Пример #19
0
 public async Task <bool> UpdateClientCategory(ClientCategory category)
 {
     _context.ClientCategories.Update(category);
     try
     {
         await _context.SaveChangesAsync();
     }
     catch
     {
         return(false);
     }
     return(true);
 }
        public ActionResult Create(ClientCategory cc)
        {
            HttpClient client = new HttpClient();

            //  var token=   Session["token"].ToString();

            // client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);

            client.BaseAddress = new Uri("http://localhost:18080/21meeseeks-web/rest/");

            client.PostAsJsonAsync <ClientCategory>("client/category", cc).ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode());
            System.Threading.Thread.Sleep(3000);
            return(RedirectToAction("Settings", "Home", new { area = "" }));
        }
Пример #21
0
        // GET: ClientCategories/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ClientCategory clientCategory = db.ClientCategories.Find(id);

            if (clientCategory == null)
            {
                return(HttpNotFound());
            }
            return(View(clientCategory));
        }
Пример #22
0
        public async Task <IActionResult> GetCategory(int id)
        {
            ClientCategory categoryFromDatabase = await _bdRepository.GetClientCategory(id);

            if (logicValidations.ValidateIfDataIsNotNull(categoryFromDatabase))
            {
                CategoriesDTO categoryDTO = new CategoriesDTO()
                {
                    CategoryId   = categoryFromDatabase.CategoryId,
                    CategoryName = categoryFromDatabase.CategoryName,
                    Active       = categoryFromDatabase.Active
                };
                return(Ok(categoryDTO));
            }
            return(NotFound());
        }
        public async Task <IActionResult> PostCategory(ClientCategory category)
        {
            var logicValidation = new LogicValidations();

            var categoryFromDatabase = await _DominiRepository.PostClientCategory(category);

            if (logicValidation.IsNotNull(categoryFromDatabase))
            {
                var categoryDTO = new CategoriesDTO(categoryFromDatabase);
                return(Ok(categoryDTO));
            }
            else
            {
                return(BadRequest());
            }
        }
        protected void btn_submit_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (btn_submit.InnerText == "Submit")
                {
                    ClientCategory clientCategory = new ClientCategory
                    {
                        Active = true,
                        ClientCategoryDescription = txtclientCategoryNamedesc.Value,
                        ClientCategoryName        = txtclientCategoryName.Value,
                        dateadded = DateTime.Now,
                        UserID    = 1
                    };
                    FileTrackingContainer entities = new FileTrackingContainer();
                    entities.ClientCategories.Add(clientCategory);
                    entities.SaveChanges();
                    ResetCotrols();
                    BindData();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                            "toastr.success('ClientCategory Added Sucessfully');", true);
                }
                else if (btn_submit.InnerText == "Update")
                {
                    using (FileTrackingContainer container = new FileTrackingContainer())
                    {
                        var id             = int.Parse(hdnClientId.Value);
                        var resultToUpdate =
                            container.ClientCategories.SingleOrDefault(item => item.ClientId == id);

                        if (resultToUpdate != null)
                        {
                            resultToUpdate.ClientCategoryDescription = txtclientCategoryNamedesc.Value;
                            resultToUpdate.ClientCategoryName        = txtclientCategoryName.Value;
                            resultToUpdate.dateLastModified          = DateTime.Now;
                        }
                        container.SaveChanges();
                        ResetCotrols();
                        BindData();
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Пример #25
0
        public async Task <IActionResult> DeleteCategory(int id)
        {
            ClientCategory categoryFromDatabase = await _bdRepository.GetClientCategory(id);

            if (!logicValidations.ValidateIfDataIsNotNull(categoryFromDatabase))
            {
                return(NotFound());
            }

            bool resulFromDatabase = await _bdRepository.DeleteClientCategory(categoryFromDatabase);

            if (!resulFromDatabase)
            {
                return(BadRequest());
            }
            return(Ok());
        }
        public ActionResult CreateNewCategory(CreateNewCategoryViewModel model)
        {
            ClientCategory category = new ClientCategory()
            {
                ClientCategoryName = model.Category.ClientCategoryName,
                LoanDuration       = model.Category.LoanDuration,
                MaxLoans           = model.Category.MaxLoans
            };

            LibraryDal dal = new LibraryDal();

            dal.AddNewClientCategory(category);

            return(View("Index", new ClientCategoriesViewModel {
                ClientCategoies = dal.GetClientCategories()
            }));
        }
Пример #27
0
        public async Task <IActionResult> PostCategory(CategoriesDTO model)
        {
            ClientCategory newClientCategory = new ClientCategory()
            {
                CategoryName = model.CategoryName,
                Active       = model.Active
            };

            ClientCategory categoryFromDatabase = await _bdRepository.PostClientCategory(newClientCategory);

            if (logicValidations.ValidateIfDataIsNotNull(categoryFromDatabase))
            {
                model.CategoryId = categoryFromDatabase.CategoryId;
                return(Ok(model));
            }
            return(BadRequest());
        }
        public void GetClientCategory_test()
        {
            ClientCategory category = CategoryInit("Student", 15, 1);
            Client         client   = new Client()
            {
                FirstName = "Will",
                LastName  = "Smith",
                CIN       = "BK212121",
                Email     = "*****@*****.**",
                Category  = category
            };

            ClientCategory newCategory = client.Category;

            Assert.AreEqual(category.ClientCategoryName, newCategory.ClientCategoryName);
            Assert.AreEqual(category.LoanDuration, newCategory.LoanDuration);
            Assert.AreEqual(category.MaxLoans, newCategory.MaxLoans);
        }
Пример #29
0
        public static ClientCategory UpdateCategory(ClientCategory category)
        {
            try
            {
                var endPointString = endPointQLBH + "api/categories";
                var categoryUpdate = Task.Run(() => PutAsync <ClientCategory>(endPointString, category)).Result;

                return(categoryUpdate);
            }
            catch (BusinessLayerException)
            {
                throw new BusinessLayerException(500, "#1001002 Không cập nhật được dữ liệu loại sản phẩm.");
            }
            catch (Exception)
            {
                throw new BusinessLayerException(500, "#1001003 Không cập nhật được dữ liệu loại sản phẩm.");
            }
        }
        public ActionResult EditClientCategory(EditClientCategoryViewModel model)
        {
            LibraryDal dal = new LibraryDal();



            if (ModelState.IsValid)
            {
                ClientCategory newCategroy = new ClientCategory
                {
                    ClientCategoryName = model.clientCategory.ClientCategoryName,
                    LoanDuration       = model.clientCategory.LoanDuration,
                    MaxLoans           = model.clientCategory.MaxLoans
                };

                dal.UpdateClientCategory(dal.GetClientCategory(model.id), newCategroy);
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
        public async Task <IActionResult> AddCategory(ClientCategoryDTO clientCategory)
        {
            ClientCategory newCategory = new ClientCategory
            {
                CategoryName = clientCategory.CategoryName,
                RegisterDate = clientCategory.CreatedAt ?? DateTime.Now,
                Active       = clientCategory.Active
            };

            this._Context.ClientCategory.Add(newCategory);

            try
            {
                await this._Context.SaveChangesAsync();
            }
            catch
            {
                return(BadRequest());
            }

            return(Ok(clientCategoryBl.BuildClientCategoryDTO(newCategory)));
        }
Пример #32
0
        public static ClientProfile Create(
            string login,
            string password,
            string clientName,
            string email,
            TradingVolume tradingVolume,
            ClientCategory clientCategory,
            int countryID,
            string locality,
            string rmsStoreID,
            string scopeType,
            string discountCardNumber,
            string howKnow,
            string managerId,
            bool isRestricted,
            string internalFranchName,
            
            string contactPersonPosition,
            string contactPersonName,
            string contactPersonSurname,
            string contactPersonPhone,
            string contactPersonExtPhone,
            string contactPersonFax,
            string contactPersonEmail,
            string deliveryAddress,
            
            string companyName,
            string companyRegistrationID,
            string companyAddress,
            
            string bankName,
            string IBAN,
            string SWIFT,
            string bankAddress,
            
            string directorName,
            string directorSurname,
            
            string correspondentBankName,
            string correspondentIBAN,
            string correspondentSWIFT,
            string correspondentBankAddress,
            int RegisterAs
            )
        {
            if ( string.IsNullOrEmpty( clientName ) )
                throw new ArgumentException( "Client name cannot be empty", "clientName" );
            //    if ( string.IsNullOrEmpty( contactPersonPhone ) )
              //          throw new ArgumentException( "Main phone number must be specified" );

            var profile = new ClientProfile()
            {
                ClientId = "",
                ClientName = clientName,
                Email = email,
                TradingVolume = tradingVolume,
                Category = clientCategory,
                CountryID = countryID,
                Locality = locality,
                RmsStoreId = rmsStoreID,
                ScopeType = scopeType,
                DiscountCardNumber = discountCardNumber,
                HowKnow = howKnow,
                IsRestricted = isRestricted,
                PrepaymentPercent = 0M,
                PersonalMarkup = 0M,
                Balance = 0M,
                DelayCredit = 0M,
                InternalFranchName = internalFranchName,

                ContactPersonPosition = contactPersonPosition,
                ContactPersonName = contactPersonName,
                ContactPersonSurname = contactPersonSurname,
                ContactPersonPhone = contactPersonPhone,
                ContactPersonExtPhone = contactPersonExtPhone,
                ContactPersonFax = contactPersonFax,
                ContactPersonEmail = contactPersonEmail,
                DeliveryAddress = deliveryAddress,

                BankName = bankName,
                IBAN = IBAN,
                SWIFT = SWIFT,
                BankAddress = bankAddress,

                DirectorName = directorName,
                DirectorSurname = directorSurname,

                CorrespondentBankName = correspondentBankName,
                CorrespondentIBAN = correspondentIBAN,
                CorrespondentSWIFT = correspondentSWIFT,
                CorrespondentBankAddress = correspondentBankAddress,
                RegisterAs = RegisterAs
            };

            RmsAuto.Acctg.ClientGroup clientGroup = tradingVolume == TradingVolume.Retail ? RmsAuto.Acctg.ClientGroup.DefaultRetail : RmsAuto.Acctg.ClientGroup.DefaultWholesale;

            using (var DC = new DCFactory<StoreDataContext>())
            {

                var rezIns = DC.DataContext.spInsUsers( login, password, clientName, email, (byte)tradingVolume, (byte)clientCategory,
                countryID, /*regionID,*/ locality, /*contactLastName, contactFirstName, contactMiddleName,
                contactPhone, contactExtPhone,*/ scopeType, howKnow, managerId, "", false, isRestricted,
                (int)clientGroup, 100M, 0M, /*contactFax, scheduleOfice, scheduleStock, shippingAddress,*/
                rmsStoreID, /*discountCardNumber, contactPosition, legalName, IPName, iNN, oGRNIP, kPP, oGRN,
                nDSAggent, oficialAddress, realAddress, account, bankBIC, bankINN, directorPosition,
                directorLastName, directorFirstName, directorMiddleName, balanceManPosition,
                balanceManLastName, balanceManFirstName, balanceManMiddleName,
                balanceManPhone, balanceManEmail,*/ internalFranchName,
                contactPersonPosition, contactPersonName, contactPersonSurname, contactPersonPhone, contactPersonExtPhone,
                contactPersonFax, contactPersonEmail, deliveryAddress, companyName, companyRegistrationID, companyAddress,
                bankName, IBAN, SWIFT, bankAddress, directorName, directorSurname, correspondentBankName,
                correspondentIBAN, correspondentSWIFT, correspondentBankAddress, RegisterAs);
                profile.UserId = rezIns.ToList().FirstOrDefault().UserID.Value;
            }

            return profile;
        }
Пример #33
0
 public void Insert(int index, ClientCategory entity)
 {
     base.Insert(index, entity);
 }
Пример #34
0
 public bool Remove(ClientCategory entity)
 {
     return base.Remove(entity);
 }
Пример #35
0
 public int IndexOf(ClientCategory entity)
 {
     return base.IndexOf(entity);
 }
Пример #36
0
 public bool Contains(ClientCategory entity)
 {
     return base.Contains(entity);
 }
Пример #37
0
 public void Add(ClientCategory entity)
 {
     base.Add(entity);
 }