예제 #1
0
        private CostumeStoreExcel GetCostumeStoreExcel(PfCustomerStore item)
        {
            CostumeStoreExcel excel = new CostumeStoreExcel();

            ReflectionHelper.CopyProperty(item, excel);
            return(excel);
        }
예제 #2
0
        private List <CostumeStoreExcel> GetCostumeStoreExcels()
        {
            PfCustomer pfCustomer           = PfCustomerCache.GetPfCustomer(pfCustomeId);
            List <CostumeStoreExcel> excels = new List <CostumeStoreExcel>();

            foreach (var item in this.curInboundDetailList)
            {
                CostumeStoreExcel curStoreExcel = GetCostumeStoreExcel(item);
                curStoreExcel.CostumeColorName = item.ColorName;
                //   curStoreExcel.PfPrice = item.Price * pfCustomer.PfDiscount/100;
                excels.Add(curStoreExcel);
            }

            return(excels);
        }
예제 #3
0
        private List <CostumeStoreExcel> GetCostumeStoreExcels(out bool flagIsRepeat)
        {
            List <CostumeStoreExcel> excels = new List <CostumeStoreExcel>();

            flagIsRepeat = false;
            foreach (var item in this.curInboundDetailList)
            {
                int rows = 0;
                if (excels.Count > 0)
                {
                    rows = excels.FindAll(t => t.CostumeID == item.CostumeID.Trim() && t.CostumeColorName == item.ColorName.Trim()).Count;
                }
                if (rows > 0)
                {
                    flagIsRepeat = true;
                }
                CostumeStoreExcel curStoreExcel = GetCostumeStoreExcel(item);
                curStoreExcel.CostumeColorName = item.ColorName;
                excels.Add(curStoreExcel);
            }

            return(excels);
        }
