示例#1
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <ApptView> TableToList(DataTable table)
        {
            List <ApptView> retVal = new List <ApptView>();
            ApptView        apptView;

            foreach (DataRow row in table.Rows)
            {
                apptView                       = new ApptView();
                apptView.ApptViewNum           = PIn.Long(row["ApptViewNum"].ToString());
                apptView.Description           = PIn.String(row["Description"].ToString());
                apptView.ItemOrder             = PIn.Int(row["ItemOrder"].ToString());
                apptView.RowsPerIncr           = PIn.Byte(row["RowsPerIncr"].ToString());
                apptView.OnlyScheduledProvs    = PIn.Bool(row["OnlyScheduledProvs"].ToString());
                apptView.OnlySchedBeforeTime   = PIn.Time(row["OnlySchedBeforeTime"].ToString());
                apptView.OnlySchedAfterTime    = PIn.Time(row["OnlySchedAfterTime"].ToString());
                apptView.StackBehavUR          = (OpenDentBusiness.ApptViewStackBehavior)PIn.Int(row["StackBehavUR"].ToString());
                apptView.StackBehavLR          = (OpenDentBusiness.ApptViewStackBehavior)PIn.Int(row["StackBehavLR"].ToString());
                apptView.ClinicNum             = PIn.Long(row["ClinicNum"].ToString());
                apptView.ApptTimeScrollStart   = PIn.Time(row["ApptTimeScrollStart"].ToString());
                apptView.IsScrollStartDynamic  = PIn.Bool(row["IsScrollStartDynamic"].ToString());
                apptView.IsApptBubblesDisabled = PIn.Bool(row["IsApptBubblesDisabled"].ToString());
                apptView.WidthOpMinimum        = PIn.Int(row["WidthOpMinimum"].ToString());
                retVal.Add(apptView);
            }
            return(retVal);
        }
示例#2
0
        ///<summary>Deletes all apptviewitems for the current apptView.</summary>
        public static void DeleteAllForView(ApptView view)
        {
            string c = "DELETE from apptviewitem WHERE ApptViewNum = '"
                       + POut.PInt(view.ApptViewNum) + "'";

            General.NonQ(c);
        }
示例#3
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            ApptView ApptViewCur = new ApptView();

            if (_listApptViews.Count == 0)
            {
                ApptViewCur.ItemOrder = 0;
            }
            else
            {
                ApptViewCur.ItemOrder = _listApptViews[_listApptViews.Count - 1].ItemOrder + 1;
            }
            ApptViewCur.ApptTimeScrollStart = DateTime.Parse("08:00:00").TimeOfDay; //default to 8 AM
            ApptViews.Insert(ApptViewCur);                                          //this also gets the primary key
            FormApptViewEdit FormAVE = new FormApptViewEdit();

            FormAVE.ApptViewCur = ApptViewCur;
            FormAVE.IsNew       = true;
            FormAVE.ClinicNum   = _clinicNum;
            FormAVE.ShowDialog();
            if (FormAVE.DialogResult != DialogResult.OK)
            {
                return;
            }
            viewChanged = true;
            FillViewList();
            listViews.SelectedIndex = listViews.Items.Count - 1;        //this works even if no items
        }
示例#4
0
        private void listViews_DoubleClick(object sender, System.EventArgs e)
        {
            if (listViews.SelectedIndex == -1)
            {
                return;
            }
            int              selected    = listViews.SelectedIndex;
            ApptView         ApptViewCur = _listApptViews[listViews.SelectedIndex];
            FormApptViewEdit FormAVE     = new FormApptViewEdit();

            FormAVE.ApptViewCur = ApptViewCur;
            FormAVE.ClinicNum   = _clinicNum;
            FormAVE.ShowDialog();
            if (FormAVE.DialogResult != DialogResult.OK)
            {
                return;
            }
            viewChanged = true;
            FillViewList();
            if (selected < listViews.Items.Count)
            {
                listViews.SelectedIndex = selected;
            }
            else
            {
                listViews.SelectedIndex = -1;
            }
        }
示例#5
0
 ///<summary>Inserts one ApptView into the database.  Returns the new priKey.</summary>
 public static long Insert(ApptView apptView)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         apptView.ApptViewNum = DbHelper.GetNextOracleKey("apptview", "ApptViewNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(apptView, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     apptView.ApptViewNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(apptView, false));
     }
 }
示例#6
0
        ///<summary></summary>
        public static void Delete(ApptView Cur)
        {
            string command = "DELETE from apptview WHERE ApptViewNum = '"
                             + POut.PInt(Cur.ApptViewNum) + "'";

            General.NonQ(command);
        }
示例#7
0
 ///<summary>Inserts one ApptView into the database.  Returns the new priKey.</summary>
 internal static long Insert(ApptView apptView)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         apptView.ApptViewNum=DbHelper.GetNextOracleKey("apptview","ApptViewNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(apptView,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     apptView.ApptViewNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(apptView,false);
     }
 }
示例#8
0
 ///<summary>Inserts one ApptView into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(ApptView apptView,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         apptView.ApptViewNum=ReplicationServers.GetKey("apptview","ApptViewNum");
     }
     string command="INSERT INTO apptview (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="ApptViewNum,";
     }
     command+="Description,ItemOrder,RowsPerIncr,OnlyScheduledProvs,OnlySchedBeforeTime,OnlySchedAfterTime,StackBehavUR,StackBehavLR,ClinicNum) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(apptView.ApptViewNum)+",";
     }
     command+=
          "'"+POut.String(apptView.Description)+"',"
         +    POut.Int   (apptView.ItemOrder)+","
         +    POut.Byte  (apptView.RowsPerIncr)+","
         +    POut.Bool  (apptView.OnlyScheduledProvs)+","
         +    POut.Time  (apptView.OnlySchedBeforeTime)+","
         +    POut.Time  (apptView.OnlySchedAfterTime)+","
         +    POut.Int   ((int)apptView.StackBehavUR)+","
         +    POut.Int   ((int)apptView.StackBehavLR)+","
         +    POut.Long  (apptView.ClinicNum)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         apptView.ApptViewNum=Db.NonQ(command,true);
     }
     return apptView.ApptViewNum;
 }
示例#9
0
        private void butDown_Click(object sender, System.EventArgs e)
        {
            if (listViews.SelectedIndex == -1)
            {
                MessageBox.Show(Lan.g(this, "Please select a category first."));
                return;
            }
            if (listViews.SelectedIndex == ApptViewC.List.Length - 1)
            {
                return;                //can't go down any more
            }
            int selected = listViews.SelectedIndex;
            //it will flip flop with the one below it
            ApptView ApptViewCur = ApptViewC.List[listViews.SelectedIndex];

            ApptViewCur.ItemOrder = ApptViewCur.ItemOrder + 1;
            ApptViews.Update(ApptViewCur);
            //now the other
            ApptViewCur           = ApptViewC.List[listViews.SelectedIndex + 1];
            ApptViewCur.ItemOrder = ApptViewCur.ItemOrder - 1;
            ApptViews.Update(ApptViewCur);
            viewChanged = true;
            FillViewList();
            listViews.SelectedIndex = selected + 1;
        }
示例#10
0
 ///<summary>Returns true if Update(ApptView,ApptView) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(ApptView apptView, ApptView oldApptView)
 {
     if (apptView.Description != oldApptView.Description)
     {
         return(true);
     }
     if (apptView.ItemOrder != oldApptView.ItemOrder)
     {
         return(true);
     }
     if (apptView.RowsPerIncr != oldApptView.RowsPerIncr)
     {
         return(true);
     }
     if (apptView.OnlyScheduledProvs != oldApptView.OnlyScheduledProvs)
     {
         return(true);
     }
     if (apptView.OnlySchedBeforeTime != oldApptView.OnlySchedBeforeTime)
     {
         return(true);
     }
     if (apptView.OnlySchedAfterTime != oldApptView.OnlySchedAfterTime)
     {
         return(true);
     }
     if (apptView.StackBehavUR != oldApptView.StackBehavUR)
     {
         return(true);
     }
     if (apptView.StackBehavLR != oldApptView.StackBehavLR)
     {
         return(true);
     }
     if (apptView.ClinicNum != oldApptView.ClinicNum)
     {
         return(true);
     }
     if (apptView.ApptTimeScrollStart != oldApptView.ApptTimeScrollStart)
     {
         return(true);
     }
     if (apptView.IsScrollStartDynamic != oldApptView.IsScrollStartDynamic)
     {
         return(true);
     }
     if (apptView.IsApptBubblesDisabled != oldApptView.IsApptBubblesDisabled)
     {
         return(true);
     }
     if (apptView.WidthOpMinimum != oldApptView.WidthOpMinimum)
     {
         return(true);
     }
     return(false);
 }
