コード例 #1
0
        public SubCategoryListPage()
        {
            InitializeComponent();

            IsolatedStorageFile ISOFile = IsolatedStorageFile.GetUserStoreForApplication();
            if (IsolatedStorageSettings.ApplicationSettings.Contains("islogin"))
            {
                if (!(Convert.ToString(IsolatedStorageSettings.ApplicationSettings["islogin"]).ToLower() == "yes"))
                {
                    NavigationService.Navigate(new Uri("/Views/LoginPage.xaml", UriKind.RelativeOrAbsolute));
                }
                else
                {
                    if (ISOFile.FileExists("CurrentLoginUserDetails"))//read current user login details
                    {
                        using (IsolatedStorageFileStream fileStream = ISOFile.OpenFile("CurrentLoginUserDetails", FileMode.Open))
                        {
                            DataContractSerializer serializer = new DataContractSerializer(typeof(LoginViewModel));
                            var ObjUserData = (LoginViewModel)serializer.ReadObject(fileStream);
                            this.txtHeaderOrgName.Text = ObjUserData.organizationName;
                            this.txtHeaderFullName.Text = ObjUserData.firstName + " " + ObjUserData.lastName;
                            _employeeId = Convert.ToInt32(ObjUserData.employeeId);
                            _organizationId = Convert.ToInt32(ObjUserData.organizationId);
                            lstMenuItems.ItemsSource = Utilities.GetMenuItems(MenuCode.CatMngt);

                            // Show Loader
                            myIndeterminateProbar.Visibility = Visibility.Visible;

                            //====================================================================================================================
                            // Fill Category List
                            //====================================================================================================================
                            // Parameters
                            EmployeeRequest obj = new EmployeeRequest();
                            obj.organizationId = _organizationId;
                            obj.set = 1;
                            obj.count = 5;
                            String data = "organizationId=" + obj.organizationId + "&set=" + obj.set + "&count=" + obj.count;

                            //Initialize WebClient
                            WebClient webClient = new WebClient();
                            //Set Header
                            webClient.Headers[HttpRequestHeader.Authorization] = Utilities.GetAuthorization();
                            webClient.Headers["Content-Type"] = "application/x-www-form-urlencoded";
                            webClient.Headers[HttpRequestHeader.AcceptLanguage] = "en_US";
                            webClient.UploadStringAsync(new Uri(Utilities.GetURL("category/subCategoryListing/")), "POST", data);
                            //Assign Event Handler0
                            webClient.UploadStringCompleted += wc_UploadStringCompleted;
                        }
                    }
                }
            }
            else
            {
                NavigationService.Navigate(new Uri("/Views/LoginPage.xaml", UriKind.RelativeOrAbsolute));
            }
        }
コード例 #2
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            // Show Loader
            myIndeterminateProbar.Visibility = Visibility.Visible;

            // Parameters
            EmployeeRequest obj = new EmployeeRequest();
            obj.employeeId = _employeeId;  // Logged In User's id
            obj.organizationId = _organizationId; // Logged In organizationId
            obj.staffEmployeeId = _staffEmployeeId;  // Logged In User's id
            obj.firstName = txtFirstName.Text.Trim();
            obj.lastName = txtLastName.Text.Trim();
            obj.email = txtEmail.Text.Trim();
            obj.businessPhoneCode = _businessPhoneCode;  // hardcoded now
            obj.businessPhone = txtPhone.Text.Trim();
            obj.addressLine1 = txtStreet.Text.Trim();
            obj.salary = txtSalary.Text.Trim();
            obj.userName = txtUsername.Text.Trim();
            obj.empRoleArray = "[" + _Roleccollections + "]";

            ListPickerItem selectedItemState = this.listPickerState.ItemContainerGenerator.ContainerFromItem(this.listPickerState.SelectedItem) as ListPickerItem;
            data_State SelecteddataState = selectedItemState.DataContext as data_State;
            obj.state = Convert.ToInt32(SelecteddataState.stateId);

            ListPickerItem selectedItemArea = this.listPickerArea.ItemContainerGenerator.ContainerFromItem(this.listPickerArea.SelectedItem) as ListPickerItem;
            data_Area SelecteddataArea = selectedItemArea.DataContext as data_Area;
            obj.area = Convert.ToInt32(SelecteddataArea.areaId);

            ListPickerItem selectedItemCity = this.listPickerCity.ItemContainerGenerator.ContainerFromItem(this.listPickerCity.SelectedItem) as ListPickerItem;
            data_City SelecteddatCity = selectedItemCity.DataContext as data_City;
            obj.city = Convert.ToInt32(SelecteddatCity.zipId); // here zipId is cityID

            String data = string.Empty;

            if (Validation() == true)
            {
                //Initialize WebClient
                WebClient webClient = new WebClient();

                //Set Header
                webClient.Headers[HttpRequestHeader.Authorization] = Utilities.GetAuthorization();
                webClient.Headers["Content-Type"] = "application/x-www-form-urlencoded";
                webClient.Headers[HttpRequestHeader.AcceptLanguage] = "en_US";

                if (_mode == "Add")
                {
                    data = "employeeId=" + obj.employeeId + "&organizationId=" + obj.organizationId + "&firstName=" + obj.firstName + "&lastName=" + obj.lastName + "&email=" + obj.email + "&businessPhoneCode=" + obj.businessPhoneCode + "&businessPhone=" + obj.businessPhone + "&state=" + obj.state + "&area=" + obj.area + "&city=" + obj.city + "&addressLine1=" + obj.addressLine1 + "&salary=" + obj.salary + "&userName="******"&role=" + obj.empRoleArray;
                    webClient.UploadStringAsync(new Uri("http://54.173.246.245/marketplace/api/manageEmployee/addEmployee"), "POST", data);
                }
                if (_mode == "Edit")
                {
                    data = "designation=" + "" + "&staffEmployeeId=" + obj.staffEmployeeId + "&employeeId=" + obj.employeeId + "&organizationId=" + obj.organizationId + "&firstName=" + obj.firstName + "&lastName=" + obj.lastName + "&email=" + obj.email + "&businessPhoneCode=" + obj.businessPhoneCode + "&businessPhone=" + obj.businessPhone + "&state=" + obj.state + "&area=" + obj.area + "&city=" + obj.city + "&addressLine1=" + obj.addressLine1 + "&salary=" + obj.salary + "&userName="******"&role=" + obj.empRoleArray;
                    webClient.UploadStringAsync(new Uri("http://54.173.246.245/marketplace/api/manageEmployee/updateEmployee"), "POST", data);
                }

                //Assign Event Handler
                webClient.UploadStringCompleted += wc_UploadSaveCompleted;
            }
        }
