public ProductListPage() { InitializeComponent(); IsolatedStorageFile ISOFile = IsolatedStorageFile.GetUserStoreForApplication(); if (IsolatedStorageSettings.ApplicationSettings.Contains("islogin")) { if (!(Convert.ToString(IsolatedStorageSettings.ApplicationSettings["islogin"]).ToLower() == "yes")) { NavigationService.Navigate(new Uri("/Views/Login/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.ProdMgnt); // Show Loader myIndeterminateProbar.Visibility = Visibility.Visible; //==================================================================================================================== // Fill organization Product List //==================================================================================================================== // Parameters ProductRequest obj = new ProductRequest(); obj.organizationId = _organizationId; obj.set = 1; obj.count = 50; obj.isInventory = 0; //0 for product list, 1 for inventory list String data = "organizationId=" + obj.organizationId + "&set=" + obj.set + "&count=" + obj.count + "&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("manageProduct/organizationProductList/")), "POST", data); //Assign Event Handler0 webClient.UploadStringCompleted += wc_UploadOrganizationProductCompleted; } } } } else { NavigationService.Navigate(new Uri("/Views/Login/LoginPage.xaml", UriKind.RelativeOrAbsolute)); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { // Parameters ProductRequest obj = new ProductRequest(); obj.employeeId = _employeeId; // Logged In User's id obj.organizationId = _organizationId; // Logged In organizationId obj.productCodeOveride = txtItemName.Text.Trim(); obj.productDescription = txtItemDescription.Text.Trim(); obj.categoryId=0; // Need to change obj.currentPrice=txtSalePrice.Text.Trim(); obj.costPrice=txtCostPrice.Text.Trim(); obj.upc=txtUPC.Text.Trim(); //obj.file = ""; String data = string.Empty; if (Validation() == true) { // Show Loader myIndeterminateProbar.Visibility = Visibility.Visible; //==================================================================================================================== // Submit Details //==================================================================================================================== //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 + "&productCodeOveride=" + obj.productCodeOveride + "&productDescription=" + obj.productDescription + "&categoryId=" + obj.categoryId + "¤tPrice=" + obj.currentPrice + "&costPrice=" + obj.costPrice + "&upc=" + obj.upc ; webClient.UploadStringAsync(new Uri(Utilities.GetURL("manageProduct/addProduct/")), "POST", data); //} //if (_mode == "Edit") //{ // data = "productId=" + obj.employeeId + "&employeeId=" + obj.employeeId + "&organizationId=" + obj.organizationId + "&productCodeOveride=" + obj.productCodeOveride + "&productDescription=" + obj.productDescription + "&categoryId=" + obj.categoryId + "¤tPrice=" + obj.currentPrice + "&costPrice=" + obj.costPrice + "&upc=" + obj.upc; // webClient.UploadStringAsync(new Uri(Utilities.GetURL("manageProduct/updateProduct/")), "POST", data); //} //Assign Event Handler webClient.UploadStringCompleted += wc_UploadSaveCompleted; } }
public ProductAddMasterList() { InitializeComponent(); _isPopUpOpen = false; IsolatedStorageFile ISOFile = IsolatedStorageFile.GetUserStoreForApplication(); if (IsolatedStorageSettings.ApplicationSettings.Contains("islogin")) { if (!(Convert.ToString(IsolatedStorageSettings.ApplicationSettings["islogin"]).ToLower() == "yes")) { NavigationService.Navigate(new Uri("/Views/Login/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); _employeeId = Convert.ToInt32(ObjUserData.employeeId); _organizationId = Convert.ToInt32(ObjUserData.organizationId); // Show Loader myIndeterminateProbar.Visibility = Visibility.Visible; //==================================================================================================================== // Fill Master Product List //==================================================================================================================== // Parameters ProductRequest obj = new ProductRequest(); obj.organizationId = _organizationId; obj.set = 1; obj.count = Utilities.GetListCount(); obj.isInventory = 0; //0 for product list, 1 for inventory list String data = "organizationId=" + obj.organizationId + "&set=" + obj.set + "&count=" + obj.count + "&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("manageProduct/masterProductList/")), "POST", data); //Assign Event Handler0 webClient.UploadStringCompleted += wc_UploadOrganizationProductCompleted; } } } //==================================================================================================================== // Fill Category Dropdown Default //==================================================================================================================== if (Utilities.CheckInternetConnection()) { // ---------------------------------------------------------------------- // "Network Status: Connected." // Show Loader myIndeterminateProbar.Visibility = Visibility.Visible; SubCategoryRequest obj = new SubCategoryRequest(); obj.organizationId = _organizationId; obj.set = 1; obj.count = Utilities.GetListCount(); 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/categoryListing/")), "POST", data); //Assign Event Handler0 webClient.UploadStringCompleted += wc_UploadCategoryCompleted; } } else { NavigationService.Navigate(new Uri("/Views/Login/LoginPage.xaml", UriKind.RelativeOrAbsolute)); } }