// GET: PSI public ActionResult Index(string userId) { if (userId.Equals(null)) { return(View("_NoFunction")); } // UserRoleAd.GetDataByCode(); marketSalesApp salesApp = new marketSalesApp(); var userInfo = salesApp.getUserInfoBySalesNo(userId); if (userInfo == null) { return(View("_NoFunction")); } userId = userInfo.id; var empEntitys = salesApp.getEmpOrgBySalesNo(userInfo.SalesNo); List <string> rolues = new List <string>(); foreach (var empEnt in empEntitys) { if (!rolues.Exists(p => p.Equals(empEnt.JOB_CODE)) && (empEnt.JOB_CODE.Equals("BUManager") || empEnt.JOB_CODE.Equals("Citymanager"))) { rolues.Add(empEnt.JOB_CODE); } } int type = 1; //判断用户角色 if (rolues.Count <= 0) { return(View("_NoFunction")); } else { if (rolues.Exists(p => p.Equals("BUManager")) && rolues.Exists(p => p.Equals("Citymanager")))//表示是多角色需要进入多角色选择画面 { ViewData["userInfo"] = new userInfo() { userId = userInfo.id, salesCode = userInfo.SalesNo }; return(View("_SelectRoue")); } else if (rolues.Exists(p => p.Equals("BUManager")))//进入战区长功能 { type = 1; } else//进入城市经理功能 { type = 2; } } PModel model = new PModel(); model.Month = new List <KeyValueModel>(); DateTime now = DateTime.Now; model.Month.Add(new KeyValueModel() { key = now.AddMonths(-2).ToString("yyyyMM"), keyValue = now.AddMonths(-2).ToString("yyyy年MM月"), isSelected = false }); model.Month.Add(new KeyValueModel() { key = now.AddMonths(-1).ToString("yyyyMM"), keyValue = now.AddMonths(-1).ToString("yyyy年MM月"), isSelected = false }); model.Month.Add(new KeyValueModel() { key = now.ToString("yyyyMM"), keyValue = now.ToString("yyyy年MM月"), isSelected = true }); model.Month.Add(new KeyValueModel() { key = now.AddMonths(1).ToString("yyyyMM"), keyValue = now.AddMonths(1).ToString("yyyy年MM月"), isSelected = false }); model.Month.Add(new KeyValueModel() { key = now.AddMonths(2).ToString("yyyyMM"), keyValue = now.AddMonths(2).ToString("yyyy年MM月"), isSelected = false }); model.Brand = new List <KeyValueModel>(); JS5_S12_BRAND_INFOTableAdapter ad = new JS5_S12_BRAND_INFOTableAdapter(); var ents = ad.GetDataBy(); foreach (var ent in ents) { model.Brand.Add(new KeyValueModel() { key = ent.BRAND_CODE, keyValue = ent.BRAND_NAME, isSelected = false }); } model.Brand.First().isSelected = true; model.Prodect = new List <KeyValueModel>(); var ad2 = new JS5_S12_PRODUCT_TYPE_INFOTableAdapter(); var ents2 = ad2.GetDataBy(); foreach (var ent in ents2) { model.Prodect.Add(new KeyValueModel() { key = ent.ID, keyValue = ent.TREE_NODE_NAME, isSelected = false }); } model.Prodect.First().isSelected = true; model.UserId = userId; model.type = type; model.salesCode = userInfo.SalesNo; if (type == 1) { model.OrgList = new List <KeyValueModel>(); var orglist = salesApp.getEmpOrgBySalesNo(userInfo.SalesNo, "BUManager"); foreach (var org in orglist) { var orginfo = salesApp.getOrgInfo(org.ORG_ID); model.OrgList.Add(new KeyValueModel() { key = orginfo.id, keyValue = orginfo.MANAGE_ORG_NAME }); } model.OrgList.First().isSelected = true; ViewData["VModel"] = getdata(model.Brand.First().key, model.Prodect.First().key, now.ToString("yyyyMM"), userId, type, userInfo.SalesNo, model.OrgList.First().key); } else if (type == 2) { model.CityList = new List <KeyValueModel>(); var orglist = salesApp.getEmpOrgBySalesNo(userInfo.SalesNo, "Citymanager"); foreach (var org in orglist) { var orginfo = salesApp.getOrgInfo(org.ORG_ID); model.CityList.Add(new KeyValueModel() { key = orginfo.id, keyValue = orginfo.MANAGE_ORG_NAME }); } model.CityList.First().isSelected = true; ViewData["VModel"] = getdata(model.Brand.First().key, model.Prodect.First().key, now.ToString("yyyyMM"), userId, type, userInfo.SalesNo, model.CityList.First().key); } ViewData["PModel"] = model; //ViewData["ValueModel"] = model; return(View("PSIView")); }
public ActionResult Index2(string userId, string type, string SalesNo) { int typeValue = int.Parse(type); PModel model = new PModel(); model.Month = new List <KeyValueModel>(); DateTime now = DateTime.Now; model.Month.Add(new KeyValueModel() { key = now.AddMonths(-2).ToString("yyyyMM"), keyValue = now.AddMonths(-2).ToString("yyyy年MM月"), isSelected = false }); model.Month.Add(new KeyValueModel() { key = now.AddMonths(-1).ToString("yyyyMM"), keyValue = now.AddMonths(-1).ToString("yyyy年MM月"), isSelected = false }); model.Month.Add(new KeyValueModel() { key = now.ToString("yyyyMM"), keyValue = now.ToString("yyyy年MM月"), isSelected = true }); model.Month.Add(new KeyValueModel() { key = now.AddMonths(1).ToString("yyyyMM"), keyValue = now.AddMonths(1).ToString("yyyy年MM月"), isSelected = false }); model.Month.Add(new KeyValueModel() { key = now.AddMonths(2).ToString("yyyyMM"), keyValue = now.AddMonths(2).ToString("yyyy年MM月"), isSelected = false }); model.Brand = new List <KeyValueModel>(); JS5_S12_BRAND_INFOTableAdapter ad = new JS5_S12_BRAND_INFOTableAdapter(); var ents = ad.GetDataBy(); foreach (var ent in ents) { model.Brand.Add(new KeyValueModel() { key = ent.BRAND_CODE, keyValue = ent.BRAND_NAME, isSelected = false }); } model.Brand.First().isSelected = true; model.Prodect = new List <KeyValueModel>(); var ad2 = new JS5_S12_PRODUCT_TYPE_INFOTableAdapter(); var ents2 = ad2.GetDataBy(); foreach (var ent in ents2) { model.Prodect.Add(new KeyValueModel() { key = ent.ID, keyValue = ent.TREE_NODE_NAME, isSelected = false }); } model.Prodect.First().isSelected = true; marketSalesApp salesApp = new marketSalesApp(); model.UserId = userId; model.type = typeValue; model.salesCode = SalesNo; if (typeValue == 1) { model.OrgList = new List <KeyValueModel>(); var orglist = salesApp.getEmpOrgBySalesNo(SalesNo, "BUManager"); foreach (var org in orglist) { var orginfo = salesApp.getOrgInfo(org.ORG_ID); model.OrgList.Add(new KeyValueModel() { key = orginfo.id, keyValue = orginfo.MANAGE_ORG_NAME }); } model.OrgList.First().isSelected = true; ViewData["VModel"] = getdata(model.Brand.First().key, model.Prodect.First().key, now.ToString("yyyyMM"), userId, typeValue, SalesNo, model.OrgList.First().key); } else if (typeValue == 2) { model.CityList = new List <KeyValueModel>(); var orglist = salesApp.getEmpOrgBySalesNo(SalesNo, "Citymanager"); foreach (var org in orglist) { var orginfo = salesApp.getOrgInfo(org.ORG_ID); model.CityList.Add(new KeyValueModel() { key = orginfo.id, keyValue = orginfo.MANAGE_ORG_NAME }); } model.CityList.First().isSelected = true; ViewData["VModel"] = getdata(model.Brand.First().key, model.Prodect.First().key, now.ToString("yyyyMM"), userId, typeValue, SalesNo, model.CityList.First().key); } ViewData["PModel"] = model; //ViewData["ValueModel"] = model; return(View("PSIView")); }