コード例 #3
0
        private void ImgEditBlock_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            var _EmployeeDataContext = (EmployeeViwModel)(sender as Image).DataContext;

            Popup popup = new Popup();
            popup.VerticalOffset = 80;
            PopUpUserControl control = new PopUpUserControl();
            control.HorizontalAlignment = HorizontalAlignment.Center;
            if (_EmployeeDataContext.active == "1")
            {
                control.btnblock.Content = "Block";
            }
            else
            {
                control.btnblock.Content = "Unblock";
            }

            popup.Child = control;
            popup.IsOpen = true;
            _redirectMode = "Default";
            control.btnEdit.Click += (s, args) =>
            {
                //====================================================================================================================
                // PopUp Edit button
                //====================================================================================================================

                popup.IsOpen = false;
                // Set page mode for Edit record of employee
                _redirectMode = "Edit";
                _EmployeeDataContext.mode = "Edit";

                if (ISOFile.FileExists("viewEmployeeDetails"))
                {
                    ISOFile.DeleteFile("viewEmployeeDetails");
                }
                using (IsolatedStorageFileStream fileStream = ISOFile.OpenFile("viewEmployeeDetails", FileMode.Create))
                {
                    DataContractSerializer serializer = new DataContractSerializer(typeof(EmployeeViwModel));
                    serializer.WriteObject(fileStream, _EmployeeDataContext);

                    NavigationService.Navigate(new Uri("/Views/EmployeeAddEdit.xaml", UriKind.RelativeOrAbsolute));
                }

            };

            control.btnblock.Click += (s, args) =>
            {
                //====================================================================================================================
                // PopUp block Unblock Button
                //====================================================================================================================

                int active = 1;
                if (_EmployeeDataContext.active == "1")
                {
                    active = 0;
                }

                // Parameters
                EmployeeRequest obj = new EmployeeRequest();
                obj.organizationId = _organizationId;
                obj.employeeId = _employeeId;
                obj.staffEmployeeId = Convert.ToInt32(_EmployeeDataContext.employeeId);
                obj.blockStatus = active;
                String data = "organizationId=" + obj.organizationId + "&employeeId=" + obj.employeeId + "&staffEmployeeId=" + obj.staffEmployeeId + "&blockStatus=" + obj.blockStatus;

                //Initialize WebClient
                WebClient webClient = new WebClient();
                //Set Header
                webClient.Headers[HttpRequestHeader.Authorization] = Utilities.GetAuthorization();
                webClient.Headers["Content-Type"] = "application/x-www-form-urlencoded";
                webClient.Headers[HttpRequestHeader.AcceptLanguage] = "en_US";
                webClient.UploadStringAsync(new Uri("http://54.173.246.245/marketplace/api/manageEmployee/blockUnblockEmployee/"), "POST", data);
                //Assign Event Handler
                webClient.UploadStringCompleted += wc_UploadBlockCompleted;

                popup.IsOpen = false;
            };

            control.btnclose.Tap += (s, args) =>
            {
                //====================================================================================================================
                // PopUp cancel Button
                //====================================================================================================================

                popup.IsOpen = false;
            };
        }