示例#11
0
        ///<summary></summary>
        public static void Update(ApptView Cur)
        {
            string command = "UPDATE apptview SET "
                             + "Description='" + POut.PString(Cur.Description) + "'"
                             + ",ItemOrder = '" + POut.PInt(Cur.ItemOrder) + "'"
                             + ",RowsPerIncr = '" + POut.PInt(Cur.RowsPerIncr) + "'"
                             + " WHERE ApptViewNum = '" + POut.PInt(Cur.ApptViewNum) + "'";

            General.NonQ(command);
        }
示例#12
0
 ///<summary>Gets (list)ForCurView, ApptDrawing.VisOps, ApptDrawing.VisProvs, and ApptRows.  Also sets TwoRows.  Pass in null for the dailySched if this is a weekly view or if in FormApptViewEdit.</summary>
 public static void GetForCurView(ApptView apptViewCur, bool isWeekly, List <Schedule> dailySched)
 {
     ApptViewCur = apptViewCur;
     FillForApptView(isWeekly, ApptViewCur, out ApptDrawing.VisProvs, out ApptDrawing.VisOps, out ForCurView, out ApptRows, out ApptDrawing.RowsPerIncr);
     AddOpsForScheduledProvs(isWeekly, dailySched, ApptViewCur, ref ApptDrawing.VisOps);
     ApptDrawing.VisOps.Sort(CompareOps);
     ApptDrawing.VisProvs.Sort(CompareProvs);
     ApptDrawing.DictOpNumToColumnNum   = ApptDrawing.VisOps.ToDictionary(x => x.OperatoryNum, x => ApptDrawing.VisOps.FindIndex(y => y.OperatoryNum == x.OperatoryNum));
     ApptDrawing.DictProvNumToColumnNum = ApptDrawing.VisProvs.ToDictionary(x => x.ProvNum, x => ApptDrawing.VisProvs.FindIndex(y => y.ProvNum == x.ProvNum));
 }
示例#13
0
        ///<summary></summary>
        public static void Insert(ApptView Cur)
        {
            string command = "INSERT INTO apptview (Description,ItemOrder,RowsPerIncr) "
                             + "VALUES ("
                             + "'" + POut.PString(Cur.Description) + "', "
                             + "'" + POut.PInt(Cur.ItemOrder) + "', "
                             + "'" + POut.PInt(Cur.RowsPerIncr) + "')";

            //MessageBox.Show(string command);
            Cur.ApptViewNum = General.NonQ(command, true);
        }
示例#14
0
        ///<summary></summary>
        public static ApptView CreateApptView(string description, TimeSpan apptTimeScrollStart = new TimeSpan())
        {
            ApptView apptView = new ApptView()
            {
                Description         = description,
                ApptTimeScrollStart = apptTimeScrollStart,
            };

            ApptViews.Insert(apptView);
            ApptViews.RefreshCache();
            return(apptView);
        }
示例#15
0
        ///<summary>Gets the 'visible' operatories for todays date with the currently selected appointment view.  This is strictly used when filtering the
        ///waiting room for clinics.  Pass in null for the dailySched if this is a weekly view.</summary>
        public static List <Operatory> GetOpsForApptView(ApptView apptViewCur, bool isWeekly, List <Schedule> dailySched)
        {
            List <ApptViewItem> forCurView;
            List <Provider>     visProvs;
            List <Operatory>    visOps;
            List <ApptViewItem> apptRows;
            int rowsPerIncr;

            FillForApptView(isWeekly, apptViewCur, out visProvs, out visOps, out forCurView, out apptRows, out rowsPerIncr, false);
            AddOpsForScheduledProvs(isWeekly, dailySched, apptViewCur, ref visOps);
            visOps.Sort(CompareOps);
            return(visOps);
        }
示例#16
0
 ///<summary>Inserts one ApptView into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ApptView apptView)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(apptView, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             apptView.ApptViewNum = DbHelper.GetNextOracleKey("apptview", "ApptViewNum");                  //Cacheless method
         }
         return(InsertNoCache(apptView, true));
     }
 }
示例#17
0
        ///<summary></summary>
        public static void Refresh()
        {
            string    c     = "SELECT * from apptview ORDER BY itemorder";
            DataTable table = General.GetTable(c);

            List = new ApptView[table.Rows.Count];
            for (int i = 0; i < List.Length; i++)
            {
                List[i]             = new ApptView();
                List[i].ApptViewNum = PIn.PInt(table.Rows[i][0].ToString());
                List[i].Description = PIn.PString(table.Rows[i][1].ToString());
                List[i].ItemOrder   = PIn.PInt(table.Rows[i][2].ToString());
                List[i].RowsPerIncr = PIn.PInt(table.Rows[i][3].ToString());
            }
        }
示例#18
0
        ///<summary>Updates one ApptView in the database.</summary>
        public static void Update(ApptView apptView)
        {
            string command = "UPDATE apptview SET "
                             + "Description        = '" + POut.String(apptView.Description) + "', "
                             + "ItemOrder          =  " + POut.Int(apptView.ItemOrder) + ", "
                             + "RowsPerIncr        =  " + POut.Byte(apptView.RowsPerIncr) + ", "
                             + "OnlyScheduledProvs =  " + POut.Bool(apptView.OnlyScheduledProvs) + ", "
                             + "OnlySchedBeforeTime=  " + POut.Time(apptView.OnlySchedBeforeTime) + ", "
                             + "OnlySchedAfterTime =  " + POut.Time(apptView.OnlySchedAfterTime) + ", "
                             + "StackBehavUR       =  " + POut.Int((int)apptView.StackBehavUR) + ", "
                             + "StackBehavLR       =  " + POut.Int((int)apptView.StackBehavLR) + ", "
                             + "ClinicNum          =  " + POut.Long(apptView.ClinicNum) + " "
                             + "WHERE ApptViewNum = " + POut.Long(apptView.ApptViewNum);

            Db.NonQ(command);
        }
示例#19
0
        ///<summary>Creates an appointment view with amount of operatories specified from list of op nums passed in for the
        ///specified clinic. Does not handle assigning providers to operatories. </summary>
        public static ApptView SetApptView(List <long> listOpNums, long clinicNum = 0)      //Create aptView items for list of providers passed in, list of ops passed in
        {
            ApptView aptView = new ApptView();

            aptView.ClinicNum = clinicNum;
            ApptViews.Insert(aptView);
            for (int i = 0; i < listOpNums.Count; i++)
            {
                ApptViewItem viewItem = new ApptViewItem();
                viewItem.ApptViewNum = aptView.ApptViewNum;
                viewItem.OpNum       = listOpNums[i];
                ApptViewItems.Insert(viewItem);
            }
            ApptViews.RefreshCache();
            ApptViewItems.RefreshCache();
            return(aptView);
        }