예제 #4
0
        private void BaseButtonSave_Click(object sender, EventArgs e)
        {
            try
            {
                item = GetEntity();

                if (!Validate(item))
                {
                    return;
                }
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                if (this.CurItem != null)
                {
                    //线上商城原属性不替换
                    item.EmShowOnline  = CurItem.EmShowOnline;
                    item.EmOnlinePrice = CurItem.EmOnlinePrice;
                    item.EmTitle       = CurItem.EmTitle;
                    item.EmThumbnail   = CurItem.EmThumbnail == null ? string.Empty : CurItem.EmThumbnail;
                    item.CreateTime    = CurItem.CreateTime;
                    item.SizeNames     = CurItem.SizeNames;


                    CostumeColor  color     = this.colorComboBox1.SelectedItem;
                    List <string> colorList = CurItem.ColorList;
                    if (colorList != null)
                    {
                        if (curStore.ColorName != color.Name)
                        {
                            colorList.Remove(curStore.ColorName);
                            colorList.Add(color.Name);
                        }
                    }

                    item.Colors = CommonGlobalUtil.GetColorFromGridView(colorList);



                    short F = 0, XS = 0, S = 0, M = 0, L = 0, XL = 0, XL2 = 0, XL3 = 0, XL4 = 0, XL5 = 0, XL6 = 0;

                    if (this.dataGridView2 != null && this.dataGridView2.Rows.Count > 0)
                    {
                        PfCustomerStore curStoreItem = this.dataGridView2.Rows[0].DataBoundItem as PfCustomerStore;
                        if (curStoreItem != null)
                        {
                            F          = curStoreItem.F;
                            XS         = curStoreItem.XS;
                            S          = curStoreItem.S;
                            M          = curStoreItem.M;
                            L          = curStoreItem.L;
                            XL         = curStoreItem.XL;
                            XL2        = curStoreItem.XL2;
                            XL3        = curStoreItem.XL3;
                            XL4        = curStoreItem.XL4;
                            XL5        = curStoreItem.XL5;
                            XL6        = curStoreItem.XL6;
                            customerID = curStoreItem.PfCustomerID;
                        }
                    }
                    UpdateStartStoreCostumePara updateStorePara = new UpdateStartStoreCostumePara()
                    {
                        BrandID       = item.BrandID,
                        ClassID       = item.ClassID,
                        CostPrice     = item.CostPrice,
                        ID            = item.ID,
                        Name          = item.Name,
                        Price         = item.Price,
                        Remarks       = item.Remarks,
                        SalePrice     = item.SalePrice,
                        Season        = item.Season,
                        SizeGroupName = item.SizeGroupName,
                        SizeNames     = item.SizeNames,
                        SupplierID    = item.SupplierID,
                        Year          = item.Year,
                        OldColorName  = curStore.ColorName,
                        NewColorName  = color.Name,

                        F   = F,
                        XS  = XS,
                        S   = S,
                        L   = L,
                        M   = M,
                        XL  = XL,
                        XL2 = XL2,
                        XL3 = XL3,
                        XL4 = XL4,
                        XL5 = XL5,
                        XL6 = XL6,

                        //ShopID = curStore.PfCustomerID,
                        IsPf         = true,
                        PfCustomerID = this.customerID,
                        // PfCustomerID=
                        Colors = item.Colors,
                    };
                    InteractResult result = GlobalCache.ServerProxy.UpdateStartStoreCostume(updateStorePara);
                    // InteractResult result = GlobalCache.ServerProxy.UpdateCostume(item);
                    switch (result.ExeResult)
                    {
                    case ExeResult.Success:
                        GlobalMessageBox.Show("保存成功!");
                        // GlobalCache.CostumeList_OnChange(item);
                        CurItem = item;
                        this.Hide();
                        this.Close();
                        this.DialogResult = DialogResult.OK;
                        break;

                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    PfCustomerStore costumeStore = dataGridView2.Rows[0].DataBoundItem as PfCustomerStore;
                    PfCustomerStore item         = new PfCustomerStore();
                    ReflectionHelper.CopyProperty(costumeStore, item);
                    item.CostumeID   = skinTextBox_ID.Text;
                    item.CostumeName = skinTextBox_Name.Text;
                    item.Year        = (int)(this.skinComboBox_Year.SelectedValue);
                    item.Price       = numericUpDown_Price.Value;
                    // item.SalePrice =
                    item.CostPrice = numericUpDownCostPrice.Value;
                    item.ClassID   = skinComboBoxBigClass.SelectedValue.ClassID;
                    item.ClassCode = GetClassCode(item.ClassID);

                    //线上商城原属性不替换
                    //  item.BigClass = this.skinComboBoxBigClass.SelectedValue?.BigClass;
                    //  item.SmallClass = this.skinComboBoxBigClass.SelectedValue?.SmallClass;
                    //  item.SubSmallClass = this.skinComboBoxBigClass.SelectedValue?.SubSmallClass;
                    if (this.skinComboBox_Brand.SelectedItem != null)
                    {
                        item.BrandID   = this.skinComboBox_Brand.SelectedItem.AutoID;
                        item.BrandName = this.skinComboBox_Brand.SelectedItem.Name;
                    }
                    item.Season         = ValidateUtil.CheckEmptyValue(this.skinComboBox_Season.SelectedValue);
                    item.SupplierID     = skinComboBox_SupplierID.SelectedItem?.ID;
                    item.SupplierName   = skinComboBox_SupplierID.SelectedItem?.Name;
                    item.ColorName      = this.colorComboBox1.SelectedItem?.Name;
                    item.CostumeColorID = this.colorComboBox1.SelectedItem.ID;
                    // item.CostumeColorName = this.colorComboBox1.SelectedItem?.Name;
                    List <CostumeStoreExcel> costumeStoreExcels = new List <CostumeStoreExcel>();
                    //item.SizeGroupName= selectSizeGroup.SelectedSizeNames
                    if (selectSizeGroup != null && selectSizeGroup.SizeGroup != null)
                    {
                        item.SizeGroupName     = selectSizeGroup.SizeGroup.SizeGroupName;
                        item.SizeGroupShowName = selectSizeGroup.SizeGroup.ShowName;

                        //   item.SizeNames = selectSizeGroup.SelectedSizeNames;
                    }
                    PfCustomer pfCustomer = PfCustomerCache.GetPfCustomer(customerID);
                    item.SalePrice = this.numericTextBoxSalePrice.Value;
                    CostumeStoreExcel curCostumeStoreExcel = GetCostumeStoreExcel(item);
                    curCostumeStoreExcel.CostumeColorName = item.ColorName;
                    curCostumeStoreExcel.PfPrice          = pfCustomer.PfDiscount * item.Price / 100;

                    costumeStoreExcels.Add(curCostumeStoreExcel);


                    CreatePfCostumeStore store = new CreatePfCostumeStore()
                    {
                        PfCustomerID = customerID,

                        // Date = new CJBasic.Date(),
                        CostumeStoreExcels = costumeStoreExcels,

                        IsImport = true
                    };

                    InteractResult result = GlobalCache.ServerProxy.InsertPfCostumeStores(store);
                    switch (result.ExeResult)
                    {
                    case ExeResult.Success:
                        GlobalMessageBox.Show("新增成功!");
                        ResetAll();
                        this.Close();
                        SaveClick?.Invoke(item);
                        break;

                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }