public static CustomerDto getDTO(DataRow dr) { CustomerDto CustomerDto = new CustomerDto(); CustomerDto.CustomerId = int.Parse(dr["CustomerId"].ToString()); CustomerDto.CustomerName = dr["CustomerName"].ToString(); CustomerDto.CustomerNumber = dr["CustomerNumber"].ToString(); CustomerDto.CustomerSex = dr["CustomerSex"].ToString(); CustomerDto.CustomerBirthday = DateTime.Parse(dr["CustomerBirthday"].ToString()); CustomerDto.CustomerTelephone = dr["CustomerTelephone"].ToString(); CustomerDto.CustomerEmail = dr["CustomerEmail"].ToString(); CustomerDto.CustomerMinzu = dr["CustomerMinzu"].ToString(); CustomerDto.CustomerHunyin = dr["CustomerHunyin"].ToString(); CustomerDto.CustomerChangzhu = dr["CustomerChangzhu"].ToString(); CustomerDto.CustomerWenhua = dr["CustomerWenhua"].ToString(); CustomerDto.CustomerZhiye = dr["CustomerZhiye"].ToString(); CustomerDto.CustomerAddress = dr["CustomerAddress"].ToString(); CustomerDto.CustomerHujiAddress = dr["CustomerHujiAddress"].ToString(); CustomerDto.CustomerLianxiren = dr["CustomerLianxiren"].ToString(); CustomerDto.CustomerLianxirenTel = dr["CustomerLianxirenTel"].ToString(); CustomerDto.CustomerJuweihui = dr["CustomerJuweihui"].ToString(); CustomerDto.CustomerXiangzhen = dr["CustomerXiangzhen"].ToString(); CustomerDto.CustomerDanwei = dr["CustomerDanwei"].ToString(); CustomerDto.CustomerYongyao = dr["CustomerYongyao"].ToString(); CustomerDto.CustomerBeizhu = dr["CustomerBeizhu"].ToString(); CustomerDto.CustomerGuidang = dr["CustomerGuidang"].ToString(); CustomerDto.CustomerDoctor = dr["CustomerDoctor"].ToString(); CustomerDto.CustomerShequ = dr["CustomerShequ"].ToString(); return CustomerDto; }
public ActionResult Create(CustomerAddViewModel model) { try { CustomerDto dto = new CustomerDto(); dto.CustomerName = model.CustomerName; dto.CustomerNumber = model.CustomerNumber; dto.CustomerSex = CommonTools.GetSexByVerify(model.CustomerNumber); dto.CustomerBirthday = DateTime.Parse(CommonTools.GetBirthdyByVerify(model.CustomerNumber)); string JsonString = JsonHelper.JsonSerializerBySingleData(dto); Message msg = CMSService.Insert("Customer", JsonString); return RedirectTo("/Customer/Index?category=全部&guidang=0", msg.MessageInfo); } catch { Message msg = new Message(); msg.MessageStatus = "Error"; msg.MessageInfo = "操作出错了"; ViewBag.Status = msg.MessageStatus; ViewBag.msg = msg.MessageInfo; return View(); } }
public static string CustomerIdToName(string strWhere) { CustomerDto dto =new CustomerDto(); DataTable dt=CMSService.SelectOne("Customer","CMSCustomer",strWhere); foreach (DataRow dr in dt.Rows) { dto = CustomerMapping.getDTO(dr); } return dto.CustomerName; }
public ActionResult Guidang(int id) { CustomerGuidangViewModel model = new CustomerGuidangViewModel(); DataTable dt = CMSService.SelectOne("Customer", "CMSCustomer", "CustomerId=" + id); foreach (DataRow dr in dt.Rows) { CustomerDto dto = new CustomerDto(); dto = CustomerMapping.getDTO(dr); model.CustomerId = dto.CustomerId; model.CustomerName = dto.CustomerName; model.CustomerGuidang = dto.CustomerGuidang; } ViewData["ListGuidang"] = MyService.GetCategoryList("CategoryParentId=30"); return View(model); }
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); }
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); }