예제 #1
0
        private void OnSelectSearchItem()
        {
            IsPopupOpen     = false;
            this.SearchText = string.Empty;

            if (this.SelectedCustomerID != 0)
            {
                var selectedCustomer = CustomerAction.GetCustomerByID(this.DBConnectionString,
                                                                      this.SelectedCustomerID.ToString(
                                                                          CultureInfo.InvariantCulture));
                if (this.ContentViewModel != null && this.ContentViewModel.GetType() == typeof(AppointmentViewModel))
                {
                    var vm = ((AppointmentViewModel)this.ContentViewModel);
                    vm.Entity.SelectedCustomer = selectedCustomer;
                    return;
                }

                if (selectedCustomer != null)
                {
                    this.ContentViewModel = null;
                    this.ContentViewModel = new CustomerDetailViewModel(this.Messenger, this.UserLogin, selectedCustomer)
                    {
                        ParentViewModel = this
                    };
                    GalaSoft.MvvmLight.Messaging.Messenger.Default.Send <IBaseViewModel>(this.ContentViewModel);
                }
            }
        }
 /* Set Role For User*/
 public JsonResult CreateStaff(int Id, string Role)
 {
     CustomerAction.Create_Staff(Id, Role);
     //return Redirect("~/Customer/Index/" + Session["id"]);
     RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " update role " + Role + "  for account " + CustomerAction.Find_Customer(Id).email, DateTime.Now.Date);
     return(Json(JsonRequestBehavior.AllowGet));
 }
 public ActionResult Register(string Email, string First_Name, string Last_Name,
                              string Phone, string Address, string Date_Birth, string Gender, string Password)
 {
     CustomerAction.Create_Customer(Email, First_Name, Last_Name, Address, Phone, Password, Date_Birth, Gender);
     RecordAction.Create_Record(Email, Email + " create account.", DateTime.Now.Date);
     return(Redirect("~/Book/ShowBook"));
 }
