Пример #1
0
        //
        // GET: /Xueya/
        public ActionResult Index(int?p, int id)
        {
            Pager pager = new Pager();

            pager.table      = "CMSXueya";
            pager.strwhere   = "CustomerId=" + id;
            pager.PageSize   = 10;
            pager.PageNo     = p ?? 1;
            pager.FieldKey   = "XueyaId";
            pager.FiledOrder = "XueyaId Desc";
            pager            = CMSService.SelectAll("Xueya", pager);

            List <XueyaDto> list = new List <XueyaDto>();

            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                XueyaDto dto = XueyaMapping.getDTO(dr);
                list.Add(dto);
            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo       = p ?? 1;
            ViewBag.PageCount    = pager.PageCount;
            ViewBag.RecordCount  = pager.Amount;
            ViewBag.Message      = pager.Amount;
            ViewBag.CustomerId   = id;
            ViewBag.CustomerName = MyService.CustomerIdToName("CustomerId=" + id);

            return(View(pager.Entity));
        }
Пример #2
0
        public static XueyaDto getDTO(DataRow dr)
        {
            XueyaDto xueyaDto = new XueyaDto();

            xueyaDto.XueyaId = int.Parse(dr["XueyaId"].ToString());

            xueyaDto.CustomerId  = int.Parse(dr["CustomerId"].ToString());
            xueyaDto.XueyaGaoya  = int.Parse(dr["XueyaGaoya"].ToString());
            xueyaDto.XueyaDiya   = int.Parse(dr["XueyaDiya"].ToString());
            xueyaDto.XueyaMaibo  = int.Parse(dr["XueyaMaibo"].ToString());
            xueyaDto.XueyaTime   = DateTime.Parse(dr["XueyaTime"].ToString());
            xueyaDto.XueyaSId    = dr["XueyaSId"].ToString();
            xueyaDto.XueyaUId    = int.Parse(dr["XueyaUId"].ToString());
            xueyaDto.CustomerId  = int.Parse(dr["CustomerId"].ToString());
            xueyaDto.XueyaSource = dr["XueyaSource"].ToString();
            xueyaDto.XueyaWeizhi = dr["XueyaWeizhi"].ToString();

            return(xueyaDto);
        }
Пример #3
0
        public ActionResult Create(XueyaAddViewModel model)
        {
            XueyaDto dto = new XueyaDto();

            dto.XueyaDiya   = model.XueyaDiya;
            dto.XueyaGaoya  = model.XueyaGaoya;
            dto.XueyaMaibo  = model.XueyaMaibo;
            dto.XueyaSId    = "XUEYAJISHEBEIHAO";
            dto.XueyaUId    = 1;
            dto.CustomerId  = model.CustomerId;
            dto.XueyaSource = "医生手动测量";
            dto.XueyaTime   = System.DateTime.Now;
            dto.XueyaWeizhi = model.XueyaWeizhi;
            string  JsonString = JsonHelper.JsonSerializerBySingleData(dto);
            Message msg        = CMSService.Insert("Xueya", JsonString);

            // return RedirectTo("/Customer/Index", msg.MessageInfo);
            return(RedirectTo("/Xueya/Index/" + dto.CustomerId, msg.MessageInfo));
        }
Пример #4
0
        public SqlParameter[] JsonStringToSqlParameter(string jsonString)
        {
            SqlParameter[] arParames = new SqlParameter[10];
            XueyaDto       xueyaDto  = JsonHelper.JsonDeserializeBySingleData <XueyaDto>(jsonString);

            arParames[0]       = new SqlParameter("@XueyaId", SqlDbType.Int);
            arParames[0].Value = xueyaDto.XueyaId;

            arParames[1]       = new SqlParameter("@XueyaGaoya", SqlDbType.Int);
            arParames[1].Value = xueyaDto.XueyaGaoya;

            arParames[2]       = new SqlParameter("@XueyaDiya", SqlDbType.Int);
            arParames[2].Value = xueyaDto.XueyaDiya;

            arParames[3]       = new SqlParameter("@XueyaMaibo", SqlDbType.Int);
            arParames[3].Value = xueyaDto.XueyaMaibo;

            arParames[4]       = new SqlParameter("@XueyaTime", SqlDbType.DateTime);
            arParames[4].Value = xueyaDto.XueyaTime;

            arParames[5]       = new SqlParameter("@XueyaSId", SqlDbType.VarChar, 50);
            arParames[5].Value = xueyaDto.XueyaSId;

            arParames[6]       = new SqlParameter("@XueyaUId", SqlDbType.Int);
            arParames[6].Value = xueyaDto.XueyaUId;

            arParames[7]       = new SqlParameter("@CustomerId", SqlDbType.Int);
            arParames[7].Value = xueyaDto.CustomerId;

            arParames[8]       = new SqlParameter("@XueyaSource", SqlDbType.VarChar, 50);
            arParames[8].Value = xueyaDto.XueyaSource;

            arParames[9]       = new SqlParameter("@XueyaWeizhi ", SqlDbType.VarChar, 50);
            arParames[9].Value = xueyaDto.XueyaWeizhi;



            return(arParames);
        }