Example #1
0
        //添加
        public async Task <IActionResult> register_Add(salary_standardModel1 ssm)
        {
            if (ModelState.IsValid)
            {
                string[] item_id   = HttpContext.Request.Form["details.itemId"];
                string[] item_name = HttpContext.Request.Form["details.itemName"];
                string[] salary    = HttpContext.Request.Form["details.salary"];

                int result = await issb.salary_standardAdd(ssm);

                if (result > 0)
                {
                    for (int i = 0; i < item_id.Length; i++)
                    {
                        salary_standard_detailsModel ssdm = new salary_standard_detailsModel()
                        {
                            item_id       = int.Parse(item_id[i].ToString()),
                            item_name     = item_name[i].ToString(),
                            salary        = double.Parse(salary[i].ToString()),
                            standard_id   = ssm.standard_id,
                            standard_name = ssm.standard_name
                        };

                        int result2 = await issdb.salary_standard_detailsAdd(ssdm);
                    }
                }
                return(View("register_success"));
            }
            else
            {
                return(View(ssm));
            }
        }
Example #2
0
        public ActionResult Add( )
        {
            string salary_standard         = Request["salary_standard"];
            string salary_standard_details = Request["salary_standard_details"];

            int ress = 0;
            List <Dictionary <string, object> > list = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(salary_standard_details);

            foreach (Dictionary <string, object> item in list)
            {
                salary_standard_detailsModel sala = new salary_standard_detailsModel();
                sala.standard_name = item["mc"].ToString();
                sala.item_id       = int.Parse(item["xh"].ToString());
                sala.item_name     = item["xcmc"].ToString();
                sala.salary        = Convert.ToDecimal(item["je"].ToString());
                sala.standard_id   = item["bh"].ToString();
                ress = sd.salary_standard_detailsAdd(sala);
            }

            Dictionary <string, object> di  = JsonConvert.DeserializeObject <Dictionary <string, object> >(salary_standard);
            salary_standardModel        ssm = new salary_standardModel()
            {
                standard_id   = di["bh"].ToString(),
                standard_name = di["mc"].ToString(),
                designer      = di["zdr"].ToString(),
                register      = di["djr"].ToString(),
                regist_time   = Convert.ToDateTime(di["djsj"].ToString()),
                salary_sum    = decimal.Parse(di["ze"].ToString()),
                remark        = di["bz"].ToString()
            };
            int res = sa.salary_standardAdd(ssm);

            if (res > 0 && ress > 0)
            {
                return(Content("OK"));
            }
            else
            {
                return(Content("ON"));
            }
        }