예제 #1
0
        /// <summary>
        /// 绑定选定款号对应的CostumeStore集合
        /// </summary>
        private void BindingSelectedCostumeStoreSource()
        {
            if (this.curSelectedCostumeStoreList == null)
            {
                this.dataGridView1.DataSource = null;
            }
            else
            {
                dataGridViewPagingSumCtrl.DisableStyle();
                this.dataGridView1.DataSource = null;
                if (this.curSelectedCostumeStoreList != null && this.curSelectedCostumeStoreList.Count > 0)
                {
                    List <CostumeStore> tempList = new List <CostumeStore>();
                    foreach (CostumeStore store in this.curSelectedCostumeStoreList)
                    {
                        store.Title       = "库存";
                        store.CostumeName = GlobalCache.GetCostumeName(store.CostumeID);
                        CostumeStore tempStore = this.BuildCostumeStore4NeedReplenish(store);
                        //CJBasic.Helpers.ReflectionHelper.CopyProperty(store, obj);
                        tempList.Add(store);
                        tempList.Add(tempStore);
                    }
                    this.curSelectedCostumeStoreList = tempList;

                    ////重新排序,同款同颜色排一起,且将补货数量拍在库存后面
                    //this.curSelectedCostumeStoreList.Sort((x, y) =>
                    //{
                    //    int sort = x.ColorName.CompareTo(y.ColorName);
                    //    if (sort == 0)
                    //    {
                    //        sort = -x.Title.CompareTo(y.Title);
                    //    }
                    //    return sort;
                    //});
                    this.dataGridView1.DataSource = this.curSelectedCostumeStoreList;
                    foreach (DataGridViewRow row in dataGridView1.Rows)
                    {
                        if (row.Index % 2 == 0)
                        {
                            row.ReadOnly         = true;
                            row.HeaderCell.Value = "库存";
                        }
                        else
                        {
                            row.ReadOnly         = false;
                            row.HeaderCell.Value = "补货申请";
                        }
                    }

                    dataGridViewPagingSumCtrl.EnableStyle();
                }
            }
            this.dataGridView1.Refresh();
            dataGridViewPagingSumCtrl.AutoFocusToWritableCell();
        }