///<summary></summary> public static void Update(MapArea mapArea){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){ Meth.GetVoid(MethodBase.GetCurrentMethod(),mapArea); return; } Crud.MapAreaCrud.Update(mapArea); }
/* ///<summary>Gets one MapArea from the db.</summary> public static MapArea GetOne(long mapAreaNum){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){ return Meth.GetObject<MapArea>(MethodBase.GetCurrentMethod(),mapAreaNum); } return Crud.MapAreaCrud.SelectOne(mapAreaNum); } */ ///<summary></summary> public static long Insert(MapArea mapArea){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){ mapArea.MapAreaNum=Meth.GetLong(MethodBase.GetCurrentMethod(),mapArea); return mapArea.MapAreaNum; } return Crud.MapAreaCrud.Insert(mapArea); }
public MapAreaDisplayLabelControl(MapArea displayLabel,Font font,Color foreColor,Color backColor,Point location,int pixelsPerFoot,bool allowDragging,bool allowEdit) :this() { displayLabel.ItemType=MapItemType.DisplayLabel; MapAreaItem=displayLabel; Font=font; ForeColor=foreColor; BackColor=backColor; Location=location; Size=GetDrawingSize(this,pixelsPerFoot); AllowDragging=allowDragging; AllowEdit=allowEdit; Name=MapAreaItem.MapAreaNum.ToString(); }
///<summary>Add a display label to the panel.</summary> public void AddDisplayLabel(MapArea displayLabel) { MapAreaDisplayLabelControl label=new MapAreaDisplayLabelControl( displayLabel, this.FontLabel, this.ForeColor, this.FloorColor, //This is effective the BackColor of this panel so set DisplayLabel controls BackColor to match. GetScreenLocation(displayLabel.XPos,displayLabel.YPos,this.PixelsPerFoot), this.PixelsPerFoot, this.AllowDragging, this.AllowEditing); label.DragDone+=mapAreaControl_DragDone; label.MapAreaDisplayLabelChanged+=mapAreaControl_Changed; this.Controls.Add(label); }
///<summary>Add a cubicle to the panel.</summary> public void AddCubicle(MapArea cubicle) { MapAreaRoomControl phone=new MapAreaRoomControl( cubicle, TimeSpan.FromSeconds(Rand.Next(60,1200)).ToString(), "Emp: "+this.Controls.Count.ToString(), this.Controls.Count, cubicle.Extension.ToString(), "Status", this.FontCubicle, this.FontCubicleHeader, Color.FromArgb(40,Color.Red), Color.Red, this.FloorColor, GetScreenLocation(cubicle.XPos,cubicle.YPos,this.PixelsPerFoot), GetScreenSize(cubicle.Width,cubicle.Height,this.PixelsPerFoot), Properties.Resources.phoneInUse, this.AllowDragging, this.AllowEditing); phone.DragDone+=mapAreaControl_DragDone; phone.MapAreaRoomChanged+=mapAreaControl_Changed; this.Controls.Add(phone); }
///<summary>For testing only. Create a random cubicle and add it to the panel.</summary> public MapArea AddRandomCubicle() { MapArea cubicle=new MapArea(); cubicle.MapAreaNum=Rand.Next(1,1000000); cubicle.Description=""; cubicle.Extension=Rand.Next(100,200); cubicle.Width=GetRandomDimension(); cubicle.Height=GetRandomDimension(); cubicle.XPos=GetRandomXPos((int)cubicle.Width); cubicle.YPos=GetRandomYPos((int)cubicle.Height); AddCubicle(cubicle); return cubicle; }
///<summary>Takes all required fields as input. Suggest using this version when adding a cubicle to a ClinicMapPanel.</summary> public MapAreaRoomControl(MapArea cubicle,string elapsed,string employeeName,long employeeNum,string extension,string status,Font font,Font fontHeader,Color innerColor,Color outerColor,Color backColor,Point location,Size size,Image phoneImage,bool allowDragging,bool allowEdit) : this() { cubicle.ItemType=MapItemType.Room; MapAreaItem=cubicle; Elapsed = elapsed; EmployeeName = employeeName; EmployeeNum = employeeNum; Extension = extension; Status = status; Font = font; FontHeader=fontHeader; Location = location; Size=size; InnerColor = innerColor; OuterColor = outerColor; BackColor=backColor; PhoneImage = phoneImage; AllowDragging=allowDragging; AllowEdit=allowEdit; Name=MapAreaItem.MapAreaNum.ToString(); }
private void butBuildFromPhoneTable_Click(object sender,EventArgs e) { if(MessageBox.Show("This action will clear all information from clinicmapitem table and recreated it from current phone table rows. Would you like to continue?","",MessageBoxButtons.YesNo)!=System.Windows.Forms.DialogResult.Yes) { return; } mapAreaPanel.Clear(true); List<Phone> phones=Phones.GetPhoneList(); int defaultSizeFeet=6; int row=1; int column=0; for(int i=0;i<78;i++) { if(row>=7) { if(++column>8) { column=3; row++; } } else { if(++column>10) { column=1; row++; } if(row==7) { column=3; //row=8; } } //Phone phone=phones[i]; MapArea clinicMapItem=new MapArea(); clinicMapItem.Description=""; clinicMapItem.Extension=i; //phone.Extension; clinicMapItem.Width=defaultSizeFeet; clinicMapItem.Height=defaultSizeFeet; clinicMapItem.XPos=(1*column)+((column-1)*defaultSizeFeet); clinicMapItem.YPos=1+((row-1)*defaultSizeFeet); mapAreaPanel.AddCubicle(clinicMapItem); MapAreas.Insert(clinicMapItem); } }