///<summary></summary> public static long Insert(ApptViewItem apptViewItem){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { apptViewItem.ApptViewItemNum=Meth.GetLong(MethodBase.GetCurrentMethod(),apptViewItem); return apptViewItem.ApptViewItemNum; } return Crud.ApptViewItemCrud.Insert(apptViewItem); }
///<summary></summary> public static void Update(ApptViewItem apptViewItem) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),apptViewItem); return; } Crud.ApptViewItemCrud.Update(apptViewItem); }
///<summary></summary> public static void Delete(ApptViewItem apptViewItem) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),apptViewItem); return; } string command="DELETE from apptviewitem WHERE ApptViewItemNum = '" +POut.Long(apptViewItem.ApptViewItemNum)+"'"; Db.NonQ(command); }
///<summary></summary> public static long Insert(ApptViewItem apptViewItem) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { apptViewItem.ApptViewItemNum = Meth.GetLong(MethodBase.GetCurrentMethod(), apptViewItem); return(apptViewItem.ApptViewItemNum); } return(Crud.ApptViewItemCrud.Insert(apptViewItem)); }
///<summary></summary> public static void Update(ApptViewItem apptViewItem) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), apptViewItem); return; } Crud.ApptViewItemCrud.Update(apptViewItem); }
///<summary></summary> public static void Delete(ApptViewItem apptViewItem) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), apptViewItem); return; } string command = "DELETE from apptviewitem WHERE ApptViewItemNum = '" + POut.Long(apptViewItem.ApptViewItemNum) + "'"; Db.NonQ(command); }
private void butRight_Click(object sender, System.EventArgs e) { if(gridAvailable.GetSelectedIndex()!=-1) { //the item order is not used until saving to db. ApptViewItem item=new ApptViewItem(elementsAll[displayedAvailable[gridAvailable.GetSelectedIndex()]],0,Color.Black); if(gridMain.SelectedIndices.Length==1) {//insert int newIdx=displayedElementsAll.IndexOf(displayedElementsMain[gridMain.GetSelectedIndex()]); displayedElementsAll.Insert(newIdx,item); } else {//add to end displayedElementsAll.Add(item); } FillElements(); for(int i=0;i<displayedElementsMain.Count;i++) {//the new item will always show first in the main list. if(displayedElementsMain[i]==item) { gridMain.SetSelected(i,true);//reselect the item break; } } } else if(gridApptFieldDefs.GetSelectedIndex()!=-1) { ApptViewItem item=new ApptViewItem(); item.ElementColor=Color.Black; item.ApptFieldDefNum=displayedAvailableApptFieldDefs[gridApptFieldDefs.GetSelectedIndex()]; if(gridMain.SelectedIndices.Length==1) {//insert int newIdx=displayedElementsAll.IndexOf(displayedElementsMain[gridMain.GetSelectedIndex()]); displayedElementsAll.Insert(newIdx,item); } else {//add to end displayedElementsAll.Add(item); } FillElements(); for(int i=0;i<displayedElementsMain.Count;i++) {//the new item will always show first in the main list. if(displayedElementsMain[i]==item) { gridMain.SetSelected(i,true);//reselect the item break; } } } else if(gridPatFieldDefs.GetSelectedIndex()!=-1) { ApptViewItem item=new ApptViewItem(); item.ElementColor=Color.Black; item.PatFieldDefNum=displayedAvailablePatFieldDefs[gridPatFieldDefs.GetSelectedIndex()]; if(gridMain.SelectedIndices.Length==1) {//insert int newIdx=displayedElementsAll.IndexOf(displayedElementsMain[gridMain.GetSelectedIndex()]); displayedElementsAll.Insert(newIdx,item); } else {//add to end displayedElementsAll.Add(item); } FillElements(); for(int i=0;i<displayedElementsMain.Count;i++) {//the new item will always show first in the main list. if(displayedElementsMain[i]==item) { gridMain.SetSelected(i,true);//reselect the item break; } } } }
private void butOK_Click(object sender, System.EventArgs e) { if(listProv.SelectedIndices.Count==0){ MsgBox.Show(this,"At least one provider must be selected."); return; } if(listOps.SelectedIndices.Count==0){// && !checkOnlyScheduledProvs.Checked) { MsgBox.Show(this,"At least one operatory must be selected."); return; } if(textDescription.Text==""){ MessageBox.Show(Lan.g(this,"A description must be entered.")); return; } if(displayedElementsMain.Count==0){ MessageBox.Show(Lan.g(this,"At least one row type must be displayed.")); return; } DateTime timeBefore=new DateTime();//only the time portion will be used. if(checkOnlyScheduledProvs.Checked && textBeforeTime.Text!="") { try { timeBefore=DateTime.Parse(textBeforeTime.Text); } catch { MsgBox.Show(this,"Time before invalid."); return; } } DateTime timeAfter=new DateTime(); if(checkOnlyScheduledProvs.Checked && textAfterTime.Text!="") { try { timeAfter=DateTime.Parse(textAfterTime.Text); } catch { MsgBox.Show(this,"Time after invalid."); return; } } ApptViewItems.DeleteAllForView(ApptViewCur);//start with a clean slate ApptViewItem item; for(int i=0;i<OperatoryC.ListShort.Count;i++){ if(listOps.SelectedIndices.Contains(i)){ item=new ApptViewItem(); item.ApptViewNum=ApptViewCur.ApptViewNum; item.OpNum=OperatoryC.ListShort[i].OperatoryNum; ApptViewItems.Insert(item); } } for(int i=0;i<ProviderC.ListShort.Count;i++){ if(listProv.SelectedIndices.Contains(i)){ item=new ApptViewItem(); item.ApptViewNum=ApptViewCur.ApptViewNum; item.ProvNum=ProviderC.ListShort[i].ProvNum; ApptViewItems.Insert(item); } } ApptViewCur.StackBehavUR=(ApptViewStackBehavior)listStackUR.SelectedIndex; ApptViewCur.StackBehavLR=(ApptViewStackBehavior)listStackLR.SelectedIndex; for(int i=0;i<displayedElementsMain.Count;i++){ item=displayedElementsMain[i]; item.ApptViewNum=ApptViewCur.ApptViewNum; //elementDesc, elementColor, and Alignment already handled. item.ElementOrder=(byte)i; ApptViewItems.Insert(item); } for(int i=0;i<displayedElementsUR.Count;i++) { item=displayedElementsUR[i]; item.ApptViewNum=ApptViewCur.ApptViewNum; item.ElementOrder=(byte)i; ApptViewItems.Insert(item); } for(int i=0;i<displayedElementsLR.Count;i++) { item=displayedElementsLR[i]; item.ApptViewNum=ApptViewCur.ApptViewNum; item.ElementOrder=(byte)i; ApptViewItems.Insert(item); } ApptViewCur.Description=textDescription.Text; ApptViewCur.RowsPerIncr=PIn.Byte(textRowsPerIncr.Text); ApptViewCur.OnlyScheduledProvs=checkOnlyScheduledProvs.Checked; ApptViewCur.OnlySchedBeforeTime=timeBefore.TimeOfDay; ApptViewCur.OnlySchedAfterTime=timeAfter.TimeOfDay; ApptViewCur.ClinicNum=0;//Default clinics to "All" if(checkOnlyScheduledProvs.Checked && comboClinic.SelectedIndex>0) { ApptViewCur.ClinicNum=Clinics.List[comboClinic.SelectedIndex-1].ClinicNum; } ApptViews.Update(ApptViewCur);//same whether isnew or not DialogResult=DialogResult.OK; }
///<summary>When we know what item we want to select, but we don't know which of the three areas it might now be in.</summary> private void ReselectItem(ApptViewItem item) { //another way of doing this would be to test which area it was in first, but that wouldn't make the code more compact. for(int i=0;i<displayedElementsMain.Count;i++) { if(displayedElementsMain[i]==item) { gridMain.SetSelected(i,true); break; } } for(int i=0;i<displayedElementsUR.Count;i++) { if(displayedElementsUR[i]==item) { gridUR.SetSelected(i,true); break; } } for(int i=0;i<displayedElementsLR.Count;i++) { if(displayedElementsLR[i]==item) { gridLR.SetSelected(i,true); break; } } }
private void butOK_Click(object sender, System.EventArgs e) { if(listProv.SelectedIndices.Count==0){ MsgBox.Show(this,"At least one provider must be selected."); return; } if(listOps.SelectedIndices.Count==0){// && !checkOnlyScheduledProvs.Checked) { MsgBox.Show(this,"At least one operatory must be selected."); return; } if(textDescription.Text==""){ MessageBox.Show(Lan.g(this,"A description must be entered.")); return; } if(displayedElementsMain.Count==0){ MessageBox.Show(Lan.g(this,"At least one row type must be displayed.")); return; } DateTime timeBefore=new DateTime();//only the time portion will be used. if(checkOnlyScheduledProvs.Checked && textBeforeTime.Text!="") { try { timeBefore=DateTime.Parse(textBeforeTime.Text); } catch { MsgBox.Show(this,"Time before invalid."); return; } } DateTime timeAfter=new DateTime(); if(checkOnlyScheduledProvs.Checked && textAfterTime.Text!="") { try { timeAfter=DateTime.Parse(textAfterTime.Text); } catch { MsgBox.Show(this,"Time after invalid."); return; } } ApptViewItems.DeleteAllForView(ApptViewCur);//start with a clean slate ApptViewItem item; for(int i=0;i<_listOpNums.Count;i++){ if(listOps.SelectedIndices.Contains(i)){ item=new ApptViewItem(); item.ApptViewNum=ApptViewCur.ApptViewNum; item.OpNum=_listOpNums[i]; ApptViewItems.Insert(item); } } for(int i=0;i<ProviderC.ListShort.Count;i++){ if(listProv.SelectedIndices.Contains(i)){ item=new ApptViewItem(); item.ApptViewNum=ApptViewCur.ApptViewNum; item.ProvNum=ProviderC.ListShort[i].ProvNum; ApptViewItems.Insert(item); } } ApptViewCur.StackBehavUR=(ApptViewStackBehavior)listStackUR.SelectedIndex; ApptViewCur.StackBehavLR=(ApptViewStackBehavior)listStackLR.SelectedIndex; for(int i=0;i<displayedElementsMain.Count;i++){ item=displayedElementsMain[i]; item.ApptViewNum=ApptViewCur.ApptViewNum; //elementDesc, elementColor, and Alignment already handled. item.ElementOrder=(byte)i; ApptViewItems.Insert(item); } for(int i=0;i<displayedElementsUR.Count;i++) { item=displayedElementsUR[i]; item.ApptViewNum=ApptViewCur.ApptViewNum; item.ElementOrder=(byte)i; ApptViewItems.Insert(item); } for(int i=0;i<displayedElementsLR.Count;i++) { item=displayedElementsLR[i]; item.ApptViewNum=ApptViewCur.ApptViewNum; item.ElementOrder=(byte)i; ApptViewItems.Insert(item); } ApptViewCur.Description=textDescription.Text; ApptViewCur.RowsPerIncr=PIn.Byte(textRowsPerIncr.Text); ApptViewCur.OnlyScheduledProvs=checkOnlyScheduledProvs.Checked; ApptViewCur.OnlySchedBeforeTime=timeBefore.TimeOfDay; ApptViewCur.OnlySchedAfterTime=timeAfter.TimeOfDay; ApptViewCur.ClinicNum=0;//Default is all clinics if(!PrefC.GetBool(PrefName.EasyNoClinics)) { //_listUserClinicNums will contain only a 0 if the clinics show feature is disabled. //If the user is not restricted to a clinic, the list will contain 0 in the first position since comboClinic will contain 'All' as the first option. //Restricted users (Security.CurUser.ClinicsIsRestricted=true && Security.CurUser.ClinicNum>0) won't have access to the unassigned views (AssignedClinic=0) ApptViewCur.ClinicNum=_listUserClinicNums[comboClinic.SelectedIndex]; } ApptViews.Update(ApptViewCur);//same whether isnew or not DialogResult=DialogResult.OK; }