Ejemplo n.º 1
0
        //
        // GET: /Liangbiao/Details/5
        public ActionResult List(int?p, int id)
        {
            Pager pager = new Pager();

            pager.table      = "CMSTizhi";
            pager.strwhere   = "TizhiCustomerId=" + id;
            pager.PageSize   = 10;
            pager.PageNo     = p ?? 1;
            pager.FieldKey   = "TizhiId";
            pager.FiledOrder = "TizhiId Desc";
            pager            = CMSService.SelectAll("Tizhi", pager);

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

            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                TizhiDto dto = TizhiMapping.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));
        }
Ejemplo n.º 2
0
        public SqlParameter[] JsonStringToSqlParameter(string jsonString)
        {
            SqlParameter[] arParames = new SqlParameter[15];
            TizhiDto       tizhiDto  = JsonHelper.JsonDeserializeBySingleData <TizhiDto>(jsonString);

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

            arParames[1]       = new SqlParameter("@TizhiYangxu", SqlDbType.VarChar, 50);
            arParames[1].Value = tizhiDto.TizhiYangxu;

            arParames[2]       = new SqlParameter("@TizhiYinxu", SqlDbType.VarChar, 50);
            arParames[2].Value = tizhiDto.TizhiYinxu;

            arParames[3]       = new SqlParameter("@TizhiQixu", SqlDbType.VarChar, 50);
            arParames[3].Value = tizhiDto.TizhiQixu;

            arParames[4]       = new SqlParameter("@TizhiTanshi", SqlDbType.VarChar, 50);
            arParames[4].Value = tizhiDto.TizhiTanshi;

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

            arParames[6]       = new SqlParameter("@TizhiXueyu", SqlDbType.VarChar, 50);
            arParames[6].Value = tizhiDto.TizhiXueyu;

            arParames[7]       = new SqlParameter("@TizhiQiyu", SqlDbType.VarChar, 50);
            arParames[7].Value = tizhiDto.TizhiQiyu;

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

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

            arParames[10]       = new SqlParameter("@TizhiResult ", SqlDbType.VarChar, 500);
            arParames[10].Value = tizhiDto.TizhiResult;

            arParames[11]       = new SqlParameter("@TizhiTime ", SqlDbType.DateTime);
            arParames[11].Value = tizhiDto.TizhiTime;

            arParames[12]       = new SqlParameter("@TizhiCustomerId ", SqlDbType.Int);
            arParames[12].Value = tizhiDto.TizhiCustomerId;

            arParames[13]       = new SqlParameter("@TizhiNumber ", SqlDbType.VarChar, 500);
            arParames[13].Value = tizhiDto.TizhiNumber;

            arParames[14]       = new SqlParameter("@TizhiImg ", SqlDbType.VarChar, 500);
            arParames[14].Value = tizhiDto.TizhiImg;



            return(arParames);
        }
Ejemplo n.º 3
0
        public static TizhiDto getDTO(DataRow dr)
        {
            TizhiDto tizhiDto = new TizhiDto();

            tizhiDto.TizhiId         = int.Parse(dr["TizhiId"].ToString());
            tizhiDto.TizhiYangxu     = dr["TizhiYangxu"].ToString();
            tizhiDto.TizhiYinxu      = dr["TizhiYinxu"].ToString();
            tizhiDto.TizhiQixu       = dr["TizhiQixu"].ToString();
            tizhiDto.TizhiTanshi     = dr["TizhiTanshi"].ToString();
            tizhiDto.TizhiShire      = dr["TizhiShire"].ToString();
            tizhiDto.TizhiQiyu       = dr["TizhiQiyu"].ToString();
            tizhiDto.TizhiXueyu      = dr["TizhiXueyu"].ToString();
            tizhiDto.TizhiTebing     = dr["TizhiTebing"].ToString();
            tizhiDto.TizhiPinghe     = dr["TizhiPinghe"].ToString();
            tizhiDto.TizhiResult     = dr["TizhiResult"].ToString();
            tizhiDto.TizhiTime       = DateTime.Parse(dr["TizhiTime"].ToString());
            tizhiDto.TizhiCustomerId = int.Parse(dr["TizhiCustomerId"].ToString());
            tizhiDto.TizhiNumber     = dr["TizhiNumber"].ToString();
            tizhiDto.TizhiImg        = dr["TizhiImg"].ToString();
            return(tizhiDto);
        }
