Exemplo n.º 1
0
        //private sm02_soft_keep_detail SM01VMtoSM02VM(SM01ViewModel viewmodel)
        //{
        //    sm02_soft_keep_detail _model = new sm02_soft_keep_detail();
        //    _model.year = viewmodel.year;
        //    _model.org = viewmodel.org;
        //    _model.dept = viewmodel.dept;
        //    _model.soft_id = viewmodel.soft_id;
        //    _model.keep_org = "";
        //    return _model;
        //}

        public void addSM01(SMViewModel viewmodel)
        {
            IRepository <sm02_soft_keep_detail> db2 = new GenericRepository <sm02_soft_keep_detail>();
            SM01ViewModel         SM01VM            = SMVMtoSM01VM(viewmodel);
            SM02ViewModel         SM02VM            = SMVMtoSM02VM(viewmodel);
            sm01_soft_keep_main   _SM01model        = SM01VMtoM(SM01VM);
            sm02_soft_keep_detail _SM02model        = SM02VMtoM(SM02VM);

            db.Insert(_SM01model);
            db2.Insert(_SM02model);
        }
Exemplo n.º 2
0
        //public IQueryable<SM02ViewModel> Get()
        //{
        //    List<SM02ViewModel> model = new List<SM02ViewModel>();
        //    var dbresult = db.Get().AsQueryable();
        //    //TotalRow = db.Get().ToList().Count;
        //    //var dbresult = db.Get().ToList().Skip((CurrPage - 1) * PageSize).Take(PageSize).ToList();
        //    foreach (var items in dbresult)
        //    {
        //        SM02ViewModel _model = new SM02ViewModel();
        //        _model.year = items.year.Trim();
        //        _model.org= items.org.Trim();
        //        _model.dept= items.dept.Trim();
        //        _model.soft_id= items.soft_id.Trim();
        //        _model.detail_id= items.detail_id.Trim();
        //        _model.keep_org= items.keep_org.Trim();
        //        _model.keep_man= items.keep_man.Trim();
        //        _model.use_org= items.use_org.Trim();
        //        _model.use_man= items.use_man.Trim();
        //        _model.soft_ver= items.use_man.Trim();
        //        _model.soft_cost= items.soft_cost;
        //        _model.auth_number= items.auth_number;
        //        _model.update_date= items.update_date;
        //        _model.decrease_reason= items.decrease_reason.Trim();
        //        _model.decrease_handle= items.decrease_handle.Trim();
        //        _model.detail_memo = items.detail_memo.Trim();
        //        model.Add(_model);
        //    }
        //    return model.AsQueryable();

        //}
        public SM02ViewModel Get(string year, string org, string dept, string soft_id, int detail_id)
        {
            List <SM02ViewModel> model = new List <SM02ViewModel>();
            //var dbresult = db.Get().AsQueryable();
            var dbresult = db.Get().ToList();
            //var result = dbresult.Find(year, org, dept, soft_id);
            int  i       = 0;
            bool isfound = false;
            sm02_soft_keep_detail result = new sm02_soft_keep_detail();

            while (i < dbresult.Count)
            {
                if (dbresult[i].year.Trim() == year && dbresult[i].org.Trim() == org && dbresult[i].dept.Trim() == dept && dbresult[i].soft_id.Trim() == soft_id && dbresult[i].detail_id == detail_id)
                {
                    result  = dbresult[i];
                    isfound = true;
                }
                i++;
            }
            if (isfound)
            {
                SM02ViewModel _model = new SM02ViewModel();
                _model.year            = result.year.Trim();
                _model.org             = result.org.Trim();
                _model.dept            = result.dept.Trim();
                _model.soft_id         = result.soft_id.Trim();
                _model.detail_id       = result.detail_id;
                _model.keep_org        = string.IsNullOrEmpty(result.keep_org) ? null : result.keep_org.Trim();
                _model.keep_man        = string.IsNullOrEmpty(result.keep_man) ? null : result.keep_man.Trim();
                _model.use_org         = string.IsNullOrEmpty(result.use_org) ? null : result.use_org.Trim();
                _model.use_man         = string.IsNullOrEmpty(result.use_man) ? null : result.use_man.Trim();
                _model.soft_ver        = string.IsNullOrEmpty(result.soft_ver) ? null : result.soft_ver.Trim();
                _model.soft_cost       = result.soft_cost == null ? null : result.soft_cost;
                _model.auth_number     = result.auth_number == null ? null : result.auth_number;
                _model.update_date     = result.update_date == null ? System.DateTime.MinValue : result.update_date.ToLocalTime();
                _model.decrease_reason = string.IsNullOrEmpty(result.decrease_reason) ? result.decrease_reason.Trim() : null;
                _model.decrease_handle = string.IsNullOrEmpty(result.decrease_handle) ? result.decrease_handle.Trim() : null;
                _model.detail_memo     = string.IsNullOrEmpty(result.detail_memo) ? null : result.detail_memo.Trim();
                model.Add(_model);
                return(_model);
            }
            else
            {
                return(new SM02ViewModel());
            }
        }
