public ActionResult Index() { string orderLevel = "0"; string taskLevel = "0"; if (Session["ClientManager"] == null) { return(Redirect("/Home/Login")); } else { var currentUser = (IntFactoryEntity.Users)Session["ClientManager"]; if (currentUser.Client.GuideStep != 0) { return(Redirect("/Default/Index")); } var client = ClientBusiness.GetClientDetail(currentUser.ClientID); ViewBag.RemainDay = Math.Ceiling((client.EndTime - DateTime.Now).TotalDays); ViewBag.RemainDate = client.EndTime.Date.ToString("yyyy-MM-dd"); ViewBag.BuyPeople = client.UserQuantity; ViewBag.UsePeople = OrganizationBusiness.GetUsers(client.ClientID).FindAll(m => m.Status != 9).Count; if (currentUser.Role != null) { //所有订单 if (ExpandClass.IsExistMenu("102010300")) { orderLevel = "-1"; } else if (ExpandClass.IsExistMenu("102010601") || ExpandClass.IsExistMenu("102010701") || ExpandClass.IsExistMenu("102010801")) { orderLevel = "-1"; } else if (ExpandClass.IsExistMenu("102010600") || ExpandClass.IsExistMenu("102010700") || ExpandClass.IsExistMenu("102010800")) { orderLevel = "1"; } //所有任务 if (ExpandClass.IsExistMenu("109010200")) { taskLevel = "-1"; } else { taskLevel = "1"; } } ViewBag.OrderMarks = SystemBusiness.BaseBusiness.GetLableColor(currentUser.ClientID, EnumMarkType.Orders); ViewBag.TaskMarks = SystemBusiness.BaseBusiness.GetLableColor(currentUser.ClientID, EnumMarkType.Tasks); ViewBag.UserID = currentUser.UserID; ViewBag.orderLevel = orderLevel; ViewBag.taskLevel = taskLevel; } return(View()); }
public ActionResult UseExpired() { if (Session["ClientManager"] != null) { var currentUser = (IntFactoryEntity.Users)Session["ClientManager"]; var client = ClientBusiness.GetClientDetail(currentUser.ClientID); ViewBag.EndTime = client.EndTime.ToString("yyyy-MM-dd"); } return(View()); }
public JsonResult GetClientDetail(string id) { var item = ClientBusiness.GetClientDetail(id); JsonDictionary.Add("Item", item); JsonDictionary.Add("Result", 1); return(new JsonResult() { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult OrderDetail(string id) { var model = OrdersBusiness.BaseBusiness.GetOrderByID(id, CurrentUser.ClientID); if (model == null || string.IsNullOrEmpty(model.OrderID)) { return(Redirect("/Orders/Orders")); } if (model.OrderType == 2) { model.OrderAttrs = OrdersBusiness.BaseBusiness.GetOrderArrrsByOrderID(model.OriginalID); } model.IsSelf = model.ClientID == CurrentUser.ClientID; if (model.IsSelf && !string.IsNullOrEmpty(model.EntrustClientID)) { ViewBag.Client = ClientBusiness.GetClientDetail(model.EntrustClientID); } else if (!model.IsSelf) { ViewBag.Client = ClientBusiness.GetClientDetail(model.ClientID); } ViewBag.Model = model; ProcessCategoryEntity item = SystemBusiness.BaseBusiness.GetProcessCategoryByID(model.BigCategoryID); ViewBag.Tabs = item.CategoryItems.Where(m => m.Type == 1 && m.OrderType == model.OrderType).ToList(); ViewBag.Modules = item.CategoryItems.Where(m => m.Type == 3).ToList(); ViewBag.list = SystemBusiness.BaseBusiness.GetLableColor(CurrentUser.ClientID, EnumMarkType.Orders).ToList(); if (model.IsSelf && string.IsNullOrEmpty(model.EntrustClientID)) { ViewBag.IsDoClient = true; } else if (!model.IsSelf && !string.IsNullOrEmpty(model.EntrustClientID)) { ViewBag.IsDoClient = true; } else { ViewBag.IsDoClient = false; } if (model.OrderType == 1) { return(View()); } else { return(View("OrderDetailDH")); } }
public JsonResult GetAgentKey() { var client = ClientBusiness.GetClientDetail(CurrentUser.ClientID); string key = string.Empty; JsonDictionary.Add("Key", key); return(new JsonResult() { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult GetClientDetail() { var client = ClientBusiness.GetClientDetail(CurrentUser.ClientID); JsonDictionary.Add("Client", client); JsonDictionary.Add("Days", Math.Ceiling((client.EndTime - DateTime.Now).TotalDays)); return(new JsonResult() { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
/// <summary> /// 获取客户详情 /// </summary> public JsonResult GetClientDetail() { var client = ClientBusiness.GetClientDetail(CurrentUser.ClientID); var agent = AgentsBusiness.GetAgentDetail(CurrentUser.AgentID); JsonDictionary.Add("Client", client); JsonDictionary.Add("Agent", agent); JsonDictionary.Add("Days", (agent.EndTime - DateTime.Now).Days); return(new JsonResult() { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
//绑定阿里账户 public int BindAliMember(Users model) { int result = 0; if (Session["AliTokenInfo"] != null) { var client = ClientBusiness.GetClientDetail(model.ClientID); if (string.IsNullOrEmpty(client.AliMemberID)) { string tokenInfo = Session["AliTokenInfo"].ToString(); string[] tokenArr = tokenInfo.Split('|'); if (tokenArr.Length == 3) { string access_token = tokenArr[0]; string refresh_token = tokenArr[1]; string memberId = tokenArr[2]; bool flag = AliOrderBusiness.BaseBusiness.AddAliOrderDownloadPlan(model.UserID, memberId, access_token, refresh_token, model.ClientID); if (flag) { flag = OrganizationBusiness.BindOtherAccount(EnumAccountType.Ali, model.UserID, memberId, model.ClientID); if (flag) { Session["ClientManager"] = model; Session.Remove("AliTokenInfo"); result = 1; } } else { AliOrderBusiness.BaseBusiness.DeleteAliOrderDownloadPlan(model.ClientID); } } } else { result = 4; } } else { result = 5; } return(result); }
public JsonResult SaveClient(string entity) { JavaScriptSerializer serializer = new JavaScriptSerializer(); Clients model = serializer.Deserialize <Clients>(entity); model.ClientID = CurrentUser.ClientID; bool flag = ClientBusiness.UpdateClient(model, CurrentUser.UserID); JsonDictionary.Add("Result", flag ? 1 : 0); if (flag) { CurrentUser.Client = ClientBusiness.GetClientDetail(CurrentUser.ClientID); Session["ClientManager"] = CurrentUser; } return(new JsonResult() { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult GetAuthorizeInfo() { Dictionary <string, object> JsonDictionary = new Dictionary <string, object>(); double remainderDays = 0; int authorizeType = 0; string clientCode = string.Empty; if (Session["ClientManager"] != null) { var CurrentUser = (IntFactoryEntity.Users)Session["ClientManager"]; var client = ClientBusiness.GetClientDetail(CurrentUser.ClientID); remainderDays = Math.Ceiling((client.EndTime - DateTime.Now).TotalDays); authorizeType = client.AuthorizeType; } JsonDictionary.Add("remainderDays", remainderDays); JsonDictionary.Add("authorizeType", authorizeType); return(new JsonResult() { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
//获取客户端信息 public ActionResult GetClientInfo(string clientID) { var item = ClientBusiness.GetClientDetail(clientID); Dictionary <string, object> obj = new Dictionary <string, object>(); if (item != null && !string.IsNullOrEmpty(item.ClientID)) { obj.Add("clientID", item.ClientID); obj.Add("clientCode", item.ClientCode); obj.Add("companyName", item.CompanyName); obj.Add("logo", item.Logo); obj.Add("cityCode", item.CityCode); obj.Add("contactName", item.ContactName); obj.Add("mobilePhone", item.MobilePhone); obj.Add("address", item.Address); } JsonDictionary.Add("client", obj); return(new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult ClientAuthorize(string id) { if (string.IsNullOrEmpty(id)) { RedirectToAction("Index", "Client"); } else { var client = ClientBusiness.GetClientDetail(id); if (client != null) { ViewBag.ClientID = id; ViewBag.ClientName = client.CompanyName; ViewBag.UserQuantity = client.UserQuantity; ViewBag.EndTime = client.EndTime != null?client.EndTime:DateTime.Now; ViewBag.AuthorizeType = client.AuthorizeType; } else { RedirectToAction("Index", "Client"); } } return(View()); }
/// <summary> /// 升级客户服务 /// </summary> /// <param name="client"></param> public JsonResult SaveClientAuthorize(string clientID, int serviceType, int giveType, int userQuantity, string endTime, int buyType, int buyUserQuantity, int buyUserYears) { bool flag = false; var client = ClientBusiness.GetClientDetail(clientID); ClientAuthorizeLog log = new ClientAuthorizeLog(); log.CreateUserID = CurrentUser.UserID; log.ClientID = clientID; log.OrderID = string.Empty; if (serviceType == 1) //赠送 { if (giveType == 1) //赠送人数 { flag = ClientBusiness.AddClientUserQuantity(client.ClientID, userQuantity); log.BeginTime = client.EndTime; log.EndTime = client.EndTime; log.UserQuantity = userQuantity; log.Type = 2; } else//赠送时间 { log.BeginTime = client.EndTime; flag = ClientBusiness.SetClientEndTime(client.ClientID, DateTime.Parse(endTime)); log.EndTime = DateTime.Parse(endTime); log.UserQuantity = client.UserQuantity; log.Type = 3; } ClientBusiness.UpdateClientCache(client.ClientID); ClientBusiness.InsertClientAuthorizeLog(log); ClearClientCache(client.ClientID); } else//购买生成订单 { log.Type = buyType; int remainderMonths = 0;//剩余月份 int years = 1; if (buyType == 2)//购买人数 { remainderMonths = (client.EndTime.Year - DateTime.Now.Year) * 12 + (client.EndTime.Month - DateTime.Now.Month) - 1; if (client.EndTime.Day >= DateTime.Now.Day) { remainderMonths += 1; } years = remainderMonths / 12 == 0 ? 1 : remainderMonths / 12; log.BeginTime = client.EndTime; log.EndTime = client.EndTime; log.UserQuantity = userQuantity; } else { years = buyUserYears; log.BeginTime = client.EndTime; log.EndTime = client.EndTime.AddYears(years); log.UserQuantity = client.UserQuantity; } int pageCount = 0; int totalCount = 0; List <ModulesProduct> list = ModulesProductBusiness.GetModulesProducts(string.Empty, int.MaxValue, 1, ref totalCount, ref pageCount); //获取订单产品的最佳组合 var way = ModulesProductBusiness.GetBestWay(buyUserQuantity, list.OrderByDescending(m => m.UserQuantity).Where(m => m.PeriodQuantity == years).ToList()); //获取订单参数 ClientOrder model = new ClientOrder(); model.UserQuantity = way.TotalQuantity; model.Type = buyType; model.Years = years; model.Amount = way.TotalMoney; model.RealAmount = way.TotalMoney; model.SourceType = 1; //购买人数 float remainderYears = 1; if (buyType == 2) { remainderYears = (float)remainderMonths / (12 * years); model.Amount = decimal.Parse((float.Parse(model.Amount.ToString()) * remainderYears).ToString("f2")); model.RealAmount = model.Amount; } model.ClientID = client.ClientID; model.CreateUserID = CurrentUser.UserID; model.Details = new List <ClientOrderDetail>(); foreach (var p in way.Products) { ClientOrderDetail detail = new ClientOrderDetail(); detail.ProductID = p.Key; detail.Qunatity = p.Value; detail.CreateUserID = CurrentUser.CreateUserID; detail.Price = list.Find(m => m.ProductID == p.Key).Price; //购买人数 if (buyType == 2) { detail.Price = decimal.Parse((float.Parse(detail.Price.ToString()) * remainderYears).ToString("f2")); } model.Details.Add(detail); } string orderID = ClientOrderBusiness.AddClientOrder(model); log.OrderID = orderID; flag = string.IsNullOrEmpty(orderID) ? false : true; } JsonDictionary.Add("Result", flag ? 1 : 0); return(new JsonResult() { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public override void OnAuthorization(AuthorizationContext filterContext) { base.OnAuthorization(filterContext); if (filterContext.HttpContext.Response.StatusCode == 401) { string source = HttpContext.Current.Request.QueryString["source"]; if (!string.IsNullOrEmpty(source) && source == "md") { filterContext.Result = new RedirectResult("/Home/MDLogin?ReturnUrl=" + HttpContext.Current.Request.Url); } else { filterContext.Result = new RedirectResult("/Home/Login?ReturnUrl=" + HttpContext.Current.Request.Url); } return; } var controller = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName.ToLower(); var action = filterContext.ActionDescriptor.ActionName.ToLower(); var currentUser = (IntFactoryEntity.Users)filterContext.HttpContext.Session["ClientManager"]; if (currentUser.Client.GuideStep != 0) { if (controller != "default") { filterContext.Result = new RedirectResult("/Default/Index"); } return; } var client = ClientBusiness.GetClientDetail(currentUser.ClientID); if (client.EndTime < DateTime.Now) { if (filterContext.RequestContext.HttpContext.Request.IsAjaxRequest()) { Dictionary <string, string> result = new Dictionary <string, string>(); result.Add("result", "10001"); filterContext.Result = new JsonResult() { Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } else { filterContext.Result = new RedirectResult("/Home/UseExpired"); } return; } var menu = CommonBusiness.ClientMenus.Where(m => m.Controller.ToLower() == controller && m.View.ToLower() == action).FirstOrDefault(); //需要判断权限 if (menu != null && menu.IsLimit == 1) { if (currentUser.Menus.Where(m => m.MenuCode == menu.MenuCode).Count() <= 0) { if (filterContext.RequestContext.HttpContext.Request.IsAjaxRequest()) { Dictionary <string, string> result = new Dictionary <string, string>(); result.Add("result", "10001"); filterContext.Result = new JsonResult() { Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } else { var urlRequest = filterContext.RequestContext.HttpContext.Request; throw new HttpException(403, urlRequest.UrlReferrer != null ? urlRequest.UrlReferrer.AbsoluteUri : urlRequest.Url.AbsoluteUri); } } } }