public bool Login(string username, string password) { LoginDAL _dal = new LoginDAL(); /* * 1.验证用户 * 2.如果成功保存用户信息到session */ center user = _dal.Login(username, password); if (user != null) { SessionHelper.SetSession(SessionHelper.LoginCenter, user); //保存登录的Center var listCenter = new CenterDAL().GetAllCounts(); List <center> listSubCenters = new List <center>(); if (user.org_sign > 0) { listSubCenters.Add(user); } getSubCenterOrgIDsBy(listCenter, listSubCenters, user.id); // 递归得到 下属服务机构 and 推广机构信息 SessionHelper.SetSession(SessionHelper.SubCenters, listSubCenters); //保存子中心 return(true); } else { return(false); } }
private CenterModel BuildModel(center centerModule) { if (centerModule == null) { return(null); } else { CenterModel centermodel = new CenterModel(); centermodel.Id = centerModule.center_id; centermodel.Name = centerModule.name; centermodel.Phone = centerModule.phone; centermodel.Address = centerModule.address; if (centerModule.consultant_id.HasValue) { centermodel.ConsultantId = centerModule.consultant_id.Value; centermodel.ConsultantName = centerModule.consultants.name; } else { centermodel.ConsultantId = 0; centermodel.ConsultantName = ""; } return(centermodel); } }
public void centerTest(int[] input,int output) { center center = new center(); center.cells = input; Assert.AreEqual(center.GetEmpty(),output); }
public CenterModel Add(CenterModel newCenterModel) { try { center cen = new center(); cen.address = newCenterModel.Address; cen.name = newCenterModel.Name; cen.phone = newCenterModel.Phone; if (newCenterModel.ConsultantId != 0) { cen.consultant_id = newCenterModel.ConsultantId; } _unitOfWork.AddAction(cen, DataActions.Add); _unitOfWork.Save(); newCenterModel.Id = cen.center_id; return(newCenterModel); } catch (RepositoryException rex) { string msg = rex.Message; string reason = rex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } catch (Exception ex) { string msg = ex.Message; string reason = ex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } }
public async Task <ActionResult> Edit([Bind(Include = "idcenter,name,location,idpartner_FK,flag,min_family_id,max_family_id,min_person_id,max_person_id")] center center) { ModelState.Remove("flag"); if (ModelState.IsValid) { db.Entry(center).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.idpartner_FK = new SelectList(db.partners, "idpartner", "name", center.idpartner_FK); return(View(center)); }
public TextBox centerText(center mode = center.xy) { if (mode == center.x || mode == center.xy) { xx = x + (w - Game1.font.MeasureString(str).X *text.scale) / 2; } if (mode == center.y || mode == center.xy) { yy = y + (h - Game1.font.MeasureString(str).Y *text.scale) / 2; } return(this); }
// GET: centers/Details/5 public async Task <ActionResult> Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } center center = await db.centers.FindAsync(id); if (center == null) { return(HttpNotFound()); } return(View(center)); }
// GET: centers/Edit/5 public async Task <ActionResult> Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } center center = await db.centers.FindAsync(id); if (center == null) { return(HttpNotFound()); } ViewBag.idpartner_FK = new SelectList(db.partners, "idpartner", "name", center.idpartner_FK); return(View(center)); }
public async Task <ActionResult> Create([Bind(Include = "idcenter,name,location,idpartner_FK,flag,min_family_id,max_family_id,min_person_id,max_person_id")] center center) { if (ModelState.IsValid) { partner p = db.partners.SingleOrDefault(pa => pa.idpartner == center.idpartner_FK); center.idcenter = p.idpartner + center.flag; db.centers.Add(center); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.idpartner_FK = new SelectList(db.partners, "idpartner", "name", center.idpartner_FK); return(View(center)); }
public bool DeleteById(int id) { bool res = true; try { Repository <center> centerDal = _unitOfWork.GetRepository <center>(); center cen = centerDal.GetObjectByKey(id).Entity; if (cen != null) { if (cen.subclassrooms.Count > 0) { throw new FaultException <LCFault>(new LCFault("用户中心失败"), "该中心存在子班级,无法删除"); } else { _unitOfWork.AddAction(cen, DataActions.Delete); _unitOfWork.Save(); } } else { res = false; throw new FaultException <LCFault>(new LCFault("用户中心失败"), "该中心不存在,无法删除"); } } catch (RepositoryException rex) { string msg = rex.Message; string reason = rex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } catch (Exception ex) { string msg = ex.Message; string reason = ex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } return(res); }
public static void Main(){ try{ // Open the text file using a stream reader. using (StreamReader sr = new StreamReader("dc.in")){ String first_line=sr.ReadLine(); center c=new center(first_line); Console.WriteLine(c.ToString()); // Read the stream to a string, and write the string to the console. // String line = sr.ReadToEnd(); // Console.WriteLine(line+" esto es una linea"); for (int i=0;i<c.getN_Unvalid();i++){ c.AddInvalid(sr.ReadLine()); } for(int i=0;i<c.getN_Server();i++){ c.AddServer(sr.ReadLine(),i); } } } catch (Exception e){ Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } }
public CenterModel Update(CenterModel newCenterModel) { try { Repository <center> centerDal = _unitOfWork.GetRepository <center>(); center cen = centerDal.GetObjectByKey(newCenterModel.Id).Entity; if (cen != null) { cen.address = newCenterModel.Address; cen.name = newCenterModel.Name; cen.phone = newCenterModel.Phone; if (newCenterModel.ConsultantId != 0) { cen.consultant_id = newCenterModel.ConsultantId; } } _unitOfWork.AddAction(cen, DataActions.Update); _unitOfWork.Save(); return(newCenterModel); } catch (RepositoryException rex) { string msg = rex.Message; string reason = rex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } catch (Exception ex) { string msg = ex.Message; string reason = ex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } }
bbox = new Bounds(center, size);
/// <summary> /// Creates a foreach-loop compatible IEnumerable which yields all position in a 3D sphere. /// Centered at <paramref name="center"/> with radius <paramref name="radius"/>. Can use floats to get arbitrarily positioned spheres. /// </summary> public EnumerableSphere3D(Int3 center, float radius) => enumerator = new Enumerator(center, radius);
var(center, _) = orbits.First(o => o.Orbiting == from);
quadMeshBuffer[index].UpdateQuad(center, right, up, plane.color, texCoords);
GuardArgsValid(center, radius);
this = Ellipse(center, radiusX, radiusY);
=> new Bounds( center ?? self.center,
DrawArc(new Arc2(center, radius, start, end), in color, lineWidth, rotation, in origin, opacity);
DrawArc(new Arc2(center, radius), color, lineWidth, opacity, segments, layerDepth);
this = RadialGradientBrushProperties(center, gradientOriginOffset, radiusX, radiusY);
/// <summary> /// Creates a foreach-loop compatible IEnumerable which yields all position in a 2D sphere (aka circle but whatever). /// Centered at <paramref name="center"/> with radius <paramref name="radius"/>. Can use floats to get arbitrarily positioned spheres. /// </summary> public EnumerableSphere2D(Float2 center, float radius) => enumerator = new Enumerator(center, radius);
Bound = new AABB2D(center, size / 2f);
sectors.Select(x => (sector: x, distance: GetDistance(center, x))) .Where(x => x.distance < distance)