Exemplo n.º 3
0
        //public IQueryable<SM02ViewModel> Get()
        //{
        //    List<SM02ViewModel> model = new List<SM02ViewModel>();
        //    var dbresult = db.Get().AsQueryable();
        //    //TotalRow = db.Get().ToList().Count;
        //    //var dbresult = db.Get().ToList().Skip((CurrPage - 1) * PageSize).Take(PageSize).ToList();
        //    foreach (var items in dbresult)
        //    {
        //        SM02ViewModel _model = new SM02ViewModel();
        //        _model.year = items.year.Trim();
        //        _model.org= items.org.Trim();
        //        _model.dept= items.dept.Trim();
        //        _model.soft_id= items.soft_id.Trim();
        //        _model.detail_id= items.detail_id.Trim();
        //        _model.keep_org= items.keep_org.Trim();
        //        _model.keep_man= items.keep_man.Trim();
        //        _model.use_org= items.use_org.Trim();
        //        _model.use_man= items.use_man.Trim();
        //        _model.soft_ver= items.use_man.Trim();
        //        _model.soft_cost= items.soft_cost;
        //        _model.auth_number= items.auth_number;
        //        _model.update_date= items.update_date;
        //        _model.decrease_reason= items.decrease_reason.Trim();
        //        _model.decrease_handle= items.decrease_handle.Trim();
        //        _model.detail_memo = items.detail_memo.Trim();
        //        model.Add(_model);
        //    }
        //    return model.AsQueryable();

        //}
        public SM02ViewModel Get(string year, string org, string dept, string soft_id, string detail_id)
        {
            List <SM02ViewModel> model = new List <SM02ViewModel>();
            //var dbresult = db.Get().AsQueryable();
            var dbresult = db.Get().ToList();
            //var result = dbresult.Find(year, org, dept, soft_id);
            int  i       = 0;
            bool isfound = false;
            sm02_soft_keep_detail result = new sm02_soft_keep_detail();

            while (i < dbresult.Count)
            {
                if (dbresult[i].year.Trim() == year && dbresult[i].org.Trim() == org && dbresult[i].dept.Trim() == dept && dbresult[i].soft_id.Trim() == soft_id && dbresult[i].detail_id == detail_id)
                {
                    result  = dbresult[i];
                    isfound = true;
                }
                i++;
            }
            if (isfound)
            {
                SM02ViewModel _model = new SM02ViewModel();
                _model.org             = result.org.Trim();
                _model.dept            = result.dept.Trim();
                _model.soft_id         = result.soft_id.Trim();
                _model.detail_id       = result.detail_id.Trim();
                _model.keep_org        = result.keep_org.Trim();
                _model.keep_man        = result.keep_man.Trim();
                _model.use_org         = result.use_org.Trim();
                _model.use_man         = result.use_man.Trim();
                _model.soft_ver        = result.use_man.Trim();
                _model.soft_cost       = result.soft_cost;
                _model.auth_number     = result.auth_number;
                _model.update_date     = result.update_date;
                _model.decrease_reason = result.decrease_reason.Trim();
                _model.decrease_handle = result.decrease_handle.Trim();
                _model.detail_memo     = result.detail_memo.Trim();
                model.Add(_model);
                return(_model);
            }
            else
            {
                return(new SM02ViewModel());
            }
        }
Exemplo n.º 4
0
        private sm02_soft_keep_detail SM02VMtoM(SM02ViewModel items)
        {
            sm02_soft_keep_detail _model = new sm02_soft_keep_detail();

            _model.year            = items.year.Trim();
            _model.org             = items.org.Trim();
            _model.dept            = items.dept.Trim();
            _model.soft_id         = items.soft_id.Trim();
            _model.detail_id       = items.detail_id;
            _model.keep_org        = string.IsNullOrEmpty(items.keep_org) ? null : items.keep_org.Trim();
            _model.keep_man        = string.IsNullOrEmpty(items.keep_man) ? null : items.keep_man.Trim();
            _model.use_org         = string.IsNullOrEmpty(items.use_org) ? null : items.use_org.Trim();
            _model.use_man         = string.IsNullOrEmpty(items.use_man) ? null : items.use_man.Trim();
            _model.soft_ver        = string.IsNullOrEmpty(items.soft_ver) ? null : items.soft_ver.Trim();
            _model.soft_cost       = items.soft_cost == null ? null : items.soft_cost;
            _model.auth_number     = items.auth_number == null ? null : items.auth_number;
            _model.update_date     = items.update_date == null ? System.DateTime.MinValue : items.update_date.ToLocalTime();
            _model.decrease_reason = string.IsNullOrEmpty(items.decrease_reason) ? null : items.decrease_reason.Trim();
            _model.decrease_handle = string.IsNullOrEmpty(items.decrease_handle) ? null : items.decrease_handle.Trim();
            _model.detail_memo     = string.IsNullOrEmpty(items.detail_memo) ? null : items.detail_memo.Trim();
            return(_model);
        }
Exemplo n.º 5
0
        private sm02_soft_keep_detail SM02VMtoM(SM02ViewModel items)
        {
            sm02_soft_keep_detail _model = new sm02_soft_keep_detail();

            _model.year            = items.year.Trim();
            _model.org             = items.org.Trim();
            _model.dept            = items.dept.Trim();
            _model.soft_id         = items.soft_id.Trim();
            _model.detail_id       = items.detail_id;
            _model.keep_org        = items.keep_org;
            _model.keep_man        = items.keep_man;
            _model.use_org         = items.use_org;
            _model.use_man         = items.use_man;
            _model.soft_ver        = items.soft_ver;
            _model.soft_cost       = items.soft_cost;
            _model.auth_number     = items.auth_number;
            _model.update_date     = items.update_date;
            _model.decrease_reason = items.decrease_reason;
            _model.decrease_handle = items.decrease_handle;
            _model.detail_memo     = items.detail_memo;
            return(_model);
        }
Exemplo n.º 6
0
        private sm02_soft_keep_detail SM02VMtoM(SM02ViewModel viewmodel)
        {
            sm02_soft_keep_detail _model = new sm02_soft_keep_detail();

            _model.year            = viewmodel.year.Trim();
            _model.org             = viewmodel.org.Trim();
            _model.dept            = viewmodel.dept.Trim();
            _model.soft_id         = viewmodel.soft_id.Trim();
            _model.detail_id       = viewmodel.detail_id.Trim();
            _model.keep_org        = viewmodel.keep_org.Trim();
            _model.keep_man        = viewmodel.keep_man.Trim();
            _model.use_org         = viewmodel.use_org.Trim();
            _model.use_man         = viewmodel.use_man.Trim();
            _model.soft_ver        = viewmodel.use_man.Trim();
            _model.soft_cost       = viewmodel.soft_cost;
            _model.auth_number     = viewmodel.auth_number;
            _model.update_date     = viewmodel.update_date;
            _model.decrease_reason = viewmodel.decrease_reason.Trim();
            _model.decrease_handle = viewmodel.decrease_handle.Trim();
            _model.detail_memo     = viewmodel.detail_memo.Trim();
            return(_model);
        }
Exemplo n.º 7
0
        public void saveSM02(SM02ViewModel viewmodel)
        {
            sm02_soft_keep_detail _model = SM02VMtoM(viewmodel);

            db.Update(_model);
        }
Exemplo n.º 8
0
        public void addSM02(SM02ViewModel viewmodel)
        {
            sm02_soft_keep_detail _model = SM02VMtoM(viewmodel);

            db.Insert(_model);
        }