public dynamic Login() { string name = Fun.Query("name"); string password = Fun.Query("password"); LoginBLL bll = new LoginBLL(); S_UserInfo user = bll.Login(name, password); if (user == null) { return("失败"); } UserInfo u = new UserInfo(); u.id = user.user_id; u.name = user.user_name.Trim(); ManagerBLL m = new ManagerBLL(); S_ManagerInfo manager = m.GetManagerByLoginId(user.user_id); if (manager != null) { return(new { data = u, manager = manager }); } else { CustomerBLL c = new CustomerBLL(); C_CustomerInfo customer = c.GetCustomerByLoginId(user.user_id); return(new { data = u, customer = customer }); } }
public dynamic GetCustomer() { int id = Fun.Query("id", 0); CustomerBLL bll = new CustomerBLL(); C_CustomerInfo c = bll.GetCustomer(id); CustomerInfo customer = new CustomerInfo(); customer.id = c.cu_id; customer.name = c.cu_name.Trim(); customer.headimgurl = c.cu_headimgurl; customer.phone = c.cu_phone; customer.addr = c.cu_addr; customer.sex = c.cu_sex == 1 ? "男" : c.cu_sex == 0 ? "女" : "未知"; customer.birthday = c.cu_birthday.ToString("yyyy-MM-dd"); customer.bdtype = c.cu_bd_type == 1 ? "阳历" : "阴历"; customer.memo = c.cu_memo; customer.level = c.cu_level; customer.credit = c.cu_credit; customer.markDay = String.IsNullOrEmpty(c.cu_mark_day) ? "" : c.cu_mark_day; customer.state = c.cu_state; switch (customer.state) { case 0: customer.stateDescribe = "潜在"; break; case 1: customer.stateDescribe = "正常"; break; case 2: customer.stateDescribe = "预警"; break; case -1: customer.stateDescribe = "流失"; break; } customer.managerName = new ManagerBLL().GetManager(c.cu_manager_id).mgr_name.Trim(); customer.source = c.cu_source; customer.sourceDescribe = bll.GetSource(c.cu_source).source_name.Trim(); return(customer); }
public dynamic AddCustomerCubilose() { int customerId = Fun.Form("customerId", 0); int tradeId = Fun.Form("tradeId", 0); string cubilose = Fun.Form("cubilose"); string num = Fun.Form("num"); string[] cubiloseId = cubilose.Split('|'); string[] totalNum = num.Split('|'); CustomerBLL bll = new CustomerBLL(); if (bll.AddCustomerCubilose(customerId, cubiloseId, totalNum, tradeId)) //添加客户物品 { if (new TradeBLL().UpdateTradeStatus(tradeId, 1)) //修改订单状态 { CustomerBLL c = new CustomerBLL(); C_CustomerInfo customer = c.GetCustomer(customerId); if (customer.cu_state == 1)//如果是正常客户,不做操作 { return("成功"); } else if (customer.cu_state == 0)//潜在客户,更改为正常客户,设置当日为第一次成为正式客户纪念日 { return(c.UpdateCustomerState(customerId, 1, DateTime.Now.ToString("yyyy-MM-dd")) ? "成功" : "失败"); } else//预警&流失客户恢复正常 { return(c.UpdateCustomerState(customerId, 1, "") ? "成功" : "失败");//纪念日穿空值,不做修改 } } else { return("失败"); } } else { return("失败"); } }