示例#20
0
文件: ApptViewCrud.cs 项目: mnisl/OD
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<ApptView> TableToList(DataTable table){
			List<ApptView> retVal=new List<ApptView>();
			ApptView apptView;
			for(int i=0;i<table.Rows.Count;i++) {
				apptView=new ApptView();
				apptView.ApptViewNum        = PIn.Long  (table.Rows[i]["ApptViewNum"].ToString());
				apptView.Description        = PIn.String(table.Rows[i]["Description"].ToString());
				apptView.ItemOrder          = PIn.Int   (table.Rows[i]["ItemOrder"].ToString());
				apptView.RowsPerIncr        = PIn.Byte  (table.Rows[i]["RowsPerIncr"].ToString());
				apptView.OnlyScheduledProvs = PIn.Bool  (table.Rows[i]["OnlyScheduledProvs"].ToString());
				apptView.OnlySchedBeforeTime= PIn.Time(table.Rows[i]["OnlySchedBeforeTime"].ToString());
				apptView.OnlySchedAfterTime = PIn.Time(table.Rows[i]["OnlySchedAfterTime"].ToString());
				apptView.StackBehavUR       = (OpenDentBusiness.ApptViewStackBehavior)PIn.Int(table.Rows[i]["StackBehavUR"].ToString());
				apptView.StackBehavLR       = (OpenDentBusiness.ApptViewStackBehavior)PIn.Int(table.Rows[i]["StackBehavLR"].ToString());
				apptView.ClinicNum          = PIn.Long  (table.Rows[i]["ClinicNum"].ToString());
				retVal.Add(apptView);
			}
			return retVal;
		}
示例#21
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            ApptView ApptViewCur = new ApptView();

            ApptViewCur.ItemOrder = ApptViewC.List.Length;
            ApptViews.Insert(ApptViewCur);            //this also gets the primary key
            FormApptViewEdit FormAVE = new FormApptViewEdit();

            FormAVE.ApptViewCur = ApptViewCur;
            FormAVE.IsNew       = true;
            FormAVE.ShowDialog();
            if (FormAVE.DialogResult != DialogResult.OK)
            {
                return;
            }
            viewChanged = true;
            FillViewList();
            listViews.SelectedIndex = listViews.Items.Count - 1;        //this works even if no items
        }
示例#22
0
        ///<summary>Inserts one ApptView into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ApptView apptView, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO apptview (";

            if (!useExistingPK && isRandomKeys)
            {
                apptView.ApptViewNum = ReplicationServers.GetKeyNoCache("apptview", "ApptViewNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ApptViewNum,";
            }
            command += "Description,ItemOrder,RowsPerIncr,OnlyScheduledProvs,OnlySchedBeforeTime,OnlySchedAfterTime,StackBehavUR,StackBehavLR,ClinicNum,ApptTimeScrollStart,IsScrollStartDynamic,IsApptBubblesDisabled,WidthOpMinimum) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(apptView.ApptViewNum) + ",";
            }
            command +=
                "'" + POut.String(apptView.Description) + "',"
                + POut.Int(apptView.ItemOrder) + ","
                + POut.Byte(apptView.RowsPerIncr) + ","
                + POut.Bool(apptView.OnlyScheduledProvs) + ","
                + POut.Time(apptView.OnlySchedBeforeTime) + ","
                + POut.Time(apptView.OnlySchedAfterTime) + ","
                + POut.Int((int)apptView.StackBehavUR) + ","
                + POut.Int((int)apptView.StackBehavLR) + ","
                + POut.Long(apptView.ClinicNum) + ","
                + POut.Time(apptView.ApptTimeScrollStart) + ","
                + POut.Bool(apptView.IsScrollStartDynamic) + ","
                + POut.Bool(apptView.IsApptBubblesDisabled) + ","
                + POut.Int(apptView.WidthOpMinimum) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                apptView.ApptViewNum = Db.NonQ(command, true, "ApptViewNum", "apptView");
            }
            return(apptView.ApptViewNum);
        }
示例#23
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <ApptView> TableToList(DataTable table)
        {
            List <ApptView> retVal = new List <ApptView>();
            ApptView        apptView;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                apptView                     = new ApptView();
                apptView.ApptViewNum         = PIn.Long(table.Rows[i]["ApptViewNum"].ToString());
                apptView.Description         = PIn.String(table.Rows[i]["Description"].ToString());
                apptView.ItemOrder           = PIn.Int(table.Rows[i]["ItemOrder"].ToString());
                apptView.RowsPerIncr         = PIn.Byte(table.Rows[i]["RowsPerIncr"].ToString());
                apptView.OnlyScheduledProvs  = PIn.Bool(table.Rows[i]["OnlyScheduledProvs"].ToString());
                apptView.OnlySchedBeforeTime = PIn.Time(table.Rows[i]["OnlySchedBeforeTime"].ToString());
                apptView.OnlySchedAfterTime  = PIn.Time(table.Rows[i]["OnlySchedAfterTime"].ToString());
                apptView.StackBehavUR        = (ApptViewStackBehavior)PIn.Int(table.Rows[i]["StackBehavUR"].ToString());
                apptView.StackBehavLR        = (ApptViewStackBehavior)PIn.Int(table.Rows[i]["StackBehavLR"].ToString());
                apptView.ClinicNum           = PIn.Long(table.Rows[i]["ClinicNum"].ToString());
                retVal.Add(apptView);
            }
            return(retVal);
        }
示例#24
0
        ///<summary>Inserts one ApptView into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(ApptView apptView, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                apptView.ApptViewNum = ReplicationServers.GetKey("apptview", "ApptViewNum");
            }
            string command = "INSERT INTO apptview (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ApptViewNum,";
            }
            command += "Description,ItemOrder,RowsPerIncr,OnlyScheduledProvs,OnlySchedBeforeTime,OnlySchedAfterTime,StackBehavUR,StackBehavLR,ClinicNum) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(apptView.ApptViewNum) + ",";
            }
            command +=
                "'" + POut.String(apptView.Description) + "',"
                + POut.Int(apptView.ItemOrder) + ","
                + POut.Byte(apptView.RowsPerIncr) + ","
                + POut.Bool(apptView.OnlyScheduledProvs) + ","
                + POut.Time(apptView.OnlySchedBeforeTime) + ","
                + POut.Time(apptView.OnlySchedAfterTime) + ","
                + POut.Int((int)apptView.StackBehavUR) + ","
                + POut.Int((int)apptView.StackBehavLR) + ","
                + POut.Long(apptView.ClinicNum) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                apptView.ApptViewNum = Db.NonQ(command, true);
            }
            return(apptView.ApptViewNum);
        }
示例#25
0
        private void butDown_Click(object sender, System.EventArgs e)
        {
            if (listViews.SelectedIndex == -1)
            {
                MessageBox.Show(Lan.g(this, "Please select a category first."));
                return;
            }
            if (listViews.SelectedIndex == listViews.Items.Count - 1)
            {
                return;                //can't go down any more
            }
            //it will flip flop with the one below it
            ApptView ApptViewCur = _listApptViews[listViews.SelectedIndex + 1];

            ApptViewCur.ItemOrder = listViews.SelectedIndex;
            ApptViews.Update(ApptViewCur);
            //now the other
            ApptViewCur           = _listApptViews[listViews.SelectedIndex];
            ApptViewCur.ItemOrder = listViews.SelectedIndex + 1;
            ApptViews.Update(ApptViewCur);
            viewChanged = true;
            FillViewList();
            listViews.SelectedIndex = _listApptViews.FindIndex(x => x.ApptViewNum == ApptViewCur.ApptViewNum);
        }
示例#26
0
 public static ApptViewItem CreateApptViewItem(long opNum, long provNum, long clinicNum = 0, string apptViewDesc = "All")
 {
     return(DataAction.GetPractice(() => {
         ApptView aptView = ApptViews.GetForClinic(clinicNum).FirstOrDefault(x => x.Description.ToLower() == apptViewDesc.ToLower());
         if (aptView == null)
         {
             aptView = new ApptView()
             {
                 Description = apptViewDesc,
                 ItemOrder = 99,
                 ClinicNum = clinicNum,
             };
             ApptViews.Insert(aptView);
         }
         ApptViewItem ret = new ApptViewItem()
         {
             ApptViewNum = aptView.ApptViewNum,
             OpNum = opNum,
             ProvNum = provNum,
         };
         ApptViewItems.Insert(ret);
         return ret;
     }));
 }
