Ejemplo n.º 1
0
		/*
		///<summary>This will never happen</summary>
		public void Update(){
			string command= "UPDATE sigelement SET " 
				+"FromUser = '******'"
				+",ITypes = '"     +POut.PInt   ((int)ITypes)+"'"
				+",DateViewing = '"+POut.PDate  (DateViewing)+"'"
				+",SigType = '"    +POut.PInt   ((int)SigType)+"'"
				+" WHERE SigElementNum = '"+POut.PInt(SigElementNum)+"'";
			DataConnection dcon=new DataConnection();
 			Db.NonQ(command);
		}*/

		///<summary></summary>
		public static long Insert(SigElement se) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				se.SigElementNum=Meth.GetLong(MethodBase.GetCurrentMethod(),se);
				return se.SigElementNum;
			}
			return Crud.SigElementCrud.Insert(se);
		}
Ejemplo n.º 2
0
		///<summary></summary>
		public SigElement Copy(){
			SigElement s=new SigElement();
			s.SigElementNum=SigElementNum;
			s.SigElementDefNum=SigElementDefNum;
			s.SignalNum=SignalNum;
			return s;
		}
Ejemplo n.º 3
0
        /*
         * ///<summary>IComparable.CompareTo implementation.  This is used to order sigelements by type so that the sounds are fired in the correct sequence.</summary>
         * public int CompareTo(object obj) {
         *      return 0;
         *      if(!(obj is SigElement)) {
         *              throw new ArgumentException("object is not a SigElement");
         *      }
         *      SigElement element=(SigElement)obj;
         *      int type1=(int)(SigElementDefs.GetElement(SigElementDefNum).SigElementType);//0,1,or 2
         *      int type2=(int)(SigElementDefs.GetElement(element.SigElementDefNum).SigElementType);
         *      return type1.CompareTo(type2);
         * }*/

        ///<summary></summary>
        public SigElement Copy()
        {
            SigElement s = new SigElement();

            s.SigElementNum    = SigElementNum;
            s.SigElementDefNum = SigElementDefNum;
            s.SignalNum        = SignalNum;
            return(s);
        }
Ejemplo n.º 4
0
        /*
         * ///<summary>This will never happen</summary>
         * public void Update(){
         *      string command= "UPDATE sigelement SET "
         +"FromUser = '******'"
         +",ITypes = '"     +POut.PInt   ((int)ITypes)+"'"
         +",DateViewing = '"+POut.PDate  (DateViewing)+"'"
         +",SigType = '"    +POut.PInt   ((int)SigType)+"'"
         +" WHERE SigElementNum = '"+POut.PInt(SigElementNum)+"'";
         *      DataConnection dcon=new DataConnection();
         *      Db.NonQ(command);
         * }*/

        ///<summary></summary>
        public static long Insert(SigElement se)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                se.SigElementNum = Meth.GetLong(MethodBase.GetCurrentMethod(), se);
                return(se.SigElementNum);
            }
            return(Crud.SigElementCrud.Insert(se));
        }
Ejemplo n.º 5
0
		//<summary>There's no such thing as deleting a SigElement</summary>
		/*public void Delete(){
			string command= "DELETE from SigElement WHERE SigElementNum = '"
				+POut.PInt(SigElementNum)+"'";
			DataConnection dcon=new DataConnection();
 			Db.NonQ(command);
		}*/

		///<summary>Loops through the supplied sigElement list and pulls out all elements for one specific signal.</summary>
		public static SigElement[] GetForSig(SigElement[] elementList,long signalNum) {
			//No need to check RemotingRole; no call to db.
			ArrayList AL=new ArrayList();
			for(int i=0;i<elementList.Length;i++){
				if(elementList[i].SignalNum==signalNum){
					AL.Add(elementList[i].Copy());
				}
			}
			SigElement[] retVal=new SigElement[AL.Count];
			AL.CopyTo(retVal);
			return retVal;
		}
Ejemplo n.º 6
0
        //<summary>There's no such thing as deleting a SigElement</summary>

        /*public void Delete(){
         *      string command= "DELETE from SigElement WHERE SigElementNum = '"
         +POut.PInt(SigElementNum)+"'";
         *      DataConnection dcon=new DataConnection();
         *      Db.NonQ(command);
         * }*/

        ///<summary>Loops through the supplied sigElement list and pulls out all elements for one specific signal.</summary>
        public static SigElement[] GetForSig(SigElement[] elementList, long signalNum)
        {
            //No need to check RemotingRole; no call to db.
            ArrayList AL = new ArrayList();

            for (int i = 0; i < elementList.Length; i++)
            {
                if (elementList[i].SignalNum == signalNum)
                {
                    AL.Add(elementList[i].Copy());
                }
            }
            SigElement[] retVal = new SigElement[AL.Count];
            AL.CopyTo(retVal);
            return(retVal);
        }