예제 #4
0
        public ActionResult Login(string Mail, string Pass)
        {
            string page     = "";
            var    customer = CustomerAction.Find_Customer(Mail, Pass);

            if (customer != null)
            {
                ViewBag.ID = customer.id_customer;
                if (customer.password == Pass && (customer.role.Equals("admin") || customer.role.Equals("staff")) || customer.id_customer == 1)
                {
                    page            = "~/Customer/Index";
                    Session["id"]   = customer.id_customer;
                    Session["role"] = customer.role;
                    Session.Timeout = 24;
                }
                else if (customer.password == Pass && customer.role.Equals("guest"))
                {
                    page            = "~/Book/ShowBook";
                    Session["id"]   = customer.id_customer;
                    Session["role"] = customer.role;
                    Session.Timeout = 24;
                }
            }
            else if (customer == null)
            {
                page = "~/Book/ShowBook";
            }

            return(Redirect(page));
        }
 private void GetRefreshCustomerRepairCollection()
 {
     Task.Factory.StartNew(() =>
     {
         this.Entity = CustomerAction.GetCustomerRepairList(this.DBConnectionString, this.SelectedCustomer);
     });
 }
        public async Task <ActionResult <CustomerActionDto> > CreateCustomerAction(long customerId, CustomerActionDto customerActionDto)
        {
            try
            {
                var customerItem = await _context.CustomerItems.FindAsync(customerId);

                if (customerItem == null)
                {
                    return(BadRequest());
                }

                CustomerAction customerAction = new CustomerAction()
                {
                    CustomerKey    = customerItem.CustomerKey,
                    Action         = customerActionDto.Action,
                    ActionDateTime = DateTime.Now,
                    IsComplete     = false
                };
                _context.CustomerActionItems.Add(customerAction);
                await _context.SaveChangesAsync();

                return(CreatedAtAction(nameof(CreateCustomerAction), new { id = customerAction.CustomerKey }, customerAction));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
예제 #7
0
        /// <summary>
        /// Returns an object that represents the parsed expression.
        /// </summary>
        /// <param name="expression">The value of the declarative expression.</param>
        /// <param name="propertyType">The type of the property bound to by the expression.</param>
        /// <param name="context">Contextual information for the evaluation of the expression.</param>
        /// <returns>An Object that represents the parsed expression</returns>
        public override object ParseExpression(string expression, Type propertyType, ExpressionBuilderContext context)
        {
            var lsr = new CustomerAction();

            lsr.SystemKeyword = expression;
            return(lsr);
        }
        private void OnDeleteAddress()
        {
            if (this.Entity.CustomerAddresseCollection != null &&
                this.Entity.CustomerAddresseCollection.Any(x => x.IsSelected))
            {
                var qureyItems = this.Entity.CustomerAddresseCollection.Where(x => x.IsSelected && (x.ID.HasValue && x.ID.Value > 0) && x.IsDeleted == false).ToList();
                if (qureyItems.Any())
                {
                    CustomerAction.DeleteCustomerAddresses(this.DBConnectionString, qureyItems);
                    qureyItems.ForEach(x => x.IsDeleted = true);
                }

                var items = this.Entity.CustomerAddresseCollection.Where(x => x.IsSelected && (!x.ID.HasValue || x.ID.Value <= 0)).ToList();

                if (items.Any())
                {
                    foreach (var customerAddress in items)
                    {
                        this.Entity.CustomerAddresseCollection.Remove(customerAddress);
                    }
                    var tempCollection = new CustomerAddressCollection(this.Entity.CustomerAddresseCollection.ToList());
                    this.Entity.CustomerAddresseCollection = null;
                    this.Entity.CustomerAddresseCollection = tempCollection.InternalList;
                    this.Entity.NotifyPropertyChanged("CustomerAddresseCollection");
                }
            }
        }
예제 #9
0
 public ActionResult Details(long goodId)
 {
     try
     {
         var store = new StoreAction();
         var good  = store.GetGoodInfo(goodId);
         var model = new GoodDetailsViewModel(good);
         model.feedbacks       = store.GetFeedBack(goodId);
         model.canSendFeedback = Session.IsAuth() && !model.feedbacks.Any(s => s.userId == Session.GetUserId());
         if (Session.IsAuth())
         {
             var customer = new CustomerAction(Session.GetUserId());
             customer.SetThatWatching(goodId);
         }
         SetPratentGroupLinks(good.groupId);
         (ViewBag.Links as Queue <Link>).Enqueue(new Link {
             description = good.name, url = $"~/Details/{good.groupId}/{good.id}"
         });
         return(View(model));
     }
     catch (Exception ex)
     {
         HttpContext.Response.Redirect("/Error/_404", true);
         return(null);
     }
 }
예제 #10
0
 /// <summary>
 /// Subscribes the event.
 /// </summary>
 /// <param name="eventHandle">Event handle.</param>
 public static void SubscribeEvent(CustomerAction <Int16, byte[]> eventHandle)
 {
     if (eventHandle != null)
     {
         instance.tcp.RegisterEvent(eventHandle);
     }
 }
예제 #11
0
        private void GetSearchList(string strSearchText)
        {
            try
            {
                if (string.IsNullOrEmpty(strSearchText))
                {
                    CustomerSearchList = null;
                    IsPopupOpen        = false;
                    return;
                }

                Task.Factory.StartNew(() =>
                {
                    var customerActions = new CustomerAction();
                    CustomerSearchList  = customerActions.GetCustomerSearchDictionary(this.DBConnectionString,
                                                                                      strSearchText);
                    IsPopupOpen = true;
                    if (CustomerSearchList == null || !CustomerSearchList.Any())
                    {
                        CustomerSearchList = new Dictionary <String, String>();
                        CustomerSearchList.Add(new KeyValuePair <string, string>("", "No records available"));
                    }
                });

                this.RaisePropertyChanged(() => CustomerSearchList);
            }
            catch (Exception exception)
            {
                NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured, ExceptionResources.ExceptionOccuredLogDetail);
            }
        }
예제 #12
0
 private void ddlCustomer_SelectedIndexChanged(object sender, EventArgs e)
 {
     //Bind Customer details on selection changed
     try
     {
         int CustId = int.Parse(ddlCustomer.SelectedValue.ToString());
         if (CustId > 0)
         {
             CustomerData data = new CustomerData();
             data = new CustomerAction().GetCustomersInfo(CustId);
             if (data != null)
             {
                 txtName.Text    = data.Name;
                 txtAddress.Text = data.Address;
                 txtPhone.Text   = data.Phone.ToString();
             }
         }
         else
         {
             //MessageBox.Show("Test");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #13
0
 /// <summary>
 /// Subscribes the response.
 /// </summary>
 /// <param name="callback">Callback.</param>
 public static void SubscribeResponse(CustomerAction <int, Int16, byte[]> callback)
 {
     if (callback != null)
     {
         instance.tcp.RegisterResponse(callback);
     }
 }
예제 #14
0
 protected async Task AssignToCustomerTag(CustomerAction action, Customer customer)
 {
     if (customer.CustomerTags.Where(x => x == action.CustomerTagId).Count() == 0)
     {
         await _customerTagService.InsertTagToCustomer(action.CustomerTagId, customer.Id);
     }
 }
예제 #15
0
        //Bind Customer Grid to show data
        private void BindGridCustomer()
        {
            DataTable ds = new CustomerAction().GetAllCustomers();

            CustomersDataGridView.DataSource = ds;
            CustomersDataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
        }
예제 #16
0
        private static void task7()
        {
            Customer [] customer = new Customer[5];
            customer[0] = new Customer(true, "Ivan");
            customer[1] = new Customer(true, "Pavel");
            customer[2] = new Customer(true, "Nickita");
            customer[3] = new Customer(true, "Uric");
            customer[4] = new Customer(true, "Zhekichan");

            Provider[] providers = new Provider[3];
            providers[0] = new Provider("first", 100);
            providers[1] = new Provider("second", 500);
            providers[2] = new Provider("third", 1000);

            Storage storage = new Storage(customer);

            ProviderAction providerAction = new ProviderAction(providers, storage);
            CustomerAction customerAction = new CustomerAction(customer, storage);
            Thread         myThread1      = new Thread(new ThreadStart(providerAction.start));
            Thread         myThread2      = new Thread(new ThreadStart(customerAction.start));

            myThread1.Start();
            myThread2.Start();
            myThread1.Join();
        }
        public void Reaction(CustomerAction action, Customer customer, ShoppingCartItem cartItem, Order order)
        {
            if (action.ReactionType == CustomerReactionTypeEnum.Banner)
            {
                var banner = _bannerRepository.GetById(action.BannerId);
                if (banner != null)
                {
                    PrepareBanner(action, banner, customer.Id);
                }
            }
            if (action.ReactionType == CustomerReactionTypeEnum.InteractiveForm)
            {
                var interactiveform = _interactiveFormRepository.GetById(action.InteractiveFormId);
                if (interactiveform != null)
                {
                    PrepareInteractiveForm(action, interactiveform, customer.Id);
                }
            }

            var _cat = GetAllCustomerActionType();

            if (action.ReactionType == CustomerReactionTypeEnum.Email)
            {
                if (action.ActionTypeId == _cat.FirstOrDefault(x => x.SystemKeyword == "AddToCart").Id)
                {
                    if (cartItem != null)
                    {
                        _workflowMessageService.SendCustomerActionEvent_AddToCart_Notification(action, cartItem,
                                                                                               _workContext.WorkingLanguage.Id, customer);
                    }
                }

                if (action.ActionTypeId == _cat.FirstOrDefault(x => x.SystemKeyword == "AddOrder").Id)
                {
                    if (order != null)
                    {
                        _workflowMessageService.SendCustomerActionEvent_AddToOrder_Notification(action, order, customer,
                                                                                                _workContext.WorkingLanguage.Id);
                    }
                }

                if (action.ActionTypeId != _cat.FirstOrDefault(x => x.SystemKeyword == "AddOrder").Id&& action.ActionTypeId != _cat.FirstOrDefault(x => x.SystemKeyword == "AddToCart").Id)
                {
                    _workflowMessageService.SendCustomerActionEvent_Notification(action,
                                                                                 _workContext.WorkingLanguage.Id, customer);
                }
            }

            if (action.ReactionType == CustomerReactionTypeEnum.AssignToCustomerRole)
            {
                AssignToCustomerRole(action, customer);
            }

            if (action.ReactionType == CustomerReactionTypeEnum.AssignToCustomerTag)
            {
                AssignToCustomerTag(action, customer);
            }

            SaveActionToCustomer(action.Id, customer.Id);
        }
예제 #18
0
        public ActionResult WishList()
        {
            var customer = new CustomerAction(Session.GetUserId());
            var wishlist = customer.GetWishList();

            return(View(wishlist));
        }
예제 #19
0
 protected bool CheckBuffer(string name, CustomerAction <Object> callback)
 {
     if (string.IsNullOrEmpty(name))
     {
         return(true);
     }
     //if(callback != null)
     {
         if (buffers.ContainsKey(name))
         {
             if (callback != null)
             {
                 callback(buffers[name].Asset);
             }
             return(true);
         }
         else
         {
             if (callback != null)
             {
                 if (!loadedCallback.ContainsKey(name))
                 {
                     loadedCallback.Add(name, new List <CustomerAction <Object> >());
                 }
                 loadedCallback[name].Add(callback);
             }
             return(false);
         }
     }
 }
예제 #20
0
        public JsonResult AddWishList(long goodId)
        {
            var resultCode = 0;
            var customer   = new CustomerAction(Session.GetUserId());

            try
            {
                customer.AddToWishList(goodId);
            }
            catch (Exception)
            {
                resultCode = -1;
            }
            try
            {
                Session.UpdateWishList();
                var wishList = Session.GetUser().wishList;
                var result   = new { result = resultCode, wishCount = (customer.GetWishList()?.Count() ?? 0) };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                resultCode = -2;
                var result = new { result = resultCode, wishCount = 0 };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
예제 #21
0
        public ActionResult Basket()
        {
            var customer = new CustomerAction(Session.GetUserId());
            var basket   = customer.GetBasket();

            return(View(basket));
        }
예제 #22
0
 private void RefreshCustomerHearingAidOrderCollection(bool doAsync = false)
 {
     try
     {
         if (doAsync)
         {
             Task.Factory.StartNew(() =>
             {
                 var items = CustomerAction.GetCustomerHearingAidOrderList(this.DBConnectionString,
                                                                           this.Entity);
                 if (items != null && items.InternalList.Any())
                 {
                     this.Entity.CustomerHearingAidOrderCollection = items.InternalList;
                 }
             });
         }
         else
         {
             var items = CustomerAction.GetCustomerHearingAidOrderList(this.DBConnectionString, this.Entity);
             if (items != null && items.InternalList.Any())
             {
                 this.Entity.CustomerHearingAidOrderCollection = items.InternalList;
             }
         }
     }
     catch (Exception exception)
     {
         NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured,
                             ExceptionResources.ExceptionOccuredLogDetail);
     }
 }
예제 #23
0
 /// <summary>
 /// Subscribes the connect status.
 /// </summary>
 /// <param name="status">Status.</param>
 public static void SubscribeConnectStatus(CustomerAction <bool> status)
 {
     if (status != null)
     {
         instance.tcp.RegisterConnectStatus(status);
     }
 }
 public void PerformActionOnCustomer(CustomerAction cAction)
 {
     foreach (Customer c in customers)
     {
         cAction(c);
     }
 }
예제 #25
0
 protected async Task AssignToCustomerTag(CustomerAction action, Customer customer)
 {
     if (customer.CustomerTags.Where(x => x == action.CustomerTagId).Count() == 0)
     {
         var customerTagService = _serviceProvider.GetRequiredService <ICustomerTagService>();
         await customerTagService.InsertTagToCustomer(action.CustomerTagId, customer.Id);
     }
 }
    public void GeneratePathToSidewalkEnd()
    {
        List <GameObject> spawnLocations = customer.dm.gameObject.GetComponent <CustomerManager>().customerSpawnLocations;
        int rand = UnityEngine.Random.Range(0, spawnLocations.Count);

        GetOutdoorPath(spawnLocations[rand].transform.position);
        currentAction = CustomerAction.bypassingStore;
    }
예제 #27
0
        //Bind ComboBox Custoemr to show data
        private void BindDdlCustomer()
        {
            DataTable ds = new CustomerAction().GetAllCustomers();

            ddlCustomer.DisplayMember = "Name";
            ddlCustomer.ValueMember   = "CustId";
            ddlCustomer.DataSource    = ds;
        }
예제 #28
0
 /// <summary>
 /// Adds the late update.
 /// </summary>
 /// <param name="method">Method.</param>
 public void AddLateUpdate(CustomerAction method)
 {
     if (method == null)
     {
         return;
     }
     lateUpdateFunctions.Add(method);
 }
예제 #29
0
 public virtual void LoadAsyn(string name, CustomerAction <Object> callback)
 {
     if (!CheckBuffer(name, callback))
     {
         AddTask(new DownLoaderTask(AssetbundleBaseURL + name + ".assetbundle", 1), name);
     }
     return;
 }
 public virtual CustomerAction UpdateCustomerActionConditionModel(CustomerAction customeraction, ActionCondition condition, CustomerActionConditionModel model)
 {
     condition = model.ToEntity(condition);
     _customerActionService.UpdateCustomerAction(customeraction);
     //activity log
     _customerActivityService.InsertActivity("EditCustomerActionCondition", customeraction.Id, _localizationService.GetResource("ActivityLog.EditCustomerActionCondition"), customeraction.Name);
     return(customeraction);
 }
        private void GetSearchList(string strSearchText)
        {
            try
            {
                if (string.IsNullOrEmpty(strSearchText))
                {
                    CustomerSearchList = null;
                    IsPopupOpen = false;
                    return;
                }

                Task.Factory.StartNew(() =>
                {
                    var customerActions = new CustomerAction();
                    CustomerSearchList = customerActions.GetCustomerSearchDictionary(this.DBConnectionString,
                                                                                     strSearchText);
                    IsPopupOpen = true;
                    if (CustomerSearchList == null || !CustomerSearchList.Any())
                    {
                        CustomerSearchList = new Dictionary<String, String>();
                        CustomerSearchList.Add(new KeyValuePair<string, string>("", "No records available"));
                    }
                });

                this.RaisePropertyChanged(() => CustomerSearchList);
            }
            catch (Exception exception)
            {
                NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured, ExceptionResources.ExceptionOccuredLogDetail);
            }
        }