private void btnGenerateShopify_Click(object sender, EventArgs e) { lblStatus.Text = ""; DesignServices.GenerateShopifyProductFile(_designStyles); StyleServices.GenerateShopifyStyleSnippits(_designStyles.Select(x => x.Style).Distinct().ToList()); lblStatus.Text = "Done Exporting Shopify Data"; }
private void GetClientgarments() { dgvColors.DataSource = null; dgvDeisgns.DataSource = null; dgvSizes.DataSource = null; dgvStyles.DataSource = null; if (int.TryParse(txtClientID.Text, out _clientID)) { frmLoading loading = new Forms.frmLoading(); loading.Show(); Application.DoEvents(); _designStyles = DesignServices.GetDesignStylesByClientID(_clientID); _customer = AccessServices.GetCustomerByClientID(_clientID); loading.Close(); } else if (Directory.Exists(txtClientID.Text)) { _designStyles = DesignServices.GetDesignStylesFromSpreadsheets(txtClientID.Text); } else { var allActiveClients = AccessServices.GetAllActiveCustomersByClientID(); foreach (var customer in allActiveClients) { lblCost.Text = string.Format("Creating JSON For {0}", customer.Company_Name); Application.DoEvents(); var cstyles = AccessServices.GetStylesByClientID(customer.Company_ID); var cdesigns = AccessServices.GetDesignsByClientID(customer.Company_ID); var jsonDesigns = JsonConvert.SerializeObject(JSONGenerator.JSONGeneratorHelpers.CreateDesigns(cdesigns)); var jsonStyles = JsonConvert.SerializeObject(JSONGenerator.JSONGeneratorHelpers.CreateStyles(cstyles)); string jsonCustomer = JsonConvert.SerializeObject(JSONGenerator.JSONGeneratorHelpers.CreateCustomer(customer)); using (StreamWriter sw = new StreamWriter(@"OuputPath\JSON\" + customer.Company_ID.ToString() + "_styledesigns.js")) { string json = string.Format("var styles = {0} \n\r var designs = {1} \n\r var user = {2}", jsonStyles, jsonDesigns, jsonCustomer); sw.Write(json); } } lblCost.Text = string.Format("Done"); return; } var designs = _designStyles.Select(x => x.Design).Distinct().ToList(); var styles = _designStyles.Select(x => x.Style).Distinct().ToList(); dgvDeisgns.DataSource = designs; dgvStyles.DataSource = styles.OrderBy(x => x.Gender).Select(x => new { Number = x.Style_Number, Description = x.Gender + " " + x.Website_Description, MaxHue = x.MaxHue, MinOverride = x.MinOverride }).ToList(); if (_customer != null) { lblCost.Text = _customer.Company_Name; } }