示例#27
0
        ///<summary>When looking at a daily appointment module and the current appointment view is has 'OnlyScheduleProvs' turned on, this method will dynamically add additional operatories to visOps for providers that are scheduled to work.</summary>
        public static void AddOpsForScheduledProvs(bool isWeekly, List <Schedule> dailySched, ApptView apptViewCur, ref List <Operatory> visOps)
        {
            //if this appt view has the option to show only scheduled providers and this is daily view.
            //Remember that there is no intelligence in weekly view for this option, and it behaves just like it always did.
            if (ApptViews.IsNoneView(apptViewCur) ||
                dailySched == null ||
                visOps == null ||
                !apptViewCur.OnlyScheduledProvs ||
                isWeekly)
            {
                return;
            }
            //intelligently decide what ops to show.  It's based on the schedule for the day.
            //visOps will be totally empty right now because it looped out of the above section of code.
            List <long>      listSchedOps;
            bool             opAdded;
            int              indexOp;
            List <Operatory> listOpsShort       = Operatories.GetDeepCopy(true);
            List <long>      listApptViewOpNums = ApptViewItems.GetOpsForView(apptViewCur.ApptViewNum);

            for (int i = 0; i < listOpsShort.Count; i++)       //loop through all ops for all views (except the hidden ones, of course)
            //If this operatory was not one of the selected Ops from the Appt View Edit window, skip it.
            {
                if (!listApptViewOpNums.Contains(listOpsShort[i].OperatoryNum))
                {
                    continue;
                }
                //find any applicable sched for the op
                opAdded = false;
                for (int s = 0; s < dailySched.Count; s++)
                {
                    if (dailySched[s].SchedType != ScheduleType.Provider)
                    {
                        continue;
                    }
                    if (dailySched[s].StartTime == new TimeSpan(0))                   //skip if block starts at midnight.
                    {
                        continue;
                    }
                    if (dailySched[s].StartTime == dailySched[s].StopTime)                   //skip if block has no length.
                    {
                        continue;
                    }
                    if (apptViewCur.OnlySchedAfterTime > new TimeSpan(0, 0, 0))
                    {
                        if (dailySched[s].StartTime < apptViewCur.OnlySchedAfterTime ||
                            dailySched[s].StopTime < apptViewCur.OnlySchedAfterTime)
                        {
                            continue;
                        }
                    }
                    if (apptViewCur.OnlySchedBeforeTime > new TimeSpan(0, 0, 0))
                    {
                        if (dailySched[s].StartTime > apptViewCur.OnlySchedBeforeTime ||
                            dailySched[s].StopTime > apptViewCur.OnlySchedBeforeTime)
                        {
                            continue;
                        }
                    }
                    //this 'sched' must apply to this situation.
                    //listSchedOps is the ops for this 'sched'.
                    listSchedOps = dailySched[s].Ops;
                    //Add all the ops for this 'sched' to the list of visible ops
                    for (int p = 0; p < listSchedOps.Count; p++)
                    {
                        //Filter the ops if the clinic option was set for the appt view.
                        if (apptViewCur.ClinicNum > 0 && apptViewCur.ClinicNum != Operatories.GetOperatory(listSchedOps[p]).ClinicNum)
                        {
                            continue;
                        }
                        if (listSchedOps[p] == listOpsShort[i].OperatoryNum)
                        {
                            Operatory op = listOpsShort[i];
                            indexOp = Operatories.GetOrder(listSchedOps[p]);
                            if (indexOp != -1 && !visOps.Contains(op))                           //prevents adding duplicate ops
                            {
                                visOps.Add(op);
                                opAdded = true;
                                break;
                            }
                        }
                    }
                    //If the provider is not scheduled to any op(s), add their default op(s).
                    if (listOpsShort[i].ProvDentist == dailySched[s].ProvNum && listSchedOps.Count == 0)                 //only if the sched does not specify any ops
                    //Only add the op if the clinic option was not set in the appt view or if the op is assigned to that clinic.
                    {
                        if (apptViewCur.ClinicNum == 0 || apptViewCur.ClinicNum == listOpsShort[i].ClinicNum)
                        {
                            indexOp = Operatories.GetOrder(listOpsShort[i].OperatoryNum);
                            if (indexOp != -1 && !visOps.Contains(listOpsShort[i]))
                            {
                                visOps.Add(listOpsShort[i]);
                                opAdded = true;
                            }
                        }
                    }
                    if (opAdded)
                    {
                        break;                        //break out of the loop of schedules.  Continue with the next op.
                    }
                }
            }
            //Remove any duplicates before return.
            visOps = visOps.GroupBy(x => x.OperatoryNum).Select(x => x.First()).ToList();
        }
示例#28
0
        ///<summary>Gets (list)ForCurView, ApptDrawing.VisOps, ApptDrawing.VisProvs, and ApptRows.  Also sets TwoRows. Works even if supply -1 to indicate no apptview is selected.  Pass in null for the dailySched if this is a weekly view or if in FormApptViewEdit.</summary>
        public static void GetForCurView(ApptView av, bool isWeekly, List <Schedule> dailySched)
        {
            ApptViewCur          = av;
            ForCurView           = new List <ApptViewItem>();
            ApptDrawing.VisProvs = new List <Provider>();
            ApptDrawing.VisOps   = new List <Operatory>();
            ApptRows             = new List <ApptViewItem>();
            int index;

            //If there are no appointment views set up (therefore, none selected), then use a hard-coded default view.
            if (ApptViewCur == null)
            {
                //MessageBox.Show("apptcategorynum:"+ApptCategories.Cur.ApptCategoryNum.ToString());
                //make visible ops exactly the same as the short ops list (all except hidden)
                for (int i = 0; i < OperatoryC.ListShort.Count; i++)
                {
                    ApptDrawing.VisOps.Add(OperatoryC.ListShort[i]);
                }
                //make visible provs exactly the same as the prov list (all except hidden)
                for (int i = 0; i < ProviderC.ListShort.Count; i++)
                {
                    ApptDrawing.VisProvs.Add(ProviderC.ListShort[i]);
                }
                //Hard coded elements showing
                ApptRows.Add(new ApptViewItem("PatientName", 0, Color.Black));
                ApptRows.Add(new ApptViewItem("ASAP", 1, Color.DarkRed));
                ApptRows.Add(new ApptViewItem("MedUrgNote", 2, Color.DarkRed));
                ApptRows.Add(new ApptViewItem("PremedFlag", 3, Color.DarkRed));
                ApptRows.Add(new ApptViewItem("Lab", 4, Color.DarkRed));
                ApptRows.Add(new ApptViewItem("Procs", 5, Color.Black));
                ApptRows.Add(new ApptViewItem("Note", 6, Color.Black));
                ApptDrawing.RowsPerIncr = 1;
            }
            //An appointment view is selected, so add provs and ops from the view to our lists of indexes.
            else
            {
                for (int i = 0; i < ApptViewItemC.List.Length; i++)
                {
                    if (ApptViewItemC.List[i].ApptViewNum == ApptViewCur.ApptViewNum)
                    {
                        ForCurView.Add(ApptViewItemC.List[i]);
                        if (ApptViewItemC.List[i].OpNum > 0)                      //op
                        {
                            if (ApptViewCur.OnlyScheduledProvs && !isWeekly)
                            {
                                continue;                                //handled below
                            }
                            index = Operatories.GetOrder(ApptViewItemC.List[i].OpNum);
                            if (index != -1)
                            {
                                ApptDrawing.VisOps.Add(OperatoryC.ListShort[index]);
                            }
                        }
                        else if (ApptViewItemC.List[i].ProvNum > 0)                      //prov
                        {
                            index = Providers.GetIndex(ApptViewItemC.List[i].ProvNum);
                            if (index != -1)
                            {
                                ApptDrawing.VisProvs.Add(ProviderC.ListShort[index]);
                            }
                        }
                        else                         //element or apptfielddef
                        {
                            ApptRows.Add(ApptViewItemC.List[i]);
                        }
                    }
                }
                ApptDrawing.RowsPerIncr = ApptViewCur.RowsPerIncr;
            }
            //if this appt view has the option to show only scheduled providers and this is daily view.
            //Remember that there is no intelligence in weekly view for this option, and it behaves just like it always did.
            if (ApptViewCur != null && ApptViewCur.OnlyScheduledProvs && !isWeekly)
            {
                //intelligently decide what ops to show.  It's based on the schedule for the day.
                //VisOps will be totally empty right now because it looped out of the above section of code.
                List <long> listSchedOps;
                bool        opAdded;
                int         indexOp;
                for (int i = 0; i < OperatoryC.ListShort.Count; i++)          //loop through all ops for all views (except the hidden ones, of course)
                //find any applicable sched for the op
                {
                    opAdded = false;
                    for (int s = 0; s < dailySched.Count; s++)
                    {
                        if (dailySched[s].SchedType != ScheduleType.Provider)
                        {
                            continue;
                        }
                        if (dailySched[s].StartTime == new TimeSpan(0))                       //skip if block starts at midnight.
                        {
                            continue;
                        }
                        if (dailySched[s].StartTime == dailySched[s].StopTime)                       //skip if block has no length.
                        {
                            continue;
                        }
                        if (ApptViewCur.OnlySchedAfterTime > new TimeSpan(0, 0, 0))
                        {
                            if (dailySched[s].StartTime < ApptViewCur.OnlySchedAfterTime ||
                                dailySched[s].StopTime < ApptViewCur.OnlySchedAfterTime)
                            {
                                continue;
                            }
                        }
                        if (ApptViewCur.OnlySchedBeforeTime > new TimeSpan(0, 0, 0))
                        {
                            if (dailySched[s].StartTime > ApptViewCur.OnlySchedBeforeTime ||
                                dailySched[s].StopTime > ApptViewCur.OnlySchedBeforeTime)
                            {
                                continue;
                            }
                        }
                        //this 'sched' must apply to this situation.
                        //listSchedOps is the ops for this 'sched'.
                        listSchedOps = dailySched[s].Ops;
                        //Add all the ops for this 'sched' to the list of visible ops
                        for (int p = 0; p < listSchedOps.Count; p++)
                        {
                            //Filter the ops if the clinic option was set for the appt view.
                            if (ApptViewCur.ClinicNum > 0 && ApptViewCur.ClinicNum != Operatories.GetOperatory(listSchedOps[p]).ClinicNum)
                            {
                                continue;
                            }
                            if (listSchedOps[p] == OperatoryC.ListShort[i].OperatoryNum)
                            {
                                Operatory op = OperatoryC.ListShort[i];
                                indexOp = Operatories.GetOrder(listSchedOps[p]);
                                if (indexOp != -1 && !ApptDrawing.VisOps.Contains(op))                               //prevents adding duplicate ops
                                {
                                    ApptDrawing.VisOps.Add(op);
                                    opAdded = true;
                                    break;
                                }
                            }
                        }
                        //If the provider is not scheduled to any op(s), add their default op(s).
                        if (OperatoryC.ListShort[i].ProvDentist == dailySched[s].ProvNum && listSchedOps.Count == 0)                     //only if the sched does not specify any ops
                        //Only add the op if the clinic option was not set in the appt view or if the op is assigned to that clinic.
                        {
                            if (ApptViewCur.ClinicNum == 0 || ApptViewCur.ClinicNum == OperatoryC.ListShort[i].ClinicNum)
                            {
                                indexOp = Operatories.GetOrder(OperatoryC.ListShort[i].OperatoryNum);
                                if (indexOp != -1 && !ApptDrawing.VisOps.Contains(OperatoryC.ListShort[i]))
                                {
                                    ApptDrawing.VisOps.Add(OperatoryC.ListShort[i]);
                                    opAdded = true;
                                }
                            }
                        }
                        if (opAdded)
                        {
                            break;                            //break out of the loop of schedules.  Continue with the next op.
                        }
                    }
                }
            }
            ApptDrawing.VisOps.Sort(CompareOps);
            ApptDrawing.VisProvs.Sort(CompareProvs);
        }