Ejemplo n.º 4
0
        public ActionResult Details(int id)
        {
            TizhiDto  dto = new TizhiDto();
            DataTable dt  = CMSService.SelectOne("Tizhi", "CMSTizhi", "TizhiId=" + id);

            foreach (DataRow dr in dt.Rows)
            {
                dto = TizhiMapping.getDTO(dr);
            }
            CustomerDto cDto       = new CustomerDto();
            DataTable   CustomerDt = CMSService.SelectOne("Customer", "CMSCustomer", "CustomerId=" + dto.TizhiCustomerId);

            foreach (DataRow cdr in CustomerDt.Rows)
            {
                cDto = CustomerMapping.getDTO(cdr);
            }
            ViewBag.CustomerName     = cDto.CustomerName;
            ViewBag.CustomerSex      = cDto.CustomerSex;
            ViewBag.CustomerBirthday = cDto.CustomerBirthday.ToShortDateString();


            return(View(dto));
        }
Ejemplo n.º 5
0
        public ActionResult Index(string id, string cid)
        {
            string    CustomerName     = "";
            string    CustomerSex      = "";
            string    CustomerBirthday = "";
            DataTable dt = CMSService.SelectOne("Customer", "CMSCustomer", "CustomerId=" + cid);

            foreach (DataRow dr in dt.Rows)
            {
                CustomerDto dto = new CustomerDto();
                dto              = CustomerMapping.getDTO(dr);
                CustomerName     = dto.CustomerName;
                CustomerSex      = dto.CustomerSex;
                CustomerBirthday = dto.CustomerBirthday.ToShortDateString();
            }
            string result = id;

            string[] tizhi     = result.Split(',');
            int      i         = 0;
            int      yangxuzhi = 0;

            for (i = 0; i < 7; i++)
            {
                yangxuzhi = yangxuzhi + int.Parse(tizhi[i]);
            }
            int yangxuzhiresult = ((yangxuzhi - 7) * 100) / (7 * 4);

            int yinxuzhi = 0;

            for (i = 7; i < 15; i++)
            {
                yinxuzhi = yinxuzhi + int.Parse(tizhi[i]);
            }
            int yinxuzhiresult = ((yinxuzhi - 8) * 100) / (8 * 4);

            int qixuzhi = 0;

            for (i = 15; i < 23; i++)
            {
                qixuzhi = qixuzhi + int.Parse(tizhi[i]);
            }
            int qixuzhiresult = ((yinxuzhi - 8) * 100) / (8 * 4);

            int tanshizhi = 0;

            for (i = 23; i < 31; i++)
            {
                tanshizhi = tanshizhi + int.Parse(tizhi[i]);
            }
            int tanshizhiresult = ((tanshizhi - 8) * 100) / (8 * 4);

            int shirezhi = 0;

            for (i = 31; i < 38; i++)
            {
                shirezhi = shirezhi + int.Parse(tizhi[i]);
            }
            if (CustomerSex == "男")
            {
                shirezhi = shirezhi - int.Parse(tizhi[36]);
            }
            if (CustomerSex == "女")
            {
                shirezhi = shirezhi - int.Parse(tizhi[37]);
            }

            //如果是男的减去36项,如果是女的减去37项

            int shirezhiresult = ((shirezhi - 6) * 100) / (6 * 4);

            int xueyuzhi = 0;

            for (i = 38; i < 45; i++)
            {
                xueyuzhi = xueyuzhi + int.Parse(tizhi[i]);
            }
            int xueyuzhiresult = ((xueyuzhi - 7) * 100) / (7 * 4);

            int qiyuzhi = 0;

            for (i = 45; i < 52; i++)
            {
                qiyuzhi = qiyuzhi + int.Parse(tizhi[i]);
            }
            int qiyuzhiresult = ((qiyuzhi - 7) * 100) / (7 * 4);


            int tebingzhi = 0;

            for (i = 52; i < 59; i++)
            {
                tebingzhi = tebingzhi + int.Parse(tizhi[i]);
            }
            int tebingzhiresult = ((tebingzhi - 7) * 100) / (7 * 4);


            int pinghezhi = 0;

            for (i = 59; i < 67; i++)
            {
                pinghezhi = pinghezhi + int.Parse(tizhi[i]);
            }
            int pinghezhiresult = ((pinghezhi - 7) * 100) / (7 * 4);

            string Customertizhi = "";

            if (yangxuzhiresult < 30 && yinxuzhiresult < 30 && qixuzhiresult < 30 && tanshizhiresult < 30 && shirezhiresult < 30 && xueyuzhiresult < 30 && qiyuzhiresult < 30 && tebingzhiresult < 30 && pinghezhiresult > 60)
            {
                Customertizhi = "平和质";
            }
            else
            {
                if (yangxuzhiresult >= 40)
                {
                    Customertizhi += "阳虚质,";
                }
                if (yinxuzhiresult >= 40)
                {
                    Customertizhi += "阴虚质,";
                }
                if (qixuzhiresult >= 40)
                {
                    Customertizhi += "气虚质,";
                }
                if (tanshizhiresult >= 40)
                {
                    Customertizhi += "痰湿质,";
                }
                if (shirezhiresult >= 40)
                {
                    Customertizhi += "湿热质,";
                }
                if (xueyuzhiresult >= 40)
                {
                    Customertizhi += "血瘀质,";
                }
                if (qiyuzhiresult >= 40)
                {
                    Customertizhi += "气淤质,";
                }
                if (tebingzhiresult >= 40)
                {
                    Customertizhi += "特禀质,";
                }
            }
            if (!String.IsNullOrEmpty(Customertizhi))
            {
                Customertizhi = Customertizhi.Substring(0, Customertizhi.Length - 1);
            }



            string Customerqinxiangtizhi = "";

            if (yangxuzhiresult > 30 && yangxuzhiresult < 40)
            {
                Customerqinxiangtizhi += "阳虚质,";
            }
            if (yinxuzhiresult > 30 && yinxuzhiresult < 40)
            {
                Customerqinxiangtizhi += "阴虚质,";
            }
            if (qixuzhiresult > 30 && qixuzhiresult < 40)
            {
                Customerqinxiangtizhi += "气虚质,";
            }
            if (tanshizhiresult > 30 && tanshizhiresult < 40)
            {
                Customerqinxiangtizhi += "痰湿质,";
            }
            if (shirezhiresult > 30 && shirezhiresult < 40)
            {
                Customerqinxiangtizhi += "湿热质,";
            }
            if (xueyuzhiresult > 30 && xueyuzhiresult < 40)
            {
                Customerqinxiangtizhi += "血瘀质,";
            }
            if (qiyuzhiresult > 30 && qiyuzhiresult < 40)
            {
                Customerqinxiangtizhi += "气淤质,";
            }
            if (tebingzhiresult > 30 && tebingzhiresult < 40)
            {
                Customerqinxiangtizhi += "特禀质,";
            }
            if (!String.IsNullOrEmpty(Customerqinxiangtizhi))
            {
                Customerqinxiangtizhi = Customerqinxiangtizhi.Substring(0, Customerqinxiangtizhi.Length - 1);
            }

            string   Danganhao = System.DateTime.Now.ToString("yyyyMMddhhmmss");
            TizhiDto tizhiDto  = new TizhiDto();

            tizhiDto.TizhiYangxu     = yangxuzhiresult.ToString();
            tizhiDto.TizhiYinxu      = yinxuzhiresult.ToString();
            tizhiDto.TizhiQixu       = qixuzhiresult.ToString();
            tizhiDto.TizhiTanshi     = tanshizhiresult.ToString();
            tizhiDto.TizhiShire      = shirezhiresult.ToString();
            tizhiDto.TizhiQiyu       = qiyuzhiresult.ToString();
            tizhiDto.TizhiXueyu      = xueyuzhiresult.ToString();
            tizhiDto.TizhiTebing     = tebingzhiresult.ToString();
            tizhiDto.TizhiPinghe     = pinghezhiresult.ToString();
            tizhiDto.TizhiResult     = Customertizhi;
            tizhiDto.TizhiCustomerId = int.Parse(cid);
            tizhiDto.TizhiTime       = System.DateTime.Now;
            tizhiDto.TizhiNumber     = Danganhao;
            tizhiDto.TizhiImg        = "/tizhiresult/" + Danganhao + ".png";

            //ViewBag.yangxuzhiresult = yangxuzhiresult;
            //ViewBag.yinxuzhiresult = yinxuzhiresult;
            //ViewBag.qixuzhiresult = qixuzhiresult;
            //ViewBag.tanshizhiresult = tanshizhiresult;
            //ViewBag.shirezhiresult = shirezhiresult;
            //ViewBag.xueyuzhiresult = xueyuzhiresult;
            //ViewBag.qiyuzhiresult = qiyuzhiresult;
            //ViewBag.tebingzhiresult = tebingzhiresult;
            //ViewBag.pinghezhiresult = pinghezhiresult;
            string  JsonString = JsonHelper.JsonSerializerBySingleData(tizhiDto);
            Message msg        = CMSService.Insert("Tizhi", JsonString);

            msg = CMSService.UpdateFieldOneByOne("Customer", "CMSCustomer", "CustomerId=" + cid, "CustomerTizhi", Customertizhi);
            ViewBag.CustomerBirthday      = CustomerBirthday;
            ViewBag.CustomerName          = CustomerName;
            ViewBag.CustomerSex           = CustomerSex;
            ViewBag.Customerqinxiangtizhi = Customerqinxiangtizhi;
            ViewBag.Customertizhi         = Customertizhi;
            ViewBag.Danganhao             = Danganhao;
            //ViewBag.userId = cid;
            return(View(tizhiDto));
        }