public ActionResult Daizhen(int?p)
        {
            Pager pager = new Pager();

            pager.table      = "CMSCustomer";
            pager.strwhere   = "1=1";
            pager.PageSize   = 10;
            pager.PageNo     = p ?? 1;
            pager.FieldKey   = "CustomerId";
            pager.FiledOrder = "CustomerId Desc";
            pager.strwhere   = pager.strwhere + " and CustomerTizhi='0'";


            pager = CMSService.SelectAll("Customer", pager);
            List <CustomerDto> list = new List <CustomerDto>();

            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                CustomerDto dto = CustomerMapping.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;


            return(View(pager.Entity));
        }
Exemple #2
0
        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 Search()
        {
            string             CustomerName = Request.Form["CustomerName"].ToString();
            DataTable          dt           = CMSService.SelectSome("Customer", "CMSCustomer", "CustomerName='" + CustomerName + "'");
            List <CustomerDto> list         = new List <CustomerDto>();

            foreach (DataRow dr in dt.Rows)
            {
                CustomerDto dto = CustomerMapping.getDTO(dr);
                list.Add(dto);
            }
            ViewData["Category"] = MyService.GetCategoryList("CategoryParentId=20");
            return(View(list));
        }
        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));
        }
        //
        // GET: /Customer/
        public ActionResult Index(int?p, string category, string guidang)
        {
            string Category = category ?? "全部";
            string Guidang  = guidang ?? "0";
            Pager  pager    = new Pager();

            pager.table      = "CMSCustomer";
            pager.strwhere   = "1=1";
            pager.PageSize   = 10;
            pager.PageNo     = p ?? 1;
            pager.FieldKey   = "CustomerId";
            pager.FiledOrder = "CustomerId Desc";

            if (Category != "全部")
            {
                pager.strwhere = pager.strwhere + " and charindex('" + Category + "',CustomerTizhi)>0";
            }
            if (Guidang != "0")
            {
                pager.strwhere = pager.strwhere + " and charindex('" + Guidang + "',CustomerGuidang)>0";
            }
            pager = CMSService.SelectAll("Customer", pager);
            List <CustomerDto> list = new List <CustomerDto>();

            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                CustomerDto dto = CustomerMapping.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;
            ViewData["Category"] = MyService.GetCategoryList("CategoryParentId=20");
            ViewData["Guidang"]  = MyService.GetCategoryList("CategoryParentId=30");

            return(View(pager.Entity));
        }
        public ActionResult Edit(int id)
        {
            CustomerEditViewModel model = new CustomerEditViewModel();
            DataTable             dt    = CMSService.SelectSome("Customer", "CMSCustomer", "CustomerId=" + id);

            foreach (DataRow dr in dt.Rows)
            {
                CustomerDto dto = CustomerMapping.getDTO(dr);
                model.CustomerName         = dto.CustomerName;
                model.CustomerNumber       = dto.CustomerNumber;
                model.CustomerBirthday     = dto.CustomerBirthday.ToShortDateString();
                model.CustomerSex          = dto.CustomerSex;
                model.CustomerId           = dto.CustomerId;
                model.CustomerTelephone    = dto.CustomerTelephone;
                model.CustomerEmail        = dto.CustomerEmail;
                model.CustomerMinzu        = dto.CustomerMinzu;
                model.CustomerChangzhu     = dto.CustomerChangzhu;
                model.CustomerWenhua       = dto.CustomerWenhua;
                model.CustomerHunyin       = dto.CustomerHunyin;
                model.CustomerZhiye        = dto.CustomerZhiye;
                model.CustomerAddress      = dto.CustomerAddress;
                model.CustomerHujiAddress  = dto.CustomerHujiAddress;
                model.CustomerXiangzhen    = dto.CustomerXiangzhen;
                model.CustomerJuweihui     = dto.CustomerJuweihui;
                model.CustomerLianxiren    = dto.CustomerLianxiren;
                model.CustomerLianxirenTel = dto.CustomerLianxirenTel;
                model.CustomerBeizhu       = dto.CustomerBeizhu;
                model.CustomerYongyao      = dto.CustomerYongyao;
                model.CustomerShequ        = dto.CustomerShequ;
                model.CustomerDoctor       = dto.CustomerDoctor;
            }
            ViewData["CChangzhu"] = CustomerService.GetChangzhuSelectList();
            ViewData["CHunyin"]   = CustomerService.GetHunyinSelectList();
            ViewData["CMinzu"]    = CustomerService.GetMinzuSelectList();
            ViewData["CZhiye"]    = CustomerService.GetZhiyeSelectList();
            ViewData["CWenhua"]   = CustomerService.GetWenhuaSelectList();
            ViewData["Category"]  = MyService.GetCategorySelectList("CategoryParentId=36");
            ViewData["Doctor"]    = MyService.GetUserSelectList("charindex('47',UserRoles)>0");
            return(View(model));
        }
        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));
        }
        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));
        }