示例#29
0
        ///<summary>Set default fontSize to 8 unless printing.</summary>
        public static void DrawEntireAppt(Graphics g, DataRow dataRoww, string patternShowing, float totalWidth, float totalHeight, bool isSelected, bool thisIsPinBoard, long selectedAptNum, List <ApptViewItem> apptRows, ApptView apptViewCur, DataTable tableApptFields, DataTable tablePatFields, int fontSize, bool isPrinting)
        {
            Pen   penB  = new Pen(Color.Black);
            Pen   penW  = new Pen(Color.White);
            Pen   penGr = new Pen(Color.SlateGray);
            Pen   penDG = new Pen(Color.DarkSlateGray);
            Pen   penO;          //provider outline color
            Color backColor;
            Color provColor;

            if (dataRoww["ProvNum"].ToString() != "0" && dataRoww["IsHygiene"].ToString() == "0")         //dentist
            {
                provColor = Providers.GetColor(PIn.Long(dataRoww["ProvNum"].ToString()));
                penO      = new Pen(Providers.GetOutlineColor(PIn.Long(dataRoww["ProvNum"].ToString())));
            }
            else if (dataRoww["ProvHyg"].ToString() != "0" && dataRoww["IsHygiene"].ToString() == "1")         //hygienist
            {
                provColor = Providers.GetColor(PIn.Long(dataRoww["ProvHyg"].ToString()));
                penO      = new Pen(Providers.GetOutlineColor(PIn.Long(dataRoww["ProvHyg"].ToString())));
            }
            else              //unknown
            {
                provColor = Color.White;
                penO      = new Pen(Color.Black);
            }
            if (PIn.Long(dataRoww["AptStatus"].ToString()) == (int)ApptStatus.Complete)
            {
                backColor = DefC.Long[(int)DefCat.AppointmentColors][2].ItemColor;
            }
            else if (PIn.Long(dataRoww["AptStatus"].ToString()) == (int)ApptStatus.PtNote)
            {
                backColor = DefC.Long[(int)DefCat.AppointmentColors][5].ItemColor;
            }
            else if (PIn.Long(dataRoww["AptStatus"].ToString()) == (int)ApptStatus.PtNoteCompleted)
            {
                backColor = DefC.Long[(int)DefCat.AppointmentColors][6].ItemColor;
            }
            else if (PIn.Int(dataRoww["ColorOverride"].ToString()) != 0)
            {
                backColor = Color.FromArgb(PIn.Int(dataRoww["ColorOverride"].ToString()));
            }
            else
            {
                backColor = provColor;
                //We might want to do something interesting here.
            }
            SolidBrush backBrush = new SolidBrush(backColor);

            g.FillRectangle(backBrush, 7, 0, totalWidth - 7, (int)totalHeight);
            g.FillRectangle(Brushes.White, 0, 0, 7, (int)totalHeight);
            Pen penTimediv = Pens.Silver;

            for (int i = 0; i < patternShowing.Length; i++)       //Info.MyApt.Pattern.Length;i++){
            {
                if (patternShowing.Substring(i, 1) == "X")
                {
                    if (isPrinting)
                    {
                        g.FillRectangle(new SolidBrush(provColor), 0, i * ApptDrawing.LineH, 7, ApptDrawing.LineH);
                    }
                    else
                    {
                        g.FillRectangle(new SolidBrush(provColor), 1, i * ApptDrawing.LineH + 1, 6, ApptDrawing.LineH);
                    }
                }
                else
                {
                    //leave empty
                }
                if (Math.IEEERemainder((double)i, (double)ApptDrawing.RowsPerIncr) == 0)              //0/1
                {
                    if (isPrinting)
                    {
                        g.DrawLine(penTimediv, 0, i * ApptDrawing.LineH, 7, i * ApptDrawing.LineH);
                    }
                    else
                    {
                        g.DrawLine(penTimediv, 1, i * ApptDrawing.LineH, 6, i * ApptDrawing.LineH);
                    }
                }
            }
            g.DrawLine(penB, 7, 0, 7, (int)totalHeight);
            #region Highlighting border
            if (isSelected || (!thisIsPinBoard && dataRoww["AptNum"].ToString() == selectedAptNum.ToString()))
            {
                //Left
                g.DrawLine(penO, 8, 1, 8, totalHeight - 2);
                g.DrawLine(penO, 9, 1, 9, totalHeight - 3);
                //Right
                g.DrawLine(penO, totalWidth - 2, 1, totalWidth - 2, totalHeight - 2);
                g.DrawLine(penO, totalWidth - 3, 2, totalWidth - 3, totalHeight - 3);
                //Top
                g.DrawLine(penO, 8, 1, totalWidth - 2, 1);
                g.DrawLine(penO, 8, 2, totalWidth - 3, 2);
                //bottom
                g.DrawLine(penO, 9, totalHeight - 2, totalWidth - 2, totalHeight - 2);
                g.DrawLine(penO, 10, totalHeight - 3, totalWidth - 3, totalHeight - 3);
            }
            #endregion
            #region Main rows
            Point drawLoc  = new Point(9, 0);
            int   elementI = 0;
            while (drawLoc.Y < totalHeight && elementI < apptRows.Count)
            {
                if (apptRows[elementI].ElementAlignment != ApptViewAlignment.Main)
                {
                    elementI++;
                    continue;
                }
                drawLoc = DrawElement(g, elementI, drawLoc, ApptViewStackBehavior.Vertical, ApptViewAlignment.Main, backBrush, dataRoww, apptRows, tableApptFields, tablePatFields, totalWidth, totalHeight, fontSize, isPrinting); //set the drawLoc to a new point, based on space used by element
                elementI++;
            }
            #endregion
            #region UR
            drawLoc  = new Point((int)totalWidth - 1, 0);      //in the UR area, we refer to the upper right corner of each element.
            elementI = 0;
            while (drawLoc.Y < totalHeight && elementI < apptRows.Count)
            {
                if (apptRows[elementI].ElementAlignment != ApptViewAlignment.UR)
                {
                    elementI++;
                    continue;
                }
                drawLoc = DrawElement(g, elementI, drawLoc, apptViewCur.StackBehavUR, ApptViewAlignment.UR, backBrush, dataRoww, apptRows, tableApptFields, tablePatFields, totalWidth, totalHeight, fontSize, isPrinting);
                elementI++;
            }
            #endregion
            #region LR
            drawLoc  = new Point((int)totalWidth - 1, (int)totalHeight - 1); //in the LR area, we refer to the lower right corner of each element.
            elementI = apptRows.Count - 1;                                   //For lower right, draw the list backwards.
            while (drawLoc.Y > 0 && elementI >= 0)
            {
                if (apptRows[elementI].ElementAlignment != ApptViewAlignment.LR)
                {
                    elementI--;
                    continue;
                }
                drawLoc = DrawElement(g, elementI, drawLoc, apptViewCur.StackBehavLR, ApptViewAlignment.LR, backBrush, dataRoww, apptRows, tableApptFields, tablePatFields, totalWidth, totalHeight, fontSize, isPrinting);
                elementI--;
            }
            #endregion
            //Main outline
            if (isPrinting)
            {
                g.DrawRectangle(new Pen(Color.Black), 0, 0, totalWidth, totalHeight);
            }
            else
            {
                g.DrawRectangle(new Pen(Color.Black), 0, 0, totalWidth - 1, totalHeight - 1);
            }
            //broken X
            if (dataRoww["AptStatus"].ToString() == ((int)ApptStatus.Broken).ToString())
            {
                g.DrawLine(new Pen(Color.Black), 8, 1, totalWidth - 1, totalHeight - 1);
                g.DrawLine(new Pen(Color.Black), 8, totalHeight - 1, totalWidth - 1, 1);
            }
            //Dispose of the objects.
            DisposeObjects(penB, penW, penGr, penDG, penO, backBrush);
        }
