Exemple #1
0
        private void StoreIn(DataGridView grd)
        {
            var ctrls = this.tabContainer.TabPages;
            var isSaveOk = false;
            if (grd.Rows != null && grd.Rows.Count > 0)
            {
                foreach (var row in grd.Rows)
                {
                    var grdRow = row as DataGridViewRow;
                    if (grdRow.Cells[3].Value != null)
                    {
                        var code = grdRow.Cells[1].Value.ToString();
                        var number = Int32.Parse(grdRow.Cells[3].Value.ToString());
                        if (number > 0)
                        {
                            decimal unitPrice = 0.00M;
                            decimal totalPrice = 0.00M;
                            if (grdRow.Cells[4].Value != null)
                            {
                                unitPrice = decimal.Parse(grdRow.Cells[4].Value.ToString());
                            }
                            if (grdRow.Cells[5].Value != null)
                            {
                                totalPrice = decimal.Parse(grdRow.Cells[5].Value.ToString());
                            }

                            InStoreModel inStoreModel = new InStoreModel();
                            inStoreModel.Id = Guid.NewGuid().ToString();
                            inStoreModel.Code = code;
                            inStoreModel.Department = UIContext.LoginUser.Department;
                            inStoreModel.Number = number;
                            inStoreModel.RemainNumber = number;
                            inStoreModel.RemainTotalPrice = totalPrice;
                            inStoreModel.UnitPrice = unitPrice;
                            inStoreModel.TotalPrice = totalPrice;
                            inStoreModel.Type = grd.Tag.ToString();
                            inStoreModel.CreatedBy = UIContext.LoginUser.Account;
                            inStoreModel.CreatedDate = DateTime.Now;
                            inStoreModel.UpdatedBy = UIContext.LoginUser.Account;
                            inStoreModel.UpdatedDate = DateTime.Now;
                            _inStoreModel.Create(inStoreModel);

                            isSaveOk = true;
                        }
                    }
                }

            }

            if (isSaveOk)
            {
                refreshGrids();
            }
        }
Exemple #2
0
 public List<InStoreModel> GetKCByType(string type, string code = null)
 {
     var bizInstores = _bizInStore.GetKCByType(type, code);
     var inStoreModels = new List<InStoreModel>();
     if (bizInstores != null && bizInstores.Count > 0)
     {
         bizInstores = _bizInStore.MergeSameUnitPriceForSameCode(bizInstores);
         inStoreModels = GetEntitiesFromBiz(bizInstores);
         var i = 1;
         foreach (var instoreModel in inStoreModels)
         {
             var store = new InStoreModel();
             instoreModel.Index = i.ToString().PadLeft(2, '0');
             instoreModel.Name = instoreModel.Code;
             i++;
         }
     }
     return inStoreModels;
 }
Exemple #3
0
 public void Update(InStoreModel instoreModel)
 {
     var dbInstore = GetBizModel(instoreModel);
     _bizInStore.Update(dbInstore);
 }
Exemple #4
0
 public List<InStoreModel> GetInData(string type)
 {
     var mats = _bizMateriel.GetByType(type);
     var stores = new List<InStoreModel>();
     var i = 1;
     foreach (var mat in mats)
     {
         var store = new InStoreModel();
         store.Index = i.ToString().PadLeft(2,'0');
         store.Code = mat.Code;
         store.Name = mat.Name;
         stores.Add(store);
         i++;
     }
     return stores;
 }
Exemple #5
0
 public InStoreModel GetEntityFromBiz(BizLayer.InStore bizInst)
 {
     InStoreModel inst = null;
     if (bizInst != null)
     {
         inst = new InStoreModel();
         inst.Code = bizInst.Code;
         inst.Id = bizInst.Id;
         inst.Number = bizInst.Number;
         inst.RemainNumber = bizInst.RemainNumber;
         inst.RemainTotalPrice = bizInst.RemainTotalPrice;
         inst.UnitPrice = bizInst.UnitPrice;
         inst.TotalPrice = bizInst.TotalPrice;
         inst.Department = bizInst.Department;
         inst.Type = bizInst.Type;
         inst.CreatedBy = bizInst.CreatedBy;
         inst.CreatedDate = bizInst.CreatedDate;
         inst.UpdatedBy = bizInst.UpdatedBy;
         inst.UpdatedDate = bizInst.UpdatedDate;
     }
     return inst;
 }
Exemple #6
0
        public List<InStoreModel> GetByType(string type)
        {
            var mats = _bizInStore.GetByType(type);

            var stores = new List<InStoreModel>();
            var i = 1;
            foreach (var mat in mats)
            {
                var store = new InStoreModel();
                store.Index = i.ToString().PadLeft(2, '0');
                store.Id = mat.Id;
                store.Code = mat.Code;
                store.Name = mat.Code;
                store.Number = mat.Number;
                store.RemainNumber = mat.RemainNumber;
                store.RemainTotalPrice = mat.RemainTotalPrice;
                store.UnitPrice = mat.UnitPrice;
                store.TotalPrice = mat.TotalPrice;
                store.CreatedBy = mat.CreatedBy;
                store.CreatedDate = mat.CreatedDate;
                store.UpdatedBy = mat.UpdatedBy;
                store.UpdatedDate = mat.UpdatedDate;
                stores.Add(store);
                i++;
            }
            return stores;
        }
Exemple #7
0
 public BizLayer.InStore GetBizModel(InStoreModel dpt)
 {
     BizLayer.InStore dbInst = null;
     if (dpt != null)
     {
         dbInst = new BizLayer.InStore();
         dbInst.Code = dpt.Code;
         dbInst.Id = dpt.Id;
         dbInst.Number = dpt.Number;
         dbInst.RemainNumber = dpt.RemainNumber;
         dbInst.RemainTotalPrice = dpt.RemainTotalPrice;
         dbInst.UnitPrice = dpt.UnitPrice;
         dbInst.TotalPrice = dpt.TotalPrice;
         dbInst.Department = dpt.Department;
         dbInst.Type = dpt.Type;
         dbInst.CreatedBy = dpt.CreatedBy;
         dbInst.CreatedDate = dpt.CreatedDate;
         dbInst.UpdatedBy = dpt.UpdatedBy;
         dbInst.UpdatedDate = dpt.UpdatedDate;
     }
     return dbInst;
 }
Exemple #8
0
 public void Create(InStoreModel instoreModel)
 {
     var bizStore = GetBizModel(instoreModel);
     //_bizInStore.Create(dbDpt);
     _bizStockService.Instock(bizStore);
 }