Ejemplo n.º 7
0
 private void lightSignalGrid1_ButtonClick(object sender,OpenDental.UI.ODLightSignalGridClickEventArgs e)
 {
     if(e.ActiveSignal!=null){//user trying to ack an existing light signal
         Signalods.AckButton(e.ButtonIndex+1,signalLastRefreshed);
         //then, manually ack the light on this computer.  The second ack in a few seconds will be ignored.
         lightSignalGrid1.SetButtonActive(e.ButtonIndex,Color.White,null);
         SigButDef butDef=SigButDefs.GetByIndex(e.ButtonIndex,SigButDefList);
         if(butDef!=null) {
             PaintOnIcon(butDef.SynchIcon,Color.White);
         }
         return;
     }
     if(e.ButtonDef==null || e.ButtonDef.ElementList.Length==0){//there is no signal to send
         return;
     }
     //user trying to send a signal
     Signalod sig=new Signalod();
     sig.SigType=SignalType.Button;
     //sig.ToUser=sigElementDefUser[listTo.SelectedIndex].SigText;
     //sig.FromUser=sigElementDefUser[listFrom.SelectedIndex].SigText;
     //need to do this all as a transaction?
     Signalods.Insert(sig);
     int row=0;
     Color color=Color.White;
     SigElementDef def;
     SigElement element;
     SigButDefElement[] butElements=SigButDefElements.GetForButton(e.ButtonDef.SigButDefNum);
     for(int i=0;i<butElements.Length;i++){
         element=new SigElement();
         element.SigElementDefNum=butElements[i].SigElementDefNum;
         element.SignalNum=sig.SignalNum;
         SigElements.Insert(element);
         if(SigElementDefs.GetElement(element.SigElementDefNum).SigElementType==SignalElementType.User){
             sig.ToUser=SigElementDefs.GetElement(element.SigElementDefNum).SigText;
             Signalods.Update(sig);
         }
         def=SigElementDefs.GetElement(element.SigElementDefNum);
         if(def.LightRow!=0) {
             row=def.LightRow;
         }
         if(def.LightColor.ToArgb()!=Color.White.ToArgb()) {
             color=def.LightColor;
         }
     }
     sig.ElementList=new SigElement[0];//we don't really care about these
     if(row!=0 && color!=Color.White) {
         lightSignalGrid1.SetButtonActive(row-1,color,sig);//this just makes it seem more responsive.
         //we can skip painting on the icon
     }
 }
Ejemplo n.º 8
0
		private void listMessages_Click(object sender,EventArgs e) {
			if(listMessages.SelectedIndex==-1){
				return;
			}
			Signalod sig=new Signalod();
			sig.SigType=SignalType.Button;
			sig.SigText=textMessage.Text;
			if(listTo.SelectedIndex!=-1) {
				sig.ToUser=sigElementDefUser[listTo.SelectedIndex].SigText;
			}
			if(listFrom.SelectedIndex!=-1) {
				sig.FromUser=sigElementDefUser[listFrom.SelectedIndex].SigText;
			}
			//need to do this all as a transaction, so need to do a writelock on the signal table first.
			//alternatively, we could just make sure not to retrieve any signals that were less the 300ms old.
			Signalods.Insert(sig);
			SigElement element;
			if(listTo.SelectedIndex!=-1) {
				element=new SigElement();
				element.SigElementDefNum=sigElementDefUser[listTo.SelectedIndex].SigElementDefNum;
				element.SignalNum=sig.SignalNum;
				SigElements.Insert(element);
			}
			//We do not insert an element for From
			if(listExtras.SelectedIndex!=-1) {
				element=new SigElement();
				element.SigElementDefNum=sigElementDefExtras[listExtras.SelectedIndex].SigElementDefNum;
				element.SignalNum=sig.SignalNum;
				SigElements.Insert(element);
			}
			element=new SigElement();
			element.SigElementDefNum=sigElementDefMessages[listMessages.SelectedIndex].SigElementDefNum;
			element.SignalNum=sig.SignalNum;
			SigElements.Insert(element);
			//reset the controls
			textMessage.Text="";
			listFrom.SelectedIndex=-1;
			listTo.SelectedIndex=-1;
			listExtras.SelectedIndex=-1;
			listMessages.SelectedIndex=-1;
			labelSending.Visible=true;
			timerSending.Enabled=true;
		}
Ejemplo n.º 9
0
		private void butSend_Click(object sender, System.EventArgs e){
			//if(listTo.SelectedIndex==-1){
			//	MsgBox.Show(this,"Please select who to send the message to.");
			//	return;
			//}
			if(textMessage.Text=="") {
				MsgBox.Show(this,"Please type in a message first.");
				return;
			}
			Signalod sig=new Signalod();
			sig.SigType=SignalType.Button;
			sig.SigText=textMessage.Text;
			if(listTo.SelectedIndex!=-1) {
				sig.ToUser=sigElementDefUser[listTo.SelectedIndex].SigText;
			}
			if(listFrom.SelectedIndex!=-1){
				sig.FromUser=sigElementDefUser[listFrom.SelectedIndex].SigText;
			}
			Signalods.Insert(sig);
			SigElement element;
			if(listTo.SelectedIndex!=-1) {
				element=new SigElement();
				element.SigElementDefNum=sigElementDefUser[listTo.SelectedIndex].SigElementDefNum;
				element.SignalNum=sig.SignalNum;
				SigElements.Insert(element);
			}
			textMessage.Text="";
			listFrom.SelectedIndex=-1;
			listTo.SelectedIndex=-1;
			listExtras.SelectedIndex=-1;
			listMessages.SelectedIndex=-1;
			labelSending.Visible=true;
			timerSending.Enabled=true;
		}