示例#30
0
        ///<summary>Gets (list)ForCurView, VisOps, VisProvs, and ApptRows.  Also sets TwoRows. Works even if supply -1 to indicate no apptview is selected.</summary>
        public static void GetForCurView(ApptView ApptViewCur)
        {
            ArrayList tempAL     = new ArrayList();
            ArrayList ALprov     = new ArrayList();
            ArrayList ALops      = new ArrayList();
            ArrayList ALelements = new ArrayList();

            if (ApptViewCur.ApptViewNum == 0)
            {
                //MessageBox.Show("apptcategorynum:"+ApptCategories.Cur.ApptCategoryNum.ToString());
                //make visible ops exactly the same as the short ops list (all except hidden)
                for (int i = 0; i < Operatories.ListShort.Length; i++)
                {
                    ALops.Add(i);
                }
                //make visible provs exactly the same as the prov list (all except hidden)
                for (int i = 0; i < Providers.List.Length; i++)
                {
                    ALprov.Add(i);
                }
                //Hard coded elements showing
                ALelements.Add(new ApptViewItem("PatientName", 0, Color.Black));
                ALelements.Add(new ApptViewItem("Lab", 1, Color.DarkRed));
                ALelements.Add(new ApptViewItem("Procs", 2, Color.Black));
                ALelements.Add(new ApptViewItem("Note", 3, Color.Black));
                ContrApptSheet.RowsPerIncr = 1;
            }
            else
            {
                int index;
                for (int i = 0; i < List.Length; i++)
                {
                    if (List[i].ApptViewNum == ApptViewCur.ApptViewNum)
                    {
                        tempAL.Add(List[i]);
                        if (List[i].OpNum > 0)                      //op
                        {
                            index = Operatories.GetOrder(List[i].OpNum);
                            if (index != -1)
                            {
                                ALops.Add(index);
                            }
                        }
                        else if (List[i].ProvNum > 0)                      //prov
                        {
                            index = Providers.GetIndex(List[i].ProvNum);
                            if (index != -1)
                            {
                                ALprov.Add(index);
                            }
                        }
                        else                         //element
                        {
                            ALelements.Add(List[i]);
                        }
                    }
                }
                ContrApptSheet.RowsPerIncr = ApptViewCur.RowsPerIncr;
            }
            ForCurView = new ApptViewItem[tempAL.Count];
            for (int i = 0; i < tempAL.Count; i++)
            {
                ForCurView[i] = (ApptViewItem)tempAL[i];
            }
            VisOps = new int[ALops.Count];
            for (int i = 0; i < ALops.Count; i++)
            {
                VisOps[i] = (int)ALops[i];
            }
            Array.Sort(VisOps);
            VisProvs = new int[ALprov.Count];
            for (int i = 0; i < ALprov.Count; i++)
            {
                VisProvs[i] = (int)ALprov[i];
            }
            Array.Sort(VisProvs);
            ApptRows = new ApptViewItem[ALelements.Count];
            for (int i = 0; i < ALelements.Count; i++)
            {
                ApptRows[i] = (ApptViewItem)ALelements[i];
            }
        }
示例#31
0
 ///<summary>Set default fontSize to 8 unless printing.</summary>
 public static void DrawEntireAppt(Graphics g,DataRow dataRoww,string patternShowing,float totalWidth,float totalHeight,bool isSelected,bool thisIsPinBoard,long selectedAptNum,List<ApptViewItem> apptRows,ApptView apptViewCur,DataTable tableApptFields,DataTable tablePatFields,int fontSize,bool isPrinting)
 {
     Pen penB=new Pen(Color.Black);
     Pen penW=new Pen(Color.White);
     Pen penGr=new Pen(Color.SlateGray);
     Pen penDG=new Pen(Color.DarkSlateGray);
     Pen penO;//provider outline color
     Color backColor;
     Color provColor;
     if(dataRoww["ProvNum"].ToString()!="0" && dataRoww["IsHygiene"].ToString()=="0") {//dentist
         provColor=Providers.GetColor(PIn.Long(dataRoww["ProvNum"].ToString()));
         penO=new Pen(Providers.GetOutlineColor(PIn.Long(dataRoww["ProvNum"].ToString())));
     }
     else if(dataRoww["ProvHyg"].ToString()!="0" && dataRoww["IsHygiene"].ToString()=="1") {//hygienist
         provColor=Providers.GetColor(PIn.Long(dataRoww["ProvHyg"].ToString()));
         penO=new Pen(Providers.GetOutlineColor(PIn.Long(dataRoww["ProvHyg"].ToString())));
     }
     else {//unknown
         provColor=Color.White;
         penO=new Pen(Color.Black);
     }
     if(PIn.Long(dataRoww["AptStatus"].ToString())==(int)ApptStatus.Complete) {
         backColor=DefC.Long[(int)DefCat.AppointmentColors][3].ItemColor;
     }
     else if(PIn.Long(dataRoww["AptStatus"].ToString())==(int)ApptStatus.PtNote) {
         backColor=DefC.Long[(int)DefCat.AppointmentColors][7].ItemColor;
     }
     else if(PIn.Long(dataRoww["AptStatus"].ToString()) == (int)ApptStatus.PtNoteCompleted) {
         backColor = DefC.Long[(int)DefCat.AppointmentColors][10].ItemColor;
     }
     else {
         backColor=provColor;
         //We might want to do something interesting here.
     }
     SolidBrush backBrush=new SolidBrush(backColor);
     g.FillRectangle(backBrush,7,0,totalWidth-7,(int)totalHeight);
     g.FillRectangle(Brushes.White,0,0,7,(int)totalHeight);
     Pen penTimediv=Pens.Silver;
     for(int i=0;i<patternShowing.Length;i++) {//Info.MyApt.Pattern.Length;i++){
         if(patternShowing.Substring(i,1)=="X") {
             if(isPrinting) {
                 g.FillRectangle(new SolidBrush(provColor),0,i*ApptDrawing.LineH,7,ApptDrawing.LineH);
             }
             else {
                 g.FillRectangle(new SolidBrush(provColor),1,i*ApptDrawing.LineH+1,6,ApptDrawing.LineH);
             }
         }
         else {
             //leave empty
         }
         if(Math.IEEERemainder((double)i,(double)ApptDrawing.RowsPerIncr)==0) {//0/1
             if(isPrinting) {
                 g.DrawLine(penTimediv,0,i*ApptDrawing.LineH,7,i*ApptDrawing.LineH);
             }
             else {
                 g.DrawLine(penTimediv,1,i*ApptDrawing.LineH,6,i*ApptDrawing.LineH);
             }
         }
     }
     g.DrawLine(penB,7,0,7,(int)totalHeight);
     #region Highlighting border
     if(isSelected	|| (!thisIsPinBoard && dataRoww["AptNum"].ToString()==selectedAptNum.ToString())) {
         //Left
         g.DrawLine(penO,8,1,8,totalHeight-2);
         g.DrawLine(penO,9,1,9,totalHeight-3);
         //Right
         g.DrawLine(penO,totalWidth-2,1,totalWidth-2,totalHeight-2);
         g.DrawLine(penO,totalWidth-3,2,totalWidth-3,totalHeight-3);
         //Top
         g.DrawLine(penO,8,1,totalWidth-2,1);
         g.DrawLine(penO,8,2,totalWidth-3,2);
         //bottom
         g.DrawLine(penO,9,totalHeight-2,totalWidth-2,totalHeight-2);
         g.DrawLine(penO,10,totalHeight-3,totalWidth-3,totalHeight-3);
     }
     #endregion
     #region Main rows
     Point drawLoc=new Point(9,0);
     int elementI=0;
     while(drawLoc.Y<totalHeight && elementI<apptRows.Count) {
         if(apptRows[elementI].ElementAlignment!=ApptViewAlignment.Main) {
             elementI++;
             continue;
         }
         drawLoc=DrawElement(g,elementI,drawLoc,ApptViewStackBehavior.Vertical,ApptViewAlignment.Main,backBrush,dataRoww,apptRows,tableApptFields,tablePatFields,totalWidth,totalHeight,fontSize,isPrinting);//set the drawLoc to a new point, based on space used by element
         elementI++;
     }
     #endregion
     #region UR
     drawLoc=new Point((int)totalWidth-1,0);//in the UR area, we refer to the upper right corner of each element.
     elementI=0;
     while(drawLoc.Y<totalHeight && elementI<apptRows.Count) {
         if(apptRows[elementI].ElementAlignment!=ApptViewAlignment.UR) {
             elementI++;
             continue;
         }
         drawLoc=DrawElement(g,elementI,drawLoc,apptViewCur.StackBehavUR,ApptViewAlignment.UR,backBrush,dataRoww,apptRows,tableApptFields,tablePatFields,totalWidth,totalHeight,fontSize,isPrinting);
         elementI++;
     }
     #endregion
     #region LR
     drawLoc=new Point((int)totalWidth-1,(int)totalHeight-1);//in the LR area, we refer to the lower right corner of each element.
     elementI=apptRows.Count-1;//For lower right, draw the list backwards.
     while(drawLoc.Y>0 && elementI>=0) {
         if(apptRows[elementI].ElementAlignment!=ApptViewAlignment.LR) {
             elementI--;
             continue;
         }
         drawLoc=DrawElement(g,elementI,drawLoc,apptViewCur.StackBehavLR,ApptViewAlignment.LR,backBrush,dataRoww,apptRows,tableApptFields,tablePatFields,totalWidth,totalHeight,fontSize,isPrinting);
         elementI--;
     }
     #endregion
     //Main outline
     if(isPrinting) {
         g.DrawRectangle(new Pen(Color.Black),0,0,totalWidth,totalHeight);
     }
     else {
         g.DrawRectangle(new Pen(Color.Black),0,0,totalWidth-1,totalHeight-1);
     }
     //broken X
     if(dataRoww["AptStatus"].ToString()==((int)ApptStatus.Broken).ToString()) {
         g.DrawLine(new Pen(Color.Black),8,1,totalWidth-1,totalHeight-1);
         g.DrawLine(new Pen(Color.Black),8,totalHeight-1,totalWidth-1,1);
     }
     //Dispose of the objects.
     DisposeObjects(penB,penW,penGr,penDG,penO,backBrush);
 }
示例#32
0
 ///<summary>Updates one ApptView in the database.</summary>
 internal static void Update(ApptView apptView)
 {
     string command="UPDATE apptview SET "
         +"Description        = '"+POut.String(apptView.Description)+"', "
         +"ItemOrder          =  "+POut.Int   (apptView.ItemOrder)+", "
         +"RowsPerIncr        =  "+POut.Byte  (apptView.RowsPerIncr)+", "
         +"OnlyScheduledProvs =  "+POut.Bool  (apptView.OnlyScheduledProvs)+", "
         +"OnlySchedBeforeTime=  "+POut.Time  (apptView.OnlySchedBeforeTime)+", "
         +"OnlySchedAfterTime =  "+POut.Time  (apptView.OnlySchedAfterTime)+", "
         +"StackBehavUR       =  "+POut.Int   ((int)apptView.StackBehavUR)+", "
         +"StackBehavLR       =  "+POut.Int   ((int)apptView.StackBehavLR)+", "
         +"ClinicNum          =  "+POut.Long  (apptView.ClinicNum)+" "
         +"WHERE ApptViewNum = "+POut.Long(apptView.ApptViewNum);
     Db.NonQ(command);
 }
示例#33
0
 ///<summary>Fills visProvs, visOps, forCurView, apptRows, and rowsPerIncr based on the appointment view passed in and whether it is for the week view or not.  This method uses 'out' variables so that the encompassing logic doesn't ALWAYS affect the global static variables used to draw the appointment views.  We don't want the following logic to affect the global static variables in the case where we are trying to get information needed to filter the waiting room.</summary>
 public static void FillForApptView(bool isWeekly, ApptView apptViewCur, out List <Provider> visProvs, out List <Operatory> visOps,
                                    out List <ApptViewItem> forCurView, out List <ApptViewItem> apptRows, out int rowsPerIncr, bool isFillVisProvs = true)
 {
     forCurView = new List <ApptViewItem>();
     visProvs   = new List <Provider>();
     visOps     = new List <Operatory>();
     apptRows   = new List <ApptViewItem>();
     //If there are no appointment views set up (therefore, none selected), then use a hard-coded default view.
     if (ApptViews.IsNoneView(apptViewCur))
     {
         //make visible ops exactly the same as the short ops list (all except hidden)
         visOps.AddRange(
             Operatories.GetWhere(x => !PrefC.HasClinicsEnabled ||                  //if clinics disabled
                                  Clinics.ClinicNum == 0 ||              //or if program level ClinicNum set to Headquarters
                                  x.ClinicNum == Clinics.ClinicNum                 //or this is the program level ClinicNum
                                  , true)
             );
         if (isFillVisProvs)
         {
             if (PrefC.HasClinicsEnabled)
             {
                 foreach (Operatory op in visOps)
                 {
                     Provider provDent = Providers.GetProv(op.ProvDentist);
                     Provider provHyg  = Providers.GetProv(op.ProvHygienist);
                     if (provDent != null)
                     {
                         visProvs.Add(provDent);
                     }
                     if (provHyg != null)
                     {
                         visProvs.Add(provHyg);
                     }
                 }
             }
             else
             {
                 //make visible provs exactly the same as the prov list (all except hidden)
                 visProvs.AddRange(Providers.GetDeepCopy(true));
             }
         }
         //Hard coded elements showing
         apptRows.Add(new ApptViewItem("PatientName", 0, Color.Black));
         apptRows.Add(new ApptViewItem("ASAP", 1, Color.DarkRed));
         apptRows.Add(new ApptViewItem("MedUrgNote", 2, Color.DarkRed));
         apptRows.Add(new ApptViewItem("PremedFlag", 3, Color.DarkRed));
         apptRows.Add(new ApptViewItem("Lab", 4, Color.DarkRed));
         apptRows.Add(new ApptViewItem("Procs", 5, Color.Black));
         apptRows.Add(new ApptViewItem("Note", 6, Color.Black));
         rowsPerIncr = 1;
     }
     //An appointment view is selected, so add provs and ops from the view to our lists of indexes.
     else
     {
         List <ApptViewItem> listApptViewItems = ApptViewItems.GetWhere(x => x.ApptViewNum == apptViewCur.ApptViewNum);
         for (int i = 0; i < listApptViewItems.Count; i++)
         {
             forCurView.Add(listApptViewItems[i]);
             if (listApptViewItems[i].OpNum > 0)                   //op
             {
                 if (apptViewCur.OnlyScheduledProvs && !isWeekly)
                 {
                     continue;                            //handled below in AddOpsForScheduledProvs
                 }
                 Operatory op = Operatories.GetFirstOrDefault(x => x.OperatoryNum == listApptViewItems[i].OpNum, true);
                 if (op != null)
                 {
                     visOps.Add(op);
                 }
             }
             else if (listApptViewItems[i].ProvNum > 0)                   //prov
             {
                 if (!isFillVisProvs)
                 {
                     continue;
                 }
                 Provider prov = Providers.GetFirstOrDefault(x => x.ProvNum == listApptViewItems[i].ProvNum, true);
                 if (prov != null)
                 {
                     visProvs.Add(prov);
                 }
             }
             else                      //element or apptfielddef
             {
                 apptRows.Add(listApptViewItems[i]);
             }
         }
         rowsPerIncr = apptViewCur.RowsPerIncr;
     }
     //Remove any duplicates before return.
     visOps = visOps.GroupBy(x => x.OperatoryNum).Select(x => x.First()).ToList();
     if (isFillVisProvs)
     {
         visProvs = visProvs.GroupBy(x => x.ProvNum).Select(x => x.First()).ToList();
     }
 }
示例#34
0
 ///<summary>Updates one ApptView in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
 internal static void Update(ApptView apptView,ApptView oldApptView)
 {
     string command="";
     if(apptView.Description != oldApptView.Description) {
         if(command!=""){ command+=",";}
         command+="Description = '"+POut.String(apptView.Description)+"'";
     }
     if(apptView.ItemOrder != oldApptView.ItemOrder) {
         if(command!=""){ command+=",";}
         command+="ItemOrder = "+POut.Int(apptView.ItemOrder)+"";
     }
     if(apptView.RowsPerIncr != oldApptView.RowsPerIncr) {
         if(command!=""){ command+=",";}
         command+="RowsPerIncr = "+POut.Byte(apptView.RowsPerIncr)+"";
     }
     if(apptView.OnlyScheduledProvs != oldApptView.OnlyScheduledProvs) {
         if(command!=""){ command+=",";}
         command+="OnlyScheduledProvs = "+POut.Bool(apptView.OnlyScheduledProvs)+"";
     }
     if(apptView.OnlySchedBeforeTime != oldApptView.OnlySchedBeforeTime) {
         if(command!=""){ command+=",";}
         command+="OnlySchedBeforeTime = "+POut.Time  (apptView.OnlySchedBeforeTime)+"";
     }
     if(apptView.OnlySchedAfterTime != oldApptView.OnlySchedAfterTime) {
         if(command!=""){ command+=",";}
         command+="OnlySchedAfterTime = "+POut.Time  (apptView.OnlySchedAfterTime)+"";
     }
     if(apptView.StackBehavUR != oldApptView.StackBehavUR) {
         if(command!=""){ command+=",";}
         command+="StackBehavUR = "+POut.Int   ((int)apptView.StackBehavUR)+"";
     }
     if(apptView.StackBehavLR != oldApptView.StackBehavLR) {
         if(command!=""){ command+=",";}
         command+="StackBehavLR = "+POut.Int   ((int)apptView.StackBehavLR)+"";
     }
     if(apptView.ClinicNum != oldApptView.ClinicNum) {
         if(command!=""){ command+=",";}
         command+="ClinicNum = "+POut.Long(apptView.ClinicNum)+"";
     }
     if(command==""){
         return;
     }
     command="UPDATE apptview SET "+command
         +" WHERE ApptViewNum = "+POut.Long(apptView.ApptViewNum);
     Db.NonQ(command);
 }
示例#35
0
        ///<summary>Updates one ApptView in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(ApptView apptView, ApptView oldApptView)
        {
            string command = "";

            if (apptView.Description != oldApptView.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(apptView.Description) + "'";
            }
            if (apptView.ItemOrder != oldApptView.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(apptView.ItemOrder) + "";
            }
            if (apptView.RowsPerIncr != oldApptView.RowsPerIncr)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RowsPerIncr = " + POut.Byte(apptView.RowsPerIncr) + "";
            }
            if (apptView.OnlyScheduledProvs != oldApptView.OnlyScheduledProvs)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OnlyScheduledProvs = " + POut.Bool(apptView.OnlyScheduledProvs) + "";
            }
            if (apptView.OnlySchedBeforeTime != oldApptView.OnlySchedBeforeTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OnlySchedBeforeTime = " + POut.Time(apptView.OnlySchedBeforeTime) + "";
            }
            if (apptView.OnlySchedAfterTime != oldApptView.OnlySchedAfterTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OnlySchedAfterTime = " + POut.Time(apptView.OnlySchedAfterTime) + "";
            }
            if (apptView.StackBehavUR != oldApptView.StackBehavUR)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StackBehavUR = " + POut.Int((int)apptView.StackBehavUR) + "";
            }
            if (apptView.StackBehavLR != oldApptView.StackBehavLR)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StackBehavLR = " + POut.Int((int)apptView.StackBehavLR) + "";
            }
            if (apptView.ClinicNum != oldApptView.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(apptView.ClinicNum) + "";
            }
            if (apptView.ApptTimeScrollStart != oldApptView.ApptTimeScrollStart)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ApptTimeScrollStart = " + POut.Time(apptView.ApptTimeScrollStart) + "";
            }
            if (apptView.IsScrollStartDynamic != oldApptView.IsScrollStartDynamic)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsScrollStartDynamic = " + POut.Bool(apptView.IsScrollStartDynamic) + "";
            }
            if (apptView.IsApptBubblesDisabled != oldApptView.IsApptBubblesDisabled)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsApptBubblesDisabled = " + POut.Bool(apptView.IsApptBubblesDisabled) + "";
            }
            if (apptView.WidthOpMinimum != oldApptView.WidthOpMinimum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "WidthOpMinimum = " + POut.Int(apptView.WidthOpMinimum) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE apptview SET " + command
                      + " WHERE ApptViewNum = " + POut.Long(apptView.ApptViewNum);
            Db.NonQ(command);
            return(true);
        }
示例#36
0
 ///<summary>Inserts one ApptView into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ApptView apptView)
 {
     return(InsertNoCache(apptView, false));
 }