Exemple #1
0
        public static void TempImportStyleDesc()
        {
            string path  = @"C:\Internal\StyleDescriptions.xls";
            string sheet = "Sheet1";
            var    data  = ReadFrom(path, sheet);

            var descriptions = data.Select(x => new
            {
                Id          = x["client id"].ToString(),
                stylenumber = x["style number"].ToString(),
                styledesc   = x["style description"].ToString(),
                clientdesc  = x["client description"].ToString()
            }).ToList();

            var gclient = InternalClientService.GetInternalClientByID(descriptions.First().Id);

            if (gclient != null)
            {
                foreach (var desc in descriptions)
                {
                    var gstyledesc = gclient.ClientStyles.FirstOrDefault(x => x.style_number == desc.stylenumber);
                    if (gstyledesc == null)
                    {
                        gstyledesc = new InternalClientStyle();
                        gclient.ClientStyles.Add(gstyledesc);
                    }
                    gstyledesc.etsy_style_descripion = desc.clientdesc;
                    gstyledesc.style_number          = desc.stylenumber;
                    gstyledesc.style_description     = desc.styledesc;

                    InternalClientService.UpdateInternalClient(gclient);
                }
            }
        }
        private void btnAddNewDesign_Click(object sender, EventArgs e)
        {
            var client = InternalClientService.GetInternalClientByID(clientID);

            if (!string.IsNullOrEmpty(txtDefaultColor.Text) && !string.IsNullOrEmpty(txtDesignNumber.Text))
            {
                var designs = client.ClientDesigns;
                if (designs == null)
                {
                    designs = new List <Models.InternalClientDesign>();
                    client.ClientDesigns = designs;
                }
                var design = designs.Where(x => x.design_number == txtDesignNumber.Text).FirstOrDefault();
                if (design == null)
                {
                    design = new Models.InternalClientDesign();
                    design.design_number = txtDesignNumber.Text;

                    design.colors = new List <string>();
                    design.colors.Add(txtDefaultColor.Text);

                    client.ClientDesigns.Add(design);
                }
                InternalClientService.UpdateInternalClient(client);
                userAdmin.Enabled = true;
                userAdmin.AdminRefresh();
                this.Close();
            }
        }
Exemple #3
0
        private void btnColorRemove_Click(object sender, EventArgs e)
        {
            string clientID = cmbClients.SelectedValue.ToString();

            if (lbDesignColors.SelectedItem != null && lbDesigns.SelectedItem != null)
            {
                var gclient = InternalClientService.GetInternalClientByID(clientID);
                var design  = gclient.ClientDesigns.Where(x => x.design_number == lbDesigns.SelectedItem.ToString()).FirstOrDefault();
                design.colors.Remove(lbDesignColors.SelectedItem.ToString());
                InternalClientService.UpdateInternalClient(gclient);
                AdminRefresh();
            }
        }
Exemple #4
0
 private void btnAddNewColor_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtColor.Text))
     {
         var gclient = InternalClientService.GetInternalClientByID(clientID);
         var design  = gclient.ClientDesigns.Where(x => x.design_number == designNumber).FirstOrDefault();
         if (design != null)
         {
             design.colors.Add(txtColor.Text);
         }
         InternalClientService.UpdateInternalClient(gclient);
         this.Close();
     }
 }
Exemple #5
0
        private void btnStyleRemove_Click(object sender, EventArgs e)
        {
            string clientID    = cmbClients.SelectedValue.ToString();
            var    stylenumber = lbStyles.SelectedItem.ToString();
            var    gclient     = InternalClientService.GetInternalClientByID(clientID);

            var style = gclient.ClientStyles.Where(x => x.style_number == stylenumber).FirstOrDefault();

            if (style != null)
            {
                gclient.ClientStyles.Remove(style);
                InternalClientService.UpdateInternalClient(gclient);
            }
            AdminRefresh();
            txtStyleDescription.Text = string.Empty;
            txtEtsyDescription.Text  = string.Empty;
        }
Exemple #6
0
        private void btnAddNewStyle_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtStyle.Text) &&
                !string.IsNullOrEmpty(txtDescription.Text) &&
                !string.IsNullOrEmpty(txtEtsyDescription.Text))
            {
                var gclient = InternalClientService.GetInternalClientByID(clientID);
                var style   = gclient.ClientStyles.Where(x => x.style_number == txtStyle.Text).FirstOrDefault();
                if (style == null)
                {
                    style = new Models.InternalClientStyle();
                    style.style_number          = txtStyle.Text;
                    style.style_description     = txtDescription.Text;
                    style.etsy_style_descripion = txtEtsyDescription.Text;

                    gclient.ClientStyles.Add(style);
                    InternalClientService.UpdateInternalClient(gclient);
                    userAdmin.Enabled = true;
                    userAdmin.AdminRefresh();
                    this.Close();
                }
            }
        }