コード例 #1
0
ファイル: Try02Controller.cs プロジェクト: MrYoungHi/CrmY2
        public List <HumenModel> GetHuman()
        {
            List <Humen>      list  = db.hu.ToList();
            List <HumenModel> list2 = new List <HumenModel>();

            foreach (Humen item in list)
            {
                HumenModel bjm = new HumenModel()
                {
                    hfd_id               = item.hfd_id,
                    human_id             = item.human_id,
                    first_kind_name      = item.first_kind_name,
                    second_kind_id       = item.second_kind_id,
                    second_kind_name     = item.second_kind_name,
                    third_kind_id        = item.third_kind_id,
                    third_kind_name      = item.third_kind_name,
                    human_name           = item.human_name,
                    salary_standard_id   = item.salary_standard_id,
                    salary_standard_name = item.salary_standard_name,
                    salary_sum           = item.salary_sum,
                    demand_salaray_sum   = item.demand_salaray_sum,
                    paid_salary_sum      = item.paid_salary_sum,
                };
                list2.Add(bjm);
            }
            return(list2);
        }
コード例 #2
0
        public List <HumenModel> GetPageList(int pageIndex, int pageSize, ref int totalCount)
        {
            string            strSql    = "select * from salary_grant";
            string            orderfied = "order by sgr_id desc";
            var               data      = SelectPageList <Humen>(strSql, pageIndex, pageSize, orderfied, ref totalCount);
            List <Humen>      list      = data.ToList();
            List <HumenModel> list2     = new List <HumenModel>();

            //需要把ED->DTO
            foreach (Humen item in list)
            {
                HumenModel bjm = new HumenModel()
                {
                    human_id             = item.human_id,
                    first_kind_name      = item.first_kind_name,
                    second_kind_id       = item.second_kind_id,
                    second_kind_name     = item.second_kind_name,
                    third_kind_id        = item.third_kind_id,
                    third_kind_name      = item.third_kind_name,
                    human_name           = item.human_name,
                    salary_standard_id   = item.salary_standard_id,
                    salary_standard_name = item.salary_standard_name,
                    salary_sum           = item.salary_sum,
                    demand_salaray_sum   = item.demand_salaray_sum,
                    paid_salary_sum      = item.paid_salary_sum,
                };
                list2.Add(bjm);
            }
            return(list2);
        }
コード例 #3
0
        public List <HumenModel> SelectById2(int id)
        {
            List <Humen>      list  = SelectByIds1(id);
            List <HumenModel> list2 = new List <HumenModel>();

            //需要把ED->DTO
            foreach (Humen item in list)
            {
                HumenModel bjm = new HumenModel()
                {
                    human_id             = item.human_id,
                    first_kind_name      = item.first_kind_name,
                    second_kind_id       = item.second_kind_id,
                    second_kind_name     = item.second_kind_name,
                    third_kind_id        = item.third_kind_id,
                    third_kind_name      = item.third_kind_name,
                    human_name           = item.human_name,
                    salary_standard_id   = item.salary_standard_id,
                    salary_standard_name = item.salary_standard_name,
                    salary_sum           = item.salary_sum,
                    demand_salaray_sum   = item.demand_salaray_sum,
                    paid_salary_sum      = item.paid_salary_sum,
                };
                list2.Add(bjm);
            }
            return(list2);
        }
コード例 #4
0
        public List <HumenModel> SelectHid(int id)
        {
            List <Humen>      bj   = SelectHumenId(id);
            List <HumenModel> list = new List <HumenModel>();

            //把EO->DTO
            foreach (Humen item in bj)
            {
                HumenModel bjm = new HumenModel()
                {
                    hfd_id               = item.hfd_id,
                    human_id             = item.human_id,
                    first_kind_id        = item.first_kind_id,
                    first_kind_name      = item.first_kind_name,
                    second_kind_id       = item.second_kind_id,
                    second_kind_name     = item.second_kind_name,
                    third_kind_id        = item.third_kind_id,
                    third_kind_name      = item.third_kind_name,
                    human_name           = item.human_name,
                    salary_standard_id   = item.salary_standard_id,
                    salary_standard_name = item.salary_standard_name,
                    salary_sum           = item.salary_sum,
                    demand_salaray_sum   = item.demand_salaray_sum,
                    paid_salary_sum      = item.paid_salary_sum,
                    statu = item.statu,
                };
                list.Add(bjm);
            }

            return(list);
        }
コード例 #5
0
ファイル: Try02Controller.cs プロジェクト: MrYoungHi/CrmY2
        public async Task <ActionResult> Edit(HumenModel bjm)
        {
            HttpClient hc = new HttpClient();

            hc.BaseAddress = new Uri("https://localhost:44364/");
            HttpResponseMessage hp = await hc.PutAsJsonAsync("api/Try02", bjm);

            try
            {
                int result = await hp.Content.ReadAsAsync <int>();

                if (result > 0)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(bjm));
                }
            }
            catch (Exception ex)
            {
                string sr = ex.Message;
                throw;
            }
        }
コード例 #6
0
ファイル: Try02Controller.cs プロジェクト: MrYoungHi/CrmY2
        public async Task <ActionResult> Edit(int?id)
        {
            HttpClient hc = new HttpClient();

            hc.BaseAddress = new Uri("https://localhost:44364/");
            HttpResponseMessage hp = await hc.GetAsync("api/Try02/" + id);

            HumenModel bjm = await hp.Content.ReadAsAsync <HumenModel>();

            ViewData.Model = bjm;
            return(View());
        }
コード例 #7
0
ファイル: Try02Controller.cs プロジェクト: MrYoungHi/CrmY2
        public async Task <ActionResult> Create(HumenModel bjm)
        {
            HttpClient hc = new HttpClient();

            hc.BaseAddress = new Uri("https://localhost:44364/");
            HttpResponseMessage hp = await hc.PostAsJsonAsync("api/Try02", bjm);

            int result = await hp.Content.ReadAsAsync <int>();

            if (result > 0)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(bjm));
            }
        }
コード例 #8
0
ファイル: Try02Controller.cs プロジェクト: MrYoungHi/CrmY2
        public HumenModel GetBj(int id)
        {
            Humen      bj  = db.hu.Find(id);
            HumenModel bjm = new HumenModel()
            {
                hfd_id               = bj.hfd_id,
                human_id             = bj.human_id,
                first_kind_name      = bj.first_kind_name,
                second_kind_id       = bj.second_kind_id,
                second_kind_name     = bj.second_kind_name,
                third_kind_id        = bj.third_kind_id,
                third_kind_name      = bj.third_kind_name,
                human_name           = bj.human_name,
                salary_standard_id   = bj.salary_standard_id,
                salary_standard_name = bj.salary_standard_name,
                salary_sum           = bj.salary_sum,
                demand_salaray_sum   = bj.demand_salaray_sum,
                paid_salary_sum      = bj.paid_salary_sum,
            };

            return(bjm);
        }
コード例 #9
0
        public int BJEdit(HumenModel bjm)
        {
            Humen bj = new Humen()
            {
                hfd_id               = bjm.hfd_id,
                first_kind_id        = bjm.first_kind_id,
                human_id             = bjm.human_id,
                first_kind_name      = bjm.first_kind_name,
                second_kind_id       = bjm.second_kind_id,
                second_kind_name     = bjm.second_kind_name,
                third_kind_id        = bjm.third_kind_id,
                third_kind_name      = bjm.third_kind_name,
                human_name           = bjm.human_name,
                salary_standard_id   = bjm.salary_standard_id,
                salary_standard_name = bjm.salary_standard_name,
                salary_sum           = bjm.salary_sum,
                demand_salaray_sum   = bjm.demand_salaray_sum,
                paid_salary_sum      = bjm.paid_salary_sum,
                statu = bjm.statu,
            };

            return(Edit(bj));
        }
コード例 #10
0
 public int BJEdit(HumenModel bjm)
 {
     return(MyProperty.BJEdit(bjm));
 }