Beispiel #1
0
        public void AddProviderstoService()
        {
            try
            {
                var Url = Application.Current.Properties["DomainUrl"] + "/api/companyregistration/AssignServiceToStaff";

                foreach (var item in ListofServiceProviders)
                {
                    if (item.confirmed == true)
                    {
                        AssignServiceToStaff obj = new AssignServiceToStaff();
                        obj.CompanyId    = Convert.ToInt32(CompanyId);
                        obj.ServiceId    = ServiceId;
                        obj.EmployeeId   = item.Id;
                        obj.CreationDate = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffffK");
                        //System.DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffffK");

                        var SerializedData = JsonConvert.SerializeObject(obj);
                        var result         = PostData("POST", SerializedData, Url);
                    }
                    else
                    {
                        var apiUrl = Application.Current.Properties["DomainUrl"] + "/api/companyregistration/DeAllocateServiceForEmployee?companyId=" + CompanyId + "&employeeId=" + item.Id + "&serviceId=" + ServiceId;
                        var result = PostData("POST", "", apiUrl);
                    }
                }
                if (PreviousPageName == "EditService")
                {
                    Navigation.PushAsync(new ServiceDetailsPage());
                }
                else if (PreviousPageName == "AddService")
                {
                    Navigation.PushAsync(new ChooseCategoriesPage("", GetCategories()));
                }
                else if (PreviousPageName == "ServiceCreateAfterRegistration")
                {
                    Navigation.PushAsync(new AddServiceForCompnyRegistration(PreviousPageName));
                }
                else if (PreviousPageName == "CalenderPage" || PreviousPageName == "CustomerPage" || PreviousPageName == "ActivityPage" || PreviousPageName == "AccountPage")
                {
                    Navigation.PushAsync(new ChooseCategoriesPage(PreviousPageName, GetCategories()));
                }
                //else if (PreviousPageName == "CustomerPage")
                //{
                //    Navigation.PushAsync(new ChooseCategoriesPage("CustomerPage", GetCategories()));
                //}
                //else if (PreviousPageName == "ActivityPage")
                //{
                //    Navigation.PushAsync(new ChooseCategoriesPage("ActivityPage",GetCategories()));
                //}
                //else if (PreviousPageName == "AccountPage")
                //{
                //    Navigation.PushAsync(new ChooseCategoriesPage("AccountPage",GetCategories()));
                //}
            }
            catch (Exception e)
            {
                e.ToString();
            }
        }
Beispiel #2
0
        //public void GetService()
        //{
        //    var apiUrl = Application.Current.Properties["DomainUrl"] + "/api/services/GetServicesForCompany?companyId=" + CompanyId;
        //    var result = PostData("GET", "", apiUrl);

        //    ListofServices = JsonConvert.DeserializeObject<ObservableCollection<AssignedServicetoStaff>>(result);
        //    ListofAllServices.ItemsSource = ListofServices;
        //}
        //public void AssignProvider(object Sender, EventArgs args)
        //{
        //    try
        //    {
        //        for (int i = 0; i < ListofServices.Count; i++)
        //        {
        //            if (ListofServices[i].isAssigned == false)
        //            {
        //                foreach (var item in ListofServices)
        //                {
        //                    item.isAssigned = false;
        //                }
        //                break;
        //            }
        //            else
        //            {

        //                ListofServices[i].isAssigned = true;
        //                // AllStaffChecked.Checked = true;
        //            }
        //        }
        //        //AllocatedProviderCount.Text = GetAllocatedServiceCount() + " " + "Staff selected";
        //    }
        //    catch (Exception e)
        //    {
        //        e.ToString();
        //    }

        //}
        public void AssignServicetoStaff()
        {
            var data   = ListofServices;
            var apiUrl = Application.Current.Properties["DomainUrl"] + "/api/staff/AllocateService";

            foreach (var item in ListofServices)
            {
                if (item.isAssigned == true)
                {
                    AssignServiceToStaff obj = new AssignServiceToStaff();
                    obj.CompanyId    = Convert.ToInt32(CompanyId);
                    obj.EmployeeId   = EmployeeId;
                    obj.ServiceId    = item.Id;
                    obj.CreationDate = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffffK");

                    var SerializedData = JsonConvert.SerializeObject(obj);

                    var result = PostData("POST", SerializedData, apiUrl);
                }
                else
                {
                    AssignServiceToStaff obj = new AssignServiceToStaff();
                    var SerializedData       = JsonConvert.SerializeObject(obj);
                    var Url    = Application.Current.Properties["DomainUrl"] + "/api/staff/DeAllocateServiceForEmployee?companyId=" + CompanyId + "&employeeId=" + EmployeeId + "&serviceId=" + item.Id;
                    var result = PostData("POST", SerializedData, Url);
                }
            }

            Navigation.PushAsync(new StaffProfileDetailsPage());
        }
 public string AssignStaffToService(AssignServiceToStaff AssignStaff)
 {
     try
     {
         var apiUrl = Application.Current.Properties["DomainUrl"] + "/api/companyregistration/AssignServiceToStaff";
         var json   = JsonConvert.SerializeObject(AssignStaff);
         var result = PostData("POST", json, apiUrl);
         return(result);
     }
     catch (Exception e)
     {
         return(e.ToString());
     }
 }