Пример #1
0
        private SM01ViewModel SMVMtoSM01VM(SMViewModel items)
        {
            SM01ViewModel _model = new SM01ViewModel();

            _model.year          = items.year.Trim();
            _model.org           = items.org.Trim();
            _model.dept          = items.dept.Trim();
            _model.soft_id       = items.soft_id.Trim();
            _model.soft_name     = string.IsNullOrEmpty(items.soft_name) ? null : items.soft_name.Trim();
            _model.user_id       = string.IsNullOrEmpty(items.user_id) ? null : items.user_id.Trim();
            _model.soft_type     = string.IsNullOrEmpty(items.soft_type) ? null : items.soft_type.Trim();
            _model.soft_sn       = string.IsNullOrEmpty(items.soft_sn) ? null : items.soft_sn.Trim();
            _model.soft_for      = string.IsNullOrEmpty(items.soft_for) ? null : items.soft_for.Trim();
            _model.soft_work_on  = string.IsNullOrEmpty(items.soft_work_on) ? null : items.soft_work_on.Trim();
            _model.soft_max_user = items.soft_max_user == null ? null : items.soft_max_user;
            _model.soft_number   = items.soft_number == null ? null : items.soft_number;
            _model.soft_cost     = items.soft_cost == null ? null : items.soft_cost;
            _model.soft_platform = string.IsNullOrEmpty(items.soft_platform) ? null : items.soft_platform.Trim();
            _model.soft_from     = string.IsNullOrEmpty(items.soft_from) ? null : items.soft_from.Trim();

            _model.soft_from_unit = string.IsNullOrEmpty(items.soft_from_unit) ? null : items.soft_from_unit.Trim();
            _model.soft_keeper    = string.IsNullOrEmpty(items.soft_keeper) ? null : items.soft_keeper.Trim();
            _model.soft_doc       = string.IsNullOrEmpty(items.soft_doc) ? null : items.soft_doc.Trim();
            _model.install_date   = items.install_date == null ? System.DateTime.MinValue : items.install_date.ToLocalTime();
            _model.install_place  = string.IsNullOrEmpty(items.install_place) ? null : items.install_place.Trim();
            _model.memo           = string.IsNullOrEmpty(items.memo) ? null : items.memo.Trim();
            return(_model);
        }
Пример #2
0
        private SM01ViewModel SMVMtoSM01VM(SMViewModel items)
        {
            SM01ViewModel _model = new SM01ViewModel();

            _model.year           = items.year.Trim();
            _model.org            = items.org.Trim();
            _model.dept           = items.dept.Trim();
            _model.soft_id        = items.soft_id.Trim();
            _model.soft_name      = items.soft_name.Trim();
            _model.user_id        = items.user_id.Trim();
            _model.soft_type      = items.soft_type.Trim();
            _model.soft_sn        = items.soft_sn.Trim();
            _model.soft_for       = items.soft_for.Trim();
            _model.soft_work_on   = items.soft_work_on.Trim();
            _model.soft_max_user  = items.soft_max_user;
            _model.soft_number    = items.soft_number;
            _model.soft_platform  = items.soft_platform.Trim();
            _model.soft_from      = items.soft_from.Trim();
            _model.soft_from_unit = items.soft_from_unit.Trim();
            _model.soft_keeper    = items.soft_keeper.Trim();
            _model.soft_doc       = items.soft_doc.Trim();
            _model.install_date   = items.install_date;
            _model.install_place  = items.install_place.Trim();
            _model.memo           = items.memo.Trim();
            return(_model);
        }
Пример #3
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);
        }
Пример #4
0
        //public HttpResponseMessage Get(int type)
        //{
        //    try
        //    {
        //        switch(type)
        //        {
        //            case 1 :
        //                BD01Service BD01 = new BD01Service();
        //                var bd01datas = BD01.Get();
        //                return Request.CreateResponse(HttpStatusCode.OK, bd01datas);

        //            case 2 :
        //                BD02Service BD02 = new BD02Service();
        //                var bd02datas = BD02.Get();
        //                return Request.CreateResponse(HttpStatusCode.OK, bd02datas);

        //            case 3 :
        //                BD03Service BD03 = new BD03Service();
        //                var bd03datas = BD03.Get();
        //                return Request.CreateResponse(HttpStatusCode.OK, bd03datas);

        //        }
        //        return Request.CreateResponse(HttpStatusCode.BadRequest, "Unable Get Datas");
        //        //int TotalRow = 0;
        //        //var datas = BD01S.Get();
        //        //var Rvl = new { Total = TotalRow, Data = datas };
        //        //var datas = service.Get();
        //        //return Request.CreateResponse(HttpStatusCode.OK, datas);
        //    }
        //    catch (Exception ex)
        //    {
        //        return Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message.ToString());
        //    }

        //}
        //public HttpResponseMessage Get(int type, string year, string org)
        //{
        //    try
        //    {
        //        switch (type)
        //        {
        //            case 2:
        //                BD02Service BD02 = new BD02Service();
        //                var bd02datas = BD02.Get();
        //                bd02datas = bd02datas.Where(bd02 => bd02.dept_year == year && bd02.dept_org == org);
        //                return Request.CreateResponse(HttpStatusCode.OK, bd02datas);
        //            default:
        //                return Request.CreateResponse(HttpStatusCode.BadRequest, "Unable Get Datas");
        //        }
        //        //int TotalRow = 0;
        //        //var datas = BD01S.Get();
        //        //var Rvl = new { Total = TotalRow, Data = datas };
        //        //var datas = service.Get();
        //        //return Request.CreateResponse(HttpStatusCode.OK, datas);
        //    }
        //    catch (Exception ex)
        //    {
        //        return Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message.ToString());
        //    }

        //}
        public HttpResponseMessage Post(SMViewModel model)
        {
            try
            {
                service.addSM01(model);
                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message.ToString()));
            }
        }
Пример #5
0
        private SM02ViewModel SMVMtoSM02VM(SMViewModel items)
        {
            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;
            _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);
        }
Пример #6
0
        private SM02ViewModel SMVMtoSM02VM(SMViewModel items)
        {
            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;
            _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);
        }