Ejemplo n.º 1
0
        public void Save(ERP_M003_Model ERP_M003_Model, List <ERP_M003_Model_Product> modelProductList)
        {
            tb_Sys_User tempUser    = appCacheService.GetItem("user") as tb_Sys_User;
            var         existsModel = this.GetById(ERP_M003_Model.Id);

            if (existsModel == null)
            {
                ERP_M003_Model.CompCode   = tempUser.CompCode;
                ERP_M003_Model.CreateDt   = DateTime.Now;
                ERP_M003_Model.CreateUser = tempUser.UserName;
                ERP_M003_Model.Validate();
                this.ERP_M003_ModelRepository.Add(ERP_M003_Model);
            }
            else
            {
                ERP_M003_Model.ModifyDt   = DateTime.Now;
                ERP_M003_Model.ModifyUser = tempUser.UserName;
                ERP_M003_Model.Validate();
                this.ERP_M003_ModelRepository.SetValues(ERP_M003_Model, existsModel);
            }
            if (modelProductList != null)
            {
                foreach (var product in modelProductList)
                {
                    var existstproduct = this.modelProductRepository.GetByID(product.Id);
                    if (existstproduct == null)
                    {
                        product.CompCode   = tempUser.CompCode;
                        product.CreateDt   = DateTime.Now;
                        product.CreateUser = tempUser.UserName;
                        product.Validate();
                        this.modelProductRepository.Add(product);
                    }
                    else
                    {
                        product.ModifyDt   = DateTime.Now;
                        product.ModifyUser = tempUser.UserName;
                        product.Validate();
                        this.modelProductRepository.SetValues(product, existstproduct);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void Create(ERP_M003_Model ERP_M003_Model)
        {
            ERP_M003_Model.CreateDt = DateTime.Now;
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

            ERP_M003_Model.CreateUser = tempUser.UserName;
            ERP_M003_Model.CompCode   = tempUser.CompCode;
            ERP_M003_Model.Validate();
            this.ERP_M003_ModelRepository.Add(ERP_M003_Model);
            this.runtimeService.Commit();
        }
Ejemplo n.º 3
0
        public void Update(ERP_M003_Model ERP_M003_Model)
        {
            ERP_M003_Model.ModifyDt = DateTime.Now;
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

            ERP_M003_Model.ModifyUser = tempUser.UserName;
            ERP_M003_Model.Validate();
            var existstb_Sys_Menu = this.GetById(ERP_M003_Model.Id);

            this.ERP_M003_ModelRepository.SetValues(ERP_M003_Model, existstb_Sys_Menu);
            this.runtimeService.Commit();
        }