private void butOK_Click(object sender, EventArgs e)
 {
     if (textXPos.errorProvider1.GetError(textXPos) != "" ||
         textYPos.errorProvider1.GetError(textYPos) != "" ||
         textWidth.errorProvider1.GetError(textWidth) != "" ||
         textHeight.errorProvider1.GetError(textHeight) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (comboImageCategory.SelectedIndex < 0)
     {
         MsgBox.Show(this, "Please select an image category first.");
         return;
     }
     SheetFieldDefCur.FieldName = _listImageCatDefs[comboImageCategory.SelectedIndex].DefNum.ToString();
     SheetFieldDefCur.XPos      = PIn.Int(textXPos.Text);
     SheetFieldDefCur.YPos      = PIn.Int(textYPos.Text);
     SheetFieldDefCur.Width     = PIn.Int(textWidth.Text);
     SheetFieldDefCur.Height    = PIn.Int(textHeight.Text);
     //don't save to database here.
     DialogResult = DialogResult.OK;
 }
Beispiel #2
0
 private void butOK_Click(object sender, EventArgs e)
 {
     _siteLink.OctetStart = PIn.Int(textOctet1.Text, false)
                            + "." + PIn.Int(textOctet2.Text, false)
                            + "." + PIn.Int(textOctet3.Text, false)
                            + ".";//End with a period so that the matching algorithm in other parts of the program are accurate.
     if (comboTriageCoordinator.SelectedIndex > -1)
     {
         _siteLink.EmployeeNum = ((ODBoxItem <Employee>)comboTriageCoordinator.SelectedItem).Tag.EmployeeNum;
     }
     _siteLink.SiteColor  = panelSiteColor.BackColor;
     _siteLink.ForeColor  = panelForeColor.BackColor;
     _siteLink.InnerColor = panelInnerColor.BackColor;
     _siteLink.OuterColor = panelOuterColor.BackColor;
     //There is no such thing as an empty grid of connection overrides (we show the defaults at minimum).
     //The only explanation for an empty grid is if the defaults could not be loaded correctly so do not save ConnectionSettingsHQOverrides.
     if (gridConnections.ListGridRows.Count > 0)
     {
         _siteLink.ConnectionSettingsHQOverrides = GetConnectionOverrides();
     }
     SiteLinks.Upsert(_siteLink);
     DialogResult = DialogResult.OK;
 }
Beispiel #3
0
 ///<summary>Surround with try-catch.  Attempts to take the data on the form and set the values of RefAttachCur.</summary>
 private void DataToCur()
 {
     if (textOrder.errorProvider1.GetError(textOrder) != "" ||
         textRefDate.errorProvider1.GetError(textRefDate) != "" ||
         textDateProcCompleted.errorProvider1.GetError(textDateProcCompleted) != "")
     {
         throw new ApplicationException(Lan.g(this, "Please fix data entry errors first."));
     }
     if (listFromTo.SelectedIndex == 0)
     {
         RefAttachCur.IsFrom = true;
     }
     else
     {
         RefAttachCur.IsFrom = false;
     }
     RefAttachCur.RefDate            = PIn.Date(textRefDate.Text);
     RefAttachCur.ItemOrder          = PIn.Int(textOrder.Text);
     RefAttachCur.RefToStatus        = (ReferralToStatus)comboRefToStatus.SelectedIndex;
     RefAttachCur.Note               = textNote.Text;
     RefAttachCur.IsTransitionOfCare = checkIsTransitionOfCare.Checked;
     RefAttachCur.DateProcComplete   = PIn.Date(textDateProcCompleted.Text);
 }
Beispiel #4
0
 protected override void OnOk()
 {
     if (!ArePosAndSizeValid())
     {
         return;
     }
     SheetFieldDefCur.TabOrder       = PIn.Int(textTabOrder.Text);
     SheetFieldDefCur.ReportableName = PIn.String(textReportable.Text);
     SheetFieldDefCur.UiLabelMobile  = textUiLabelMobile.Text;
     //ComboBox FieldValue will be:  selectedItem;all|possible|options|here|with|selectedItem|also
     //This is so we don't have to change the database schema for combo boxes.
     SheetFieldDefCur.FieldValue = _selectedOption + ";";        //NOTE: ; can change to whatever.  Maybe {?  Maybe something else not used often like @?
     for (int i = 0; i < listboxComboOptions.Items.Count; i++)
     {
         if (i > 0)
         {
             SheetFieldDefCur.FieldValue += "|";
         }
         SheetFieldDefCur.FieldValue += listboxComboOptions.Items[i].ToString();
     }
     SheetFieldDefCur.IsNew = false;
     DialogResult           = DialogResult.OK;
 }
Beispiel #5
0
        private static bool AgeComparison(AutomationCondition autoCond, long patNum)
        {
            Patient pat = Patients.GetPat(patNum);
            int     age = pat.Age;

            switch (autoCond.Comparison)
            {
            case AutoCondComparison.Equals:
                return(age == PIn.Int(autoCond.CompareString));

            case AutoCondComparison.Contains:
                return(age.ToString().Contains(autoCond.CompareString));

            case AutoCondComparison.GreaterThan:
                return(age > PIn.Int(autoCond.CompareString));

            case AutoCondComparison.LessThan:
                return(age < PIn.Int(autoCond.CompareString));

            default:
                return(false);
            }
        }
Beispiel #6
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDaysActual.errorProvider1.GetError(textDaysActual) != "" ||
         textDaysPublished.errorProvider1.GetError(textDaysPublished) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (PIn.Long(textDaysActual.Text) == 0)
     {
         MsgBox.Show(this, "Actual Days cannot be zero.");
         return;
     }
     if (textDescription.Text == "")
     {
         MsgBox.Show(this, "Please enter a description.");
         return;
     }
     LabTurnaroundCur.Description   = textDescription.Text;
     LabTurnaroundCur.DaysPublished = PIn.Int(textDaysPublished.Text);
     LabTurnaroundCur.DaysActual    = PIn.Int(textDaysActual.Text);
     DialogResult = DialogResult.OK;
 }
        private void FillFields()
        {
            long clinicNum = 0;

            if (PrefC.HasClinicsEnabled)
            {
                clinicNum = _listUserClinicNums[comboClinic.SelectedIndex];
            }
            textUsername.Text = ProgramProperties.GetPropValFromList(_listProgProps, "Username", clinicNum);
            textPassword.Text = ProgramProperties.GetPropValFromList(_listProgProps, "Password", clinicNum);
            string payTypeDefNum    = ProgramProperties.GetPropValFromList(_listProgProps, "PaymentType", clinicNum);
            string processingMethod = ProgramProperties.GetPropValFromList(_listProgProps, PayConnect.ProgramProperties.DefaultProcessingMethod, clinicNum);

            checkTerminal.Checked       = PIn.Bool(ProgramProperties.GetPropValFromList(_listProgProps, "TerminalProcessingEnabled", clinicNum));
            checkForceRecurring.Checked = PIn.Bool(ProgramProperties.GetPropValFromList(_listProgProps,
                                                                                        PayConnect.ProgramProperties.PayConnectForceRecurringCharge, clinicNum));
            //Patient portal payments with PayConnect are currently not supported, checkWebPayEnabled is never visible, so always set to 0,
            //but we'll leave this here for future functionality
            //checkWebPayEnabled.Checked=PIn.Bool(ProgramProperties.GetPropValFromList(_listProgProps,"IsOnlinePaymentsEnabled",clinicNum));
            comboPaymentType.Items.Clear();
            _listPaymentTypeDefs = Defs.GetDefsForCategory(DefCat.PaymentTypes, true);
            for (int i = 0; i < _listPaymentTypeDefs.Count; i++)
            {
                comboPaymentType.Items.Add(_listPaymentTypeDefs[i].ItemName);
                if (_listPaymentTypeDefs[i].DefNum.ToString() == payTypeDefNum)
                {
                    comboPaymentType.SelectedIndex = i;
                }
            }
            comboDefaultProcessing.Items.Clear();
            comboDefaultProcessing.Items.Add(Lan.g(this, PayConnectProcessingMethod.WebService.GetDescription()));
            comboDefaultProcessing.Items.Add(Lan.g(this, PayConnectProcessingMethod.Terminal.GetDescription()));
            if (processingMethod == "0" || processingMethod == "1")
            {
                comboDefaultProcessing.SelectedIndex = PIn.Int(processingMethod);
            }
        }
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textPaperCopies.errorProvider1.GetError(textPaperCopies) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (checkEmailPat.Checked && textEmailPat.Text == "")
     {
         MsgBox.Show(this, "Please enter an email address or uncheck the email box.");
         return;
     }
     if (Email2Visible)
     {
         if (checkEmail2.Checked && textEmail2.Text == "")
         {
             MsgBox.Show(this, "Please enter an email address or uncheck the email box.");
             return;
         }
     }
     if (PIn.Long(textPaperCopies.Text) == 0 &&
         !checkEmailPat.Checked &&
         !checkEmail2.Checked)
     {
         MsgBox.Show(this, "There are no output methods selected.");
         return;
     }
     PaperCopies          = PIn.Int(textPaperCopies.Text);
     EmailPatOrLab        = checkEmailPat.Checked;
     EmailPatOrLabAddress = textEmailPat.Text;
     if (Email2Visible)
     {
         Email2        = checkEmail2.Checked;
         Email2Address = textEmail2.Text;
     }
     DialogResult = DialogResult.OK;
 }
Beispiel #9
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textDescription.Text == "")
     {
         MsgBox.Show(this, "Description cannot be blank.");
         return;
     }
     if (textAbbr.Text == "")
     {
         MsgBox.Show(this, "Abbrevation cannot be blank.");
         return;
     }
     if (textMedIDLength.errorProvider1.GetError(textMedIDLength) != "")
     {
         MsgBox.Show(this, "Medicaid ID length is invalid.");
         return;
     }
     _stateAbbrCur.Description = textDescription.Text;
     _stateAbbrCur.Abbr        = textAbbr.Text;
     if (PrefC.GetBool(PrefName.EnforceMedicaidIDLength))
     {
         _stateAbbrCur.MedicaidIDLength = 0;
         if (textMedIDLength.Text != "")
         {
             _stateAbbrCur.MedicaidIDLength = PIn.Int(textMedIDLength.Text);
         }
     }
     if (_stateAbbrCur.IsNew)
     {
         StateAbbrs.Insert(_stateAbbrCur);
     }
     else
     {
         StateAbbrs.Update(_stateAbbrCur);
     }
     DialogResult = DialogResult.OK;
 }
Beispiel #10
0
        private void butAddDay_Click(object sender, EventArgs e)
        {
            List <string> listDaysOfMonth = new List <string>();

            for (int i = 1; i <= 31; i++)
            {
                listDaysOfMonth.Add(i.ToString());
            }
            InputBox input = new InputBox(new List <InputBoxParam> {
                new InputBoxParam {
                    ParamType       = InputBoxType.ComboSelect,
                    LabelText       = Lans.g(this, "Day of month"),
                    ListSelections  = listDaysOfMonth,
                    ParamSize       = new Size(75, 21),
                    HorizontalAlign = HorizontalAlignment.Center,
                }
            });

            input.Text = Lans.g(this, "Select Day");
            input.ShowDialog();
            if (input.DialogResult != DialogResult.OK)
            {
                return;
            }
            int        selectedDay = input.SelectedIndex + 1;
            List <int> currentDays = textDayOfMonth.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                     .Select(x => PIn.Int(x.Trim())).ToList();

            if (currentDays.Contains(selectedDay))
            {
                MsgBox.Show(this, "The selected date has already been added.");
                return;
            }
            currentDays.Add(selectedDay);
            currentDays.Sort();
            textDayOfMonth.Text = string.Join(", ", currentDays);
        }
Beispiel #11
0
 private void SaveAndClose()
 {
     if (textXPos.errorProvider1.GetError(textXPos) != "" ||
         textYPos.errorProvider1.GetError(textYPos) != "" ||
         textWidth.errorProvider1.GetError(textWidth) != "" ||
         textHeight.errorProvider1.GetError(textHeight) != "" ||
         textTabOrder.errorProvider1.GetError(textTabOrder) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (listFields.SelectedIndex == -1)
     {
         MsgBox.Show(this, "Please select a field name first.");
         return;
     }
     SheetFieldDefCur.FieldName        = AvailFields[listFields.SelectedIndex].FieldName;
     SheetFieldDefCur.XPos             = PIn.Int(textXPos.Text);
     SheetFieldDefCur.YPos             = PIn.Int(textYPos.Text);
     SheetFieldDefCur.Width            = PIn.Int(textWidth.Text);
     SheetFieldDefCur.Height           = PIn.Int(textHeight.Text);
     SheetFieldDefCur.RadioButtonGroup = "";
     SheetFieldDefCur.RadioButtonValue = "";
     if (groupRadio.Visible && listRadio.SelectedIndex >= 0)
     {
         SheetFieldDefCur.RadioButtonValue = radioButtonValues[listRadio.SelectedIndex];
     }
     else if (groupRadioMisc.Visible)
     {
         SheetFieldDefCur.RadioButtonGroup = textRadioGroupName.Text;
     }
     SheetFieldDefCur.IsRequired = checkRequired.Checked;
     SheetFieldDefCur.TabOrder   = PIn.Int(textTabOrder.Text);
     //don't save to database here.
     DialogResult = DialogResult.OK;
 }
Beispiel #12
0
        ///<summary>Empty string is considered valid.</summary>
        public static bool ValidateTime(string time)
        {
            string militaryTime = time;

            if (militaryTime == "")
            {
                return(true);
            }
            if (militaryTime.Length < 4)
            {
                militaryTime = militaryTime.PadLeft(4, '0');
            }
            //Test if user typed in military time. Ex: 0830 or 1536
            try {
                int hour   = PIn.Int(militaryTime.Substring(0, 2));
                int minute = PIn.Int(militaryTime.Substring(2, 2));
                if (hour > 23)
                {
                    return(false);
                }
                if (minute > 59)
                {
                    return(false);
                }
                return(true);
            }
            catch { }
            //Test typical DateTime format. Ex: 1:00 PM
            try {
                DateTime.Parse(time);
                return(true);
            }
            catch {
                return(false);
            }
        }
Beispiel #13
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textXPos.errorProvider1.GetError(textXPos) != "" ||
         textYPos.errorProvider1.GetError(textYPos) != "" ||
         textWidth.errorProvider1.GetError(textWidth) != "" ||
         textHeight.errorProvider1.GetError(textHeight) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (comboFieldName.Text == "")
     {
         MsgBox.Show(this, "Please enter a file name first.");
         return;
     }
     try {            //catch valid files that are not valid images.
         Image.FromFile(textFullPath.Text);
     }
     catch {
         MsgBox.Show(this, "Not a valid image type.");
         return;
     }
     if (!File.Exists(textFullPath.Text) &&
         comboFieldName.Text != "Patient Info.gif")
     {
         MsgBox.Show(this, "Image file does not exist.");
         return;
     }
     SheetFieldDefCur.FieldName = comboFieldName.Text;
     SheetFieldDefCur.XPos      = PIn.Int(textXPos.Text);
     SheetFieldDefCur.YPos      = PIn.Int(textYPos.Text);
     SheetFieldDefCur.Width     = PIn.Int(textWidth.Text);
     SheetFieldDefCur.Height    = PIn.Int(textHeight.Text);
     //don't save to database here.
     DialogResult = DialogResult.OK;
 }
        private void UpdateDoNotSendWithinLabel()
        {
            string daysHoursTxt = "";
            int    daysWithin   = PIn.Int(textDaysWithin.Text, false);
            int    hoursWithin  = PIn.Int(textHoursWithin.Text, false);

            if (!textDaysWithin.IsValid || !textHoursWithin.IsValid ||
                (daysWithin == 0 && hoursWithin == 0))
            {
                daysHoursTxt = "_____________";
            }
            else
            {
                if (daysWithin == 1)
                {
                    daysHoursTxt += daysWithin + " " + Lans.g(this, "day");
                }
                else if (daysWithin > 1)
                {
                    daysHoursTxt += daysWithin + " " + Lans.g(this, "days");
                }
                if (daysWithin > 0 && hoursWithin > 0)
                {
                    daysHoursTxt += " ";
                }
                if (hoursWithin == 1)
                {
                    daysHoursTxt += hoursWithin + " " + Lans.g(this, "hour");
                }
                else if (hoursWithin > 1)
                {
                    daysHoursTxt += hoursWithin + " " + Lans.g(this, "hours");
                }
            }
            labelDoNotSendWithin.Text = Lans.g(this, "Do not send within") + " " + daysHoursTxt + " " + Lans.g(this, "of appointment");
        }
Beispiel #15
0
 ///<summary>Used to update subtotal when qty or price are edited.</summary>
 private void calculateSubtotalHelper()
 {
     try {
         gridItems.Rows[gridItems.SelectedCell.Y].ColorBackG = Color.White;
         if (gridItems.SelectedCell.X == 2)               //Qty
         {
             int qty = Int32.Parse(gridItems.Rows[gridItems.SelectedCell.Y].Cells[gridItems.SelectedCell.X].Text);
             gridItems.Rows[gridItems.SelectedCell.Y].Cells[4].Text = (qty * PIn.Double(gridItems.Rows[gridItems.SelectedCell.Y].Cells[3].Text)).ToString("n");
         }
         if (gridItems.SelectedCell.X == 3)               //Price
         {
             double price = Double.Parse(gridItems.Rows[gridItems.SelectedCell.Y].Cells[gridItems.SelectedCell.X].Text);
             gridItems.Rows[gridItems.SelectedCell.Y].Cells[4].Text = (price * PIn.Int(gridItems.Rows[gridItems.SelectedCell.Y].Cells[2].Text)).ToString("n");
         }
         Application.DoEvents();
         //save changes to order item on cell leave
     }
     catch (Exception ex) {
         ex.DoNothing();
         //problem calculating or parsing amount.
         gridItems.Rows[gridItems.SelectedCell.Y].ColorBackG    = Color.LightPink;
         gridItems.Rows[gridItems.SelectedCell.Y].Cells[4].Text = 0.ToString("n");
     }
 }
Beispiel #16
0
        private void FillGridOrderItem()
        {
            long orderNum = 0;

            if (gridOrders.GetSelectedIndex() != -1)           //an order is selected
            {
                orderNum = _listOrders[gridOrders.GetSelectedIndex()].SupplyOrderNum;
            }
            _tableOrderItems = SupplyOrderItems.GetItemsForOrder(orderNum);
            gridItems.BeginUpdate();
            gridItems.Columns.Clear();
            //ODGridColumn col=new ODGridColumn(Lan.g(this,"Supplier"),120);
            //gridItems.Columns.Add(col);
            ODGridColumn col = new ODGridColumn(Lan.g(this, "Catalog #"), 80);

            gridItems.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Description"), 320);
            gridItems.Columns.Add(col);
            col            = new ODGridColumn(Lan.g(this, "Qty"), 60, HorizontalAlignment.Center);
            col.IsEditable = true;
            gridItems.Columns.Add(col);
            col            = new ODGridColumn(Lan.g(this, "Price/Unit"), 70, HorizontalAlignment.Right);
            col.IsEditable = true;
            gridItems.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Subtotal"), 70, HorizontalAlignment.Right);
            gridItems.Columns.Add(col);
            gridItems.Rows.Clear();
            ODGridRow row;
            double    price;
            int       qty;
            double    subtotal;
            double    total         = 0;
            bool      autocalcTotal = true;

            for (int i = 0; i < _tableOrderItems.Rows.Count; i++)
            {
                row = new ODGridRow();
                //if(gridOrders.GetSelectedIndex()==-1){
                //	row.Cells.Add("");
                //}
                //else{
                //	row.Cells.Add(Suppliers.GetName(ListSuppliers,ListOrders[gridOrders.GetSelectedIndex()].SupplierNum));
                //}
                row.Cells.Add(_tableOrderItems.Rows[i]["CatalogNumber"].ToString());
                row.Cells.Add(_tableOrderItems.Rows[i]["Descript"].ToString());
                qty = PIn.Int(_tableOrderItems.Rows[i]["Qty"].ToString());
                row.Cells.Add(qty.ToString());
                price = PIn.Double(_tableOrderItems.Rows[i]["Price"].ToString());
                row.Cells.Add(price.ToString("n"));
                subtotal = ((double)qty) * price;
                row.Cells.Add(subtotal.ToString("n"));
                gridItems.Rows.Add(row);
                if (subtotal == 0)
                {
                    autocalcTotal = false;
                }
                total += subtotal;
            }
            gridItems.EndUpdate();
            if (gridOrders.GetSelectedIndex() != -1 &&
                autocalcTotal &&
                total != _listOrders[gridOrders.GetSelectedIndex()].AmountTotal)
            {
                SupplyOrder order = _listOrders[gridOrders.GetSelectedIndex()].Copy();
                order.AmountTotal = total;
                SupplyOrders.Update(order);
                FillGridOrders();
                for (int i = 0; i < _listOrders.Count; i++)
                {
                    if (_listOrders[i].SupplyOrderNum == order.SupplyOrderNum)
                    {
                        gridOrders.SetSelected(i, true);
                    }
                }
            }
        }
Beispiel #17
0
        ///<summary>Actually fill the grid with the data. Filtering based on the user-defined criteria gets done here.</summary>
        private void FillGrid()
        {
            //get the user-entered filter values.
            int         daysPassedFilter = PIn.Int(textDaysPastDue.Text, false);  //returns 0 if exceptions are thrown.
            List <long> listProvNums     = new List <long>();

            if (comboBoxMultiProv.SelectedIndices[0].ToString() == "0")
            {
                listProvNums.AddRange(_listProviders.Select(x => x.ProvNum).ToList());
            }
            else
            {
                for (int i = 0; i < comboBoxMultiProv.SelectedIndices.Count; i++)
                {
                    listProvNums.Add((long)_listProviders[(int)comboBoxMultiProv.SelectedIndices[i] - 1].ProvNum);
                }
            }
            List <long> listClinicNums = new List <long>();

            if (PrefC.HasClinicsEnabled)
            {
                if (comboBoxMultiClinics.ListSelectedIndices.Contains(0))
                {
                    for (int j = 0; j < _listClinics.Count; j++)
                    {
                        listClinicNums.Add(_listClinics[j].ClinicNum);                        //Add all clinics this person has access to.
                    }
                    if (!Security.CurUser.ClinicIsRestricted)
                    {
                        listClinicNums.Add(0);
                    }
                }
                else
                {
                    for (int i = 0; i < comboBoxMultiClinics.ListSelectedIndices.Count; i++)
                    {
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            listClinicNums.Add(_listClinics[comboBoxMultiClinics.ListSelectedIndices[i] - 1].ClinicNum);
                        }
                        else if (comboBoxMultiClinics.ListSelectedIndices[i] == 1)
                        {
                            listClinicNums.Add(0);
                        }
                        else
                        {
                            listClinicNums.Add(_listClinics[comboBoxMultiClinics.ListSelectedIndices[i] - 2].ClinicNum);
                        }
                    }
                }
            }
            //fill the grid
            gridMain.BeginUpdate();
            //columns
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableInsPayPlanPastDue", "Patient"), 180);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableInsPayPlanPastDue", "DateLastPmt"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableInsPayPlanPastDue", "#Overdue"), 75);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableInsPayPlanPastDue", "AmtOverdue"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableInsPayPlanPastDue", "DaysOverdue"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableInsPayPlanPastDue", "CarrierName/Phone"), 0);
            gridMain.Columns.Add(col);
            //rows
            gridMain.Rows.Clear();
            ODGridRow row;

            foreach (PayPlanExtended payPlanCur in _listPayPlanExtended)
            {
                if (daysPassedFilter > payPlanCur.DaysOverdue || payPlanCur.DaysOverdue < 1)
                {
                    continue;
                }
                if (!listProvNums.Contains(payPlanCur.ListPayPlanCharges[0].ProvNum))
                {
                    continue;
                }
                if (PrefC.HasClinicsEnabled && (!listClinicNums.Contains(payPlanCur.ListPayPlanCharges[0].ClinicNum)))
                {
                    continue;
                }
                row = new ODGridRow();
                string patName          = payPlanCur.PatientCur.LName + ", " + payPlanCur.PatientCur.FName;
                string carrierNamePhone = payPlanCur.CarrierCur.CarrierName + "\r\n" + Lan.g("TableInsPayPlanPastDue", "Ph:") + " " + payPlanCur.CarrierCur.Phone;
                row.Cells.Add(patName);
                row.Cells.Add(payPlanCur.DateLastPayment.ToShortDateString());
                row.Cells.Add(payPlanCur.NumChargesOverdue.ToString());
                row.Cells.Add(payPlanCur.AmtOverdue.ToString("f"));
                row.Cells.Add(payPlanCur.DaysOverdue.ToString());
                row.Cells.Add(carrierNamePhone);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
        private void FillGridMain()
        {
            //Get filters from user input
            string firstName = "";

            if (textFName.Text != "")
            {
                firstName = textFName.Text;
            }
            string lastName = "";

            if (textLName.Text != "")
            {
                lastName = textLName.Text;
            }
            int patNum = 0;

            try {
                if (textPatNum.Text != "")
                {
                    patNum = PIn.Int(textPatNum.Text);
                }
            }
            catch {
                MsgBox.Show(this, "Invalid PatNum");
                return;
            }
            long provNum = 0;

            if (comboProv.SelectedIndex != 0)
            {
                provNum = _listProviders[comboProv.SelectedIndex - 1].ProvNum;
            }
            long clinicNum = 0;

            if (PrefC.HasClinicsEnabled && comboClinic.SelectedIndex != 0)
            {
                clinicNum = _listClinics[comboClinic.SelectedIndex - 1].ClinicNum;
            }
            long siteNum = 0;

            if (!PrefC.GetBool(PrefName.EasyHidePublicHealth) && comboSite.SelectedIndex != 0)
            {
                siteNum = _listSites[comboSite.SelectedIndex - 1].SiteNum;
            }
            //Get table
            _table = Patients.GetExportList(patNum, firstName, lastName, provNum, clinicNum, siteNum);
            //Create grid
            //Patient Name | Primary Provider | Date Last Visit | Clinic | Site
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn("PatNum", 60);
            col.SortingStrategy = GridSortingStrategy.AmountParse;
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Patient Name", 200);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Primary Provider", 110);
            gridMain.Columns.Add(col);
            if (!PrefC.GetBool(PrefName.EasyNoClinics))
            {
                col = new ODGridColumn("Clinic", 110);
                gridMain.Columns.Add(col);
            }
            if (!PrefC.GetBool(PrefName.EasyHidePublicHealth))
            {
                col = new ODGridColumn("Site", 110);
                gridMain.Columns.Add(col);
            }
            //Fill grid
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < _table.Rows.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_table.Rows[i]["PatNum"].ToString());
                row.Cells.Add(_table.Rows[i]["LName"].ToString() + ", " + _table.Rows[i]["FName"].ToString());
                row.Cells.Add(_table.Rows[i]["Provider"].ToString());
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(_table.Rows[i]["Clinic"].ToString());
                }
                if (!PrefC.GetBool(PrefName.EasyHidePublicHealth))
                {
                    row.Cells.Add(_table.Rows[i]["Site"].ToString());
                }
                row.Tag = PIn.Long(_table.Rows[i]["PatNum"].ToString());
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Beispiel #19
0
		private void butText_Click(object sender,EventArgs e) {
			long patNum;
			string wirelessPhone;
			YN txtMsgOk;
			if(grid.Rows.Count==0) {
				MsgBox.Show(this,"There are no Patients in the table.  Must have at least one.");
				return;
			}
			if(PrefC.GetLong(PrefName.ConfirmStatusTextMessaged)==0) {
				MsgBox.Show(this,"You need to set a status first for confirmation text messages in the Recall Setup window.");
				return;
			}
			if(grid.SelectedIndices.Length==0) {//None selected. Select all of type text that are not yet confirmed by text message.
				ContactMethod cmeth;
				for(int i=0;i<Table.Rows.Count;i++) {
					cmeth=(ContactMethod)PIn.Int(Table.Rows[i]["PreferConfirmMethod"].ToString());
					if(cmeth!=ContactMethod.TextMessage) {
						continue;
					}
					if(Table.Rows[i]["confirmed"].ToString()==DefC.GetName(DefCat.ApptConfirmed,PrefC.GetLong(PrefName.ConfirmStatusTextMessaged))) {//Already confirmed by text
						continue;
					}
					if(!Table.Rows[i]["contactMethod"].ToString().StartsWith("Text:")) {//Check contact method
						continue;
					}
					grid.SetSelected(i,true);
				}
				if(grid.SelectedIndices.Length==0) {
					MsgBox.Show(this,"All patients of text message type have been sent confirmations.");
					return;
				}
			}
			//deselect the ones that do not have text messages specified or are not OK to send texts to or have already been texted
			int skipped=0;
			for(int i=grid.SelectedIndices.Length-1;i>=0;i--) {
				wirelessPhone=Table.Rows[grid.SelectedIndices[i]]["WirelessPhone"].ToString();
				if(wirelessPhone=="") {//Check for wireless number
					skipped++;
					grid.SetSelected(grid.SelectedIndices[i],false);
					continue;
				}
				txtMsgOk=(YN)PIn.Int(Table.Rows[grid.SelectedIndices[i]]["TxtMsgOk"].ToString());
				if(txtMsgOk==YN.Unknown	&& PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo)) {//Check if OK to text
					skipped++;
					grid.SetSelected(grid.SelectedIndices[i],false);
					continue;
				}
				if(txtMsgOk==YN.No){//Check if OK to text
					skipped++;
					grid.SetSelected(grid.SelectedIndices[i],false);
					continue;
				}
			}
			if(grid.SelectedIndices.Length==0) {
				MsgBox.Show(this,"None of the selected patients have wireless phone numbers and are OK to text.");
				return;
			}
			if(skipped>0) {
				MessageBox.Show(Lan.g(this,"Selected patients skipped: ")+skipped.ToString());
			}
			if(!MsgBox.Show(this,MsgBoxButtons.YesNo,"Send text message to all of the selected patients?")) {
				return;
			}
			Cursor=Cursors.WaitCursor;
			FormTxtMsgEdit FormTME=new FormTxtMsgEdit();
			string message="";
			//Appointment apt;
			for(int i=0;i<grid.SelectedIndices.Length;i++){
				patNum=PIn.Long(Table.Rows[grid.SelectedIndices[i]]["PatNum"].ToString());
				wirelessPhone=PIn.String(Table.Rows[grid.SelectedIndices[i]]["WirelessPhone"].ToString());
				txtMsgOk=((YN)PIn.Int(Table.Rows[grid.SelectedIndices[i]]["TxtMsgOk"].ToString()));
				message=PrefC.GetString(PrefName.ConfirmTextMessage);
				message=message.Replace("[NameF]",Table.Rows[grid.SelectedIndices[i]]["nameF"].ToString());
				message=message.Replace("[NameFL]",Table.Rows[grid.SelectedIndices[i]]["nameFL"].ToString());
				message=message.Replace("[date]",((DateTime)Table.Rows[grid.SelectedIndices[i]]["AptDateTime"]).ToShortDateString());
				message=message.Replace("[time]",((DateTime)Table.Rows[grid.SelectedIndices[i]]["AptDateTime"]).ToShortTimeString());
				FormTME.SendText(patNum,wirelessPhone,message,txtMsgOk);
				Appointments.SetConfirmed(PIn.Long(Table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString()),PrefC.GetLong(PrefName.ConfirmStatusTextMessaged));
			}
			FillMain();
			Cursor=Cursors.Default;
		}
Beispiel #20
0
		private void butEmail_Click(object sender,EventArgs e) {
			if(grid.Rows.Count==0) {
				MsgBox.Show(this,"There are no Patients in the table.  Must have at least one.");
				return;
			}
			if(!EmailAddresses.ExistsValidEmail()) {
				MsgBox.Show(this,"You need to enter an SMTP server name in e-mail setup before you can send e-mail.");
				return;
			}
			if(PrefC.GetLong(PrefName.ConfirmStatusEmailed)==0) {
				MsgBox.Show(this,"You need to set a status first for confirmation e-mails in the Recall Setup window.");
				return;
			}
			if(grid.SelectedIndices.Length==0) {
				ContactMethod cmeth;
				for(int i=0;i<Table.Rows.Count;i++) {
					cmeth=(ContactMethod)PIn.Int(Table.Rows[i]["PreferConfirmMethod"].ToString());
					if(cmeth!=ContactMethod.Email) {
						continue;
					}
					if(Table.Rows[i]["confirmed"].ToString()==DefC.GetName(DefCat.ApptConfirmed,PrefC.GetLong(PrefName.ConfirmStatusEmailed))) {//Already confirmed by email
						continue;
					}
					if(Table.Rows[i]["email"].ToString()=="") {
						continue;
					}
					grid.SetSelected(i,true);
				}
				if(grid.SelectedIndices.Length==0) {
					MsgBox.Show(this,"Confirmations have been sent to all patients of email type who also have an email address entered.");
					return;
				}
			}
			else {//deselect the ones that do not have email addresses specified
				int skipped=0;
				for(int i=grid.SelectedIndices.Length-1;i>=0;i--) {
					if(Table.Rows[grid.SelectedIndices[i]]["email"].ToString()=="") {
						skipped++;
						grid.SetSelected(grid.SelectedIndices[i],false);
					}
				}
				if(grid.SelectedIndices.Length==0) {
					MsgBox.Show(this,"None of the selected patients had email addresses entered.");
					return;
				}
				if(skipped>0) {
					MessageBox.Show(Lan.g(this,"Selected patients skipped due to missing email addresses: ")+skipped.ToString());
				}
			}
			if(!MsgBox.Show(this,MsgBoxButtons.YesNo,"Send email to all of the selected patients?")) {
				return;
			}
			Cursor=Cursors.WaitCursor;
			EmailMessage message;
			string str="";
			List<long> patNumsSelected=new List<long>();
			List<long> patNumsFailed=new List<long>();
			EmailAddress emailAddress;
			for(int i=0;i<grid.SelectedIndices.Length;i++){
				message=new EmailMessage();
				message.PatNum=PIn.Long(Table.Rows[grid.SelectedIndices[i]]["PatNum"].ToString());
				message.ToAddress=Table.Rows[grid.SelectedIndices[i]]["email"].ToString();//Could be guarantor email.
				emailAddress=EmailAddresses.GetByClinic(PIn.Long(Table.Rows[grid.SelectedIndices[i]]["ClinicNum"].ToString()));
				message.FromAddress=emailAddress.SenderAddress;				
				message.Subject=PrefC.GetString(PrefName.ConfirmEmailSubject);
				patNumsSelected.Add(message.PatNum);
				str=PrefC.GetString(PrefName.ConfirmEmailMessage);
				str=str.Replace("[NameF]",Table.Rows[grid.SelectedIndices[i]]["nameF"].ToString());
				str=str.Replace("[NameFL]",Table.Rows[grid.SelectedIndices[i]]["nameFL"].ToString());
				str=str.Replace("[date]",((DateTime)Table.Rows[grid.SelectedIndices[i]]["AptDateTime"]).ToShortDateString());
				str=str.Replace("[time]",((DateTime)Table.Rows[grid.SelectedIndices[i]]["AptDateTime"]).ToShortTimeString());
				message.BodyText=str;
				try {
					EmailMessages.SendEmailUnsecure(message,emailAddress);
				}
				catch {
					patNumsFailed.Add(message.PatNum);
					continue;
				}
				message.MsgDateTime=DateTime.Now;
				message.SentOrReceived=EmailSentOrReceived.Sent;
				EmailMessages.Insert(message);
				Appointments.SetConfirmed(PIn.Long(Table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString()),PrefC.GetLong(PrefName.ConfirmStatusEmailed));
			}
			Cursor=Cursors.Default;
			if(patNumsFailed.Count==grid.SelectedIndices.Length){ //all failed
				//no need to refresh
				MsgBox.Show(this,"All emails failed. Possibly due to invalid email addresses, a loss of connectivity, or a firewall blocking communication.");//msg: all failed
				return;
			}
			else if(patNumsFailed.Count>0){//if some failed
				FillMain();
				//reselect only the failed ones
				for(int i=0;i<Table.Rows.Count;i++) { //table.Rows.Count=grid.Rows.Count
					long patNum=PIn.Long(Table.Rows[i]["PatNum"].ToString());
					if(patNumsFailed.Contains(patNum)) {
						grid.SetSelected(i,true);
					}
				}
				MsgBox.Show(this,"Some emails failed to send.");
				return;
			}
			//none failed
			FillMain();
			//reselect the original list 
			for(int i=0;i<Table.Rows.Count;i++) {
				long patNum=PIn.Long(Table.Rows[i]["PatNum"].ToString());
				if(patNumsSelected.Contains(patNum)) {
					grid.SetSelected(i,true);
				}
			}
		}
Beispiel #21
0
        private void GetOneFromServer()
        {
            //get a table with data
            Cursor = Cursors.WaitCursor;
            //prepare the xml document to send--------------------------------------------------------------------------------------
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent      = true;
            settings.IndentChars = ("    ");
            StringBuilder strbuild = new StringBuilder();

            using (XmlWriter writer = XmlWriter.Create(strbuild, settings)){
                writer.WriteStartElement("FeatureRequestGetOne");
                writer.WriteStartElement("RegistrationKey");
                writer.WriteString(PrefC.GetString(PrefName.RegistrationKey));
                writer.WriteEndElement();
                writer.WriteStartElement("RequestId");
                writer.WriteString(RequestId.ToString());
                writer.WriteEndElement();
                writer.WriteEndElement();
            }
                        #if DEBUG
            OpenDental.localhost.Service1 updateService = new OpenDental.localhost.Service1();
                        #else
            OpenDental.customerUpdates.Service1 updateService = new OpenDental.customerUpdates.Service1();
            updateService.Url = PrefC.GetString(PrefName.UpdateServerAddress);
                        #endif
            //Send the message and get the result-------------------------------------------------------------------------------------
            string result = "";
            try {
                result = updateService.FeatureRequestGetOne(strbuild.ToString());
            }
            catch (Exception ex) {
                Cursor = Cursors.Default;
                MessageBox.Show("Error: " + ex.Message);
                return;
            }
            //textConnectionMessage.Text=Lan.g(this,"Connection successful.");
            //Application.DoEvents();
            Cursor = Cursors.Default;
            //MessageBox.Show(result);
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(result);
            //Process errors------------------------------------------------------------------------------------------------------------
            XmlNode node = doc.SelectSingleNode("//Error");
            if (node != null)
            {
                //textConnectionMessage.Text=node.InnerText;
                MessageBox.Show(node.InnerText, "Error");
                DialogResult = DialogResult.Cancel;
                return;
            }
            //Process a valid return value------------------------------------------------------------------------------------------------
            node     = doc.SelectSingleNode("//ResultTable");
            tableObj = new ODDataTable(node.InnerXml);
            ODDataRow row = tableObj.Rows[0];
            textDescription.Text = row["Description"];
            string detail = row["Detail"];
            detail              = detail.Replace("\n", "\r\n");
            textDetail.Text     = detail;
            checkIsMine.Checked = PIn.Bool(row["isMine"]);
            textDifficulty.Text = row["Difficulty"];
            int approval = PIn.Int(row["Approval"]);
            if (IsAdminMode)
            {
                textSubmitter.Text = row["submitter"];
            }
            comboApproval.SelectedIndex = approval;
            //textApproval gets set automatically due to comboApproval_SelectedIndexChanged.
            if (!IsAdminMode && PIn.Bool(row["isMine"]))            //user editing their own request
            {
                if ((ApprovalEnum)approval == ApprovalEnum.New ||
                    (ApprovalEnum)approval == ApprovalEnum.NeedsClarification ||
                    (ApprovalEnum)approval == ApprovalEnum.NotARequest ||
                    (ApprovalEnum)approval == ApprovalEnum.Redundant ||
                    (ApprovalEnum)approval == ApprovalEnum.TooBroad)
                //so user not allowed to edit if Approved,AlreadyDone,Obsolete, or InProgress.
                {
                    textDescription.BackColor = Color.White;
                    textDescription.ReadOnly  = false;
                    textDetail.BackColor      = Color.White;
                    textDetail.ReadOnly       = false;
                    if ((ApprovalEnum)approval != ApprovalEnum.New)
                    {
                        butResubmit.Visible = true;
                    }
                    butDelete.Visible = true;
                }
            }
            if ((ApprovalEnum)approval != ApprovalEnum.Approved)
            {
                //only allowed to vote on Approved features.
                //All others should always have zero votes, except InProgress and Complete
                groupMyVotes.Visible = false;
            }
            if ((ApprovalEnum)approval == ApprovalEnum.Approved ||
                (ApprovalEnum)approval == ApprovalEnum.InProgress ||
                (ApprovalEnum)approval == ApprovalEnum.Complete)
            {            //even administrators should not be able to change things at this point
                textDescription.BackColor = colorDisabled;
                textDescription.ReadOnly  = true;
                textDetail.BackColor      = colorDisabled;
                textDetail.ReadOnly       = true;
            }
            myPointsUsed = PIn.Int(row["myPointsUsed"]);
            try {
                myPointsAllotted = PIn.Int(row["myPointsAllotted"]);
            }
            catch {
                myPointsAllotted = 100;
            }
            //textMyPointsRemain.Text=;this will be filled automatically when myPoints changes
            textMyPoints.Text = row["myPoints"];
            RecalcMyPoints();
            checkIsCritical.Checked = PIn.Bool(row["IsCritical"]);
            textMyPledge.Text       = row["myPledge"];
            textTotalPoints.Text    = row["totalPoints"];
            textTotalCritical.Text  = row["totalCritical"];
            textTotalPledged.Text   = row["totalPledged"];
            textWeight.Text         = row["Weight"];
            try {
                textBounty.Text = row["Bounty"];
            }
            catch { }
        }
Beispiel #22
0
        ///<summary>Happens on Load, and will also happen when user manually edits markup.  Recursive.</summary>
        private void ParseMarkup()
        {
            //{|
            //!Width="100"|Column Heading 1!!Width="150"|Column Heading 2!!Width="75"|Column Heading 3
            //|-
            //|Cell 1||Cell 2||Cell 3
            //|-
            //|Cell A||Cell B||Cell C
            //|}
            Table     = new DataTable();
            ColNames  = new List <string>();
            ColWidths = new List <int>();
            DataRow row;

            string[] cells;
            string[] lines = Markup.Split(new string[] { "{|\r\n", "{|\n", "\r\n|-\r\n", "\n|-\n", "\r\n|}", "\n|}" }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i].StartsWith("!"))                 //header
                {
                    lines[i] = lines[i].Substring(1);         //strips off the leading !
                    cells    = lines[i].Split(new string[] { "!!" }, StringSplitOptions.None);
                    for (int c = 0; c < cells.Length; c++)
                    {
                        string colName = "";
                        if (!Regex.IsMatch(cells[c], @"^(Width="")\d+""\|"))                        //e.g. Width="90"|
                        {
                            MessageBox.Show("Table is corrupt.  Each header must start with Width=\"#\"|.  Please manually edit the markup in the following window.");
                            ManuallyEdit();
                            return;
                        }
                        string width = cells[c].Substring(7);                      //90"|Column Heading 1
                        width = width.Substring(0, width.IndexOf("\""));           //90
                        ColWidths.Add(PIn.Int(width));
                        colName = cells[c].Substring(cells[c].IndexOf("|") + 1);
                        ColNames.Add(colName);
                        Table.Columns.Add("");                        //must be an empty string because Table object does not allow duplicate column names.
                    }
                    continue;
                }
                if (lines[i].Trim() == "|-")
                {
                    continue;                    //totally ignore these rows
                }
                //normal row.  Headers will have already been filled
                lines[i] = lines[i].Substring(1);              //strips off the leading |
                cells    = lines[i].Split(new string[] { "||" }, StringSplitOptions.None);
                if (cells.Length != ColNames.Count || cells.Length != ColWidths.Count)
                {
                    MessageBox.Show("Table is corrupt.  There are " + ColNames.Count.ToString() + " columns, but row " + ((i - 1) / 2).ToString()
                                    + " has " + cells.Length.ToString() + " cells.  Please manually edit the markup in the following window.");
                    ManuallyEdit();
                    return;
                }
                row = Table.NewRow();
                for (int c = 0; c < cells.Length; c++)
                {
                    row[c] = cells[c];
                }
                Table.Rows.Add(row);
            }
        }
        private void FillGrid()
        {
            if (textDateTo.errorProvider1.GetError(textDateTo) != "" || textDateFrom.errorProvider1.GetError(textDateFrom) != "")               //Test To and From dates
            {
                MsgBox.Show(this, "Please enter valid To and From dates.");
                return;
            }
            DateFrom = PIn.Date(textDateFrom.Text);
            DateTo   = PIn.Date(textDateTo.Text);
            if (DateTo < DateFrom)
            {
                MsgBox.Show(this, "Date To cannot be before Date From.");
                return;
            }
//todo: checkbox
            RefAttachList = RefAttaches.RefreshForReferralProcTrack(DateFrom, DateTo, checkComplete.Checked);
            Table         = Procedures.GetReferred(DateFrom, DateTo, checkComplete.Checked);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn(Lan.g(this, "Patient"), 125);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Referred To"), 125);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Description"), 125);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Note"), 125);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Date Referred"), 86);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Date Done"), 86);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Status"), 84);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;
            DateTime  date;

            for (int i = 0; i < Table.Rows.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(Patients.GetPat(PIn.Long(Table.Rows[i]["PatNum"].ToString())).GetNameLF());
                row.Cells.Add(Table.Rows[i]["LName"].ToString() + ", " + Table.Rows[i]["FName"].ToString() + " " + Table.Rows[i]["MName"].ToString());
                row.Cells.Add(ProcedureCodes.GetLaymanTerm(PIn.Long(Table.Rows[i]["CodeNum"].ToString())));
                row.Cells.Add(Table.Rows[i]["Note"].ToString());
                date = PIn.Date(Table.Rows[i]["RefDate"].ToString());
                if (date.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(date.ToShortDateString());
                }
                date = PIn.Date(Table.Rows[i]["DateProcComplete"].ToString());
                if (date.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(date.ToShortDateString());
                }
                ReferralToStatus refStatus = (ReferralToStatus)PIn.Int(Table.Rows[i]["RefToStatus"].ToString());
                if (refStatus == ReferralToStatus.None)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(refStatus.ToString());
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
        private void butGenerate_Click(object sender, EventArgs e)
        {
            //Generate payperiods based on settings
            if (numPayPeriods.errorProvider1.GetError(numPayPeriods) != "")
            {
                MsgBox.Show(this, numPayPeriods.errorProvider1.GetError(numPayPeriods));
                return;
            }
            if (numDaysAfterPayPeriod.Enabled && numDaysAfterPayPeriod.errorProvider1.GetError(numDaysAfterPayPeriod) != "")
            {
                MsgBox.Show(this, numDaysAfterPayPeriod.errorProvider1.GetError(numDaysAfterPayPeriod));
                return;
            }
            if (numDaysAfterPayPeriod.Enabled && numDaysAfterPayPeriod.Text == "0")
            {
                MsgBox.Show(this, "# Days After Pay Period cannot be zero.");
                return;
            }
            _listPayPeriods.Clear();
            int numPeriods = PIn.Int(numPayPeriods.Text);
            PayPeriodInterval payPeriodInterval = PayPeriodInterval.Weekly;

            if (radioBiWeekly.Checked)
            {
                payPeriodInterval = PayPeriodInterval.BiWeekly;
            }
            else if (radioMonthly.Checked)
            {
                payPeriodInterval = PayPeriodInterval.Monthly;
            }
            DateTime startDate = dateTimeStart.Value;          //Original value

            for (int i = 0; i < numPeriods; i++)
            {
                PayPeriod payPeriod = new PayPeriod();
                payPeriod.DateStart = startDate;
                //Make PayDate information
                switch (payPeriodInterval)                 //Add time to "startDate" to get the new start date for the next iteration as well as figuring out the end date for current payperiod.
                {
                case PayPeriodInterval.Weekly:
                    payPeriod.DateStop = startDate.AddDays(6);
                    startDate          = startDate.AddDays(7);
                    break;

                case PayPeriodInterval.BiWeekly:
                    payPeriod.DateStop = startDate.AddDays(13);
                    startDate          = startDate.AddDays(14);
                    break;

                case PayPeriodInterval.Monthly:
                    payPeriod.DateStop = startDate.AddMonths(1).Subtract(TimeSpan.FromDays(1));
                    startDate          = startDate.AddMonths(1);
                    break;
                }
                if (comboDay.Enabled)
                {
                    //Find the closest day specified after the end of the pay period.
                    payPeriod.DatePaycheck = GetDateOfDay(payPeriod.DateStop, (DayOfWeek)(comboDay.SelectedIndex - 1));
                }
                else                  //# days specified, use "Exclude Weekends" checkbox as well as "Pay Before" and "Pay After" buttons.
                {
                    payPeriod.DatePaycheck = payPeriod.DateStop.AddDays(PIn.Int(numDaysAfterPayPeriod.Text));
                    if (payPeriod.DatePaycheck.DayOfWeek == DayOfWeek.Saturday && checkExcludeWeekends.Checked)
                    {
                        if (radioPayBefore.Checked)
                        {
                            if (payPeriod.DatePaycheck.Subtract(TimeSpan.FromDays(1)) <= payPeriod.DateStop)                           //Can't move the paycheck date to the same day (or before) than the date end.
                            {
                                payPeriod.DatePaycheck = payPeriod.DatePaycheck.Add(TimeSpan.FromDays(2));                             //Move it forward to monday
                            }
                            else
                            {
                                payPeriod.DatePaycheck = payPeriod.DatePaycheck.Subtract(TimeSpan.FromDays(1));                              //Move it back to friday
                            }
                        }
                        else                                                                           //radioPayAfter
                        {
                            payPeriod.DatePaycheck = payPeriod.DatePaycheck.Add(TimeSpan.FromDays(2)); //Move it forward to monday
                        }
                    }
                    else if (payPeriod.DatePaycheck.DayOfWeek == DayOfWeek.Sunday && checkExcludeWeekends.Checked)
                    {
                        if (radioPayBefore.Checked)
                        {
                            if (payPeriod.DatePaycheck.Subtract(TimeSpan.FromDays(2)) <= payPeriod.DateStop)                           //Can't move the paycheck date to the same day (or before) than the date end.
                            {
                                payPeriod.DatePaycheck = payPeriod.DatePaycheck.Add(TimeSpan.FromDays(1));                             //Move it forward to monday
                            }
                            else
                            {
                                payPeriod.DatePaycheck = payPeriod.DatePaycheck.Subtract(TimeSpan.FromDays(2));                              //Move it back to friday
                            }
                        }
                        else                                                                           //radioPayAfter
                        {
                            payPeriod.DatePaycheck = payPeriod.DatePaycheck.Add(TimeSpan.FromDays(1)); //Move it forward to monday
                        }
                    }
                }
                _listPayPeriods.Add(payPeriod);
            }
            FillGrid();
        }
Beispiel #25
0
 ///<summary>Returns false if validation failed.  This also makes sure the web service exists, the customer is paid, and the registration key is correct.</summary>
 private bool SavePrefs()
 {
     //validation
     if (textSynchMinutes.errorProvider1.GetError(textSynchMinutes) != "" ||
         textDateBefore.errorProvider1.GetError(textDateBefore) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return(false);
     }
     //yes, workstation is allowed to be blank.  That's one way for user to turn off auto synch.
     //if(textMobileSynchWorkStation.Text=="") {
     //	MsgBox.Show(this,"WorkStation cannot be empty");
     //	return false;
     //}
     // the text field is read because the keyed in values have not been saved yet
     if (textMobileSyncServerURL.Text.Contains("192.168.0.196") || textMobileSyncServerURL.Text.Contains("localhost"))
     {
         IgnoreCertificateErrors();                // done so that TestWebServiceExists() does not thow an error.
     }
     // if this is not done then an old non-functional url prevents any new url from being saved.
     Prefs.UpdateString(PrefName.MobileSyncServerURL, textMobileSyncServerURL.Text);
     if (!TestWebServiceExists())
     {
         MsgBox.Show(this, "Web service not found.");
         return(false);
     }
     if (mb.GetCustomerNum(PrefC.GetString(PrefName.RegistrationKey)) == 0)
     {
         MsgBox.Show(this, "Registration key is incorrect.");
         return(false);
     }
     if (!VerifyPaidCustomer())
     {
         return(false);
     }
     //Minimum 10 char.  Must contain uppercase, lowercase, numbers, and symbols. Valid symbols are: !@#$%^&+=
     //The set of symbols checked was far too small, not even including periods, commas, and parentheses.
     //So I rewrote it all.  New error messages say exactly what's wrong with it.
     if (textMobileUserName.Text != "")           //allowed to be blank
     {
         if (textMobileUserName.Text.Length < 10)
         {
             MsgBox.Show(this, "User Name must be at least 10 characters long.");
             return(false);
         }
         if (!Regex.IsMatch(textMobileUserName.Text, "[A-Z]+"))
         {
             MsgBox.Show(this, "User Name must contain an uppercase letter.");
             return(false);
         }
         if (!Regex.IsMatch(textMobileUserName.Text, "[a-z]+"))
         {
             MsgBox.Show(this, "User Name must contain an lowercase letter.");
             return(false);
         }
         if (!Regex.IsMatch(textMobileUserName.Text, "[0-9]+"))
         {
             MsgBox.Show(this, "User Name must contain a number.");
             return(false);
         }
         if (!Regex.IsMatch(textMobileUserName.Text, "[^0-9a-zA-Z]+"))                //absolutely anything except number, lower or upper.
         {
             MsgBox.Show(this, "User Name must contain punctuation or symbols.");
             return(false);
         }
     }
     if (textDateBefore.Text == "")          //default to one year if empty
     {
         textDateBefore.Text = DateTime.Today.AddYears(-1).ToShortDateString();
         //not going to bother informing user.  They can see it.
     }
     //save to db------------------------------------------------------------------------------------
     if (Prefs.UpdateString(PrefName.MobileSyncServerURL, textMobileSyncServerURL.Text)
         | Prefs.UpdateInt(PrefName.MobileSyncIntervalMinutes, PIn.Int(textSynchMinutes.Text))                        //blank entry allowed
         | Prefs.UpdateString(PrefName.MobileExcludeApptsBeforeDate, POut.Date(PIn.Date(textDateBefore.Text), false)) //blank
         | Prefs.UpdateString(PrefName.MobileSyncWorkstationName, textMobileSynchWorkStation.Text)
         | Prefs.UpdateString(PrefName.MobileUserName, textMobileUserName.Text)
         )
     {
         changed = true;
         Prefs.RefreshCache();
     }
     //Username and password-----------------------------------------------------------------------------
     mb.SetMobileWebUserPassword(PrefC.GetString(PrefName.RegistrationKey), textMobileUserName.Text.Trim(), textMobilePassword.Text.Trim());
     return(true);
 }
Beispiel #26
0
 ///<summary>Only called when user clicks Delete or OK.  Not called repeatedly when adding discussions.</summary>
 private bool SaveChangesToDb(bool doDelete)
 {
     #region validation
     //validate---------------------------------------------------------------------------------------------------------
     int    difficulty = 0;
     int    myPoints   = 0;
     double myPledge   = 0;
     double bounty     = 0;
     if (!doDelete)
     {
         if (textDescription.Text == "")
         {
             MsgBox.Show(this, "Description cannot be blank.");
             return(false);
         }
         try{
             difficulty = int.Parse(textDifficulty.Text);
         }
         catch {
             MsgBox.Show(this, "Difficulty is invalid.");
             return(false);
         }
         if (difficulty < 0 || difficulty > 10)
         {
             MsgBox.Show(this, "Difficulty is invalid.");
             return(false);
         }
         if (IsAdminMode)
         {
             try {
                 bounty = PIn.Int(textBounty.Text);
             }
             catch {
                 MsgBox.Show(this, "Bounty is invalid.");
                 return(false);
             }
         }
         if (!IsAdminMode)
         {
             try{
                 myPoints = PIn.Int(textMyPoints.Text);                      //handles "" gracefully
             }
             catch {
                 MsgBox.Show(this, "Points is invalid.");
                 return(false);
             }
             if (difficulty < 0 || difficulty > 100)
             {
                 MsgBox.Show(this, "Points is invalid.");
                 return(false);
             }
             //still need to validate that they have enough points.
             if (textMyPledge.Text == "")
             {
                 myPledge = 0;
             }
             else
             {
                 try{
                     myPledge = double.Parse(textMyPledge.Text);
                 }
                 catch {
                     MsgBox.Show(this, "Pledge is invalid.");
                     return(false);
                 }
             }
             if (myPledge < 0)
             {
                 MsgBox.Show(this, "Pledge is invalid.");
                 return(false);
             }
         }
         double myPointsRemain = PIn.Double(textMyPointsRemain.Text);
         if (myPointsRemain < 0)
         {
             MsgBox.Show(this, "You have gone over your allotted points.");
             return(false);
         }
     }
     //end of validation------------------------------------------------------------------------------------------------
     #endregion validation
     //if user has made no changes, then exit out-------------------------------------------------------------------------
     bool changesMade = false;
     if (doDelete)
     {
         changesMade = true;
     }
     if (tableObj == null || tableObj.Rows.Count == 0)        //new
     {
         changesMade = true;
     }
     else
     {
         ODDataRow row = tableObj.Rows[0];
         if (textDescription.Text != row["Description"])
         {
             changesMade = true;
         }
         if (textDetail.Text != row["Detail"])
         {
             changesMade = true;
         }
         if (textDifficulty.Text != row["Difficulty"])
         {
             changesMade = true;
         }
         int approval = PIn.Int(row["Approval"]);
         if (comboApproval.SelectedIndex != approval)
         {
             changesMade = true;
         }
         if (groupMyVotes.Visible)
         {
             if (textMyPoints.Text != row["myPoints"] ||
                 checkIsCritical.Checked != PIn.Bool(row["IsCritical"]) ||
                 textMyPledge.Text != row["myPledge"])
             {
                 changesMade = true;
             }
         }
         try {
             if (textBounty.Text != row["Bounty"])
             {
                 changesMade = true;
             }
         }
         catch { }
     }
     if (!changesMade)
     {
         //temporarily show me which ones shortcutted out
         //MessageBox.Show("no changes made");
         return(true);
     }
     Cursor = Cursors.WaitCursor;
     //prepare the xml document to send--------------------------------------------------------------------------------------
     XmlWriterSettings settings = new XmlWriterSettings();
     settings.Indent      = true;
     settings.IndentChars = ("    ");
     StringBuilder strbuild = new StringBuilder();
     using (XmlWriter writer = XmlWriter.Create(strbuild, settings)){
         writer.WriteStartElement("FeatureRequestSubmitChanges");
         //regkey
         writer.WriteStartElement("RegistrationKey");
         writer.WriteString(PrefC.GetString(PrefName.RegistrationKey));
         writer.WriteEndElement();
         //requestId
         writer.WriteStartElement("RequestId");
         writer.WriteString(RequestId.ToString());                //this will be zero for a new request.
         writer.WriteEndElement();
         if (doDelete)
         {
             //delete
             writer.WriteStartElement("Delete");
             writer.WriteString("true");                    //all the other elements will be ignored.
             writer.WriteEndElement();
         }
         else
         {
             if (!textDescription.ReadOnly)
             {
                 //description
                 writer.WriteStartElement("Description");
                 writer.WriteString(textDescription.Text);
                 writer.WriteEndElement();
             }
             if (!textDetail.ReadOnly)
             {
                 //detail
                 writer.WriteStartElement("Detail");
                 writer.WriteString(textDetail.Text);
                 writer.WriteEndElement();
             }
             if (IsAdminMode ||
                 RequestId == 0)                         //This allows the initial difficulty of 5 to get saved.
             {
                 //difficulty
                 writer.WriteStartElement("Difficulty");
                 writer.WriteString(difficulty.ToString());
                 writer.WriteEndElement();
             }
             if (IsAdminMode)
             {
                 //Bounty
                 writer.WriteStartElement("Bounty");
                 writer.WriteString(bounty.ToString());
                 writer.WriteEndElement();
             }
             //approval
             writer.WriteStartElement("Approval");
             writer.WriteString(comboApproval.SelectedIndex.ToString());
             writer.WriteEndElement();
             if (!IsAdminMode)
             {
                 //mypoints
                 writer.WriteStartElement("MyPoints");
                 writer.WriteString(myPoints.ToString());
                 writer.WriteEndElement();
                 //iscritical
                 writer.WriteStartElement("IsCritical");
                 if (checkIsCritical.Checked)
                 {
                     writer.WriteString("1");
                 }
                 else
                 {
                     writer.WriteString("0");
                 }
                 writer.WriteEndElement();
                 //mypledge
                 writer.WriteStartElement("MyPledge");
                 writer.WriteString(myPledge.ToString("f2"));
                 writer.WriteEndElement();
             }
         }
         writer.WriteEndElement();
     }
                 #if DEBUG
     OpenDental.localhost.Service1 updateService = new OpenDental.localhost.Service1();
                 #else
     OpenDental.customerUpdates.Service1 updateService = new OpenDental.customerUpdates.Service1();
     updateService.Url = PrefC.GetString(PrefName.UpdateServerAddress);
                 #endif
     //Send the message and get the result-------------------------------------------------------------------------------------
     string result = "";
     try {
         result = updateService.FeatureRequestSubmitChanges(strbuild.ToString());
     }
     catch (Exception ex) {
         Cursor = Cursors.Default;
         MessageBox.Show("Error: " + ex.Message);
         return(false);
     }
     //textConnectionMessage.Text=Lan.g(this,"Connection successful.");
     //Application.DoEvents();
     Cursor = Cursors.Default;
     //MessageBox.Show(result);
     XmlDocument doc = new XmlDocument();
     doc.LoadXml(result);
     //Process errors------------------------------------------------------------------------------------------------------------
     XmlNode node = doc.SelectSingleNode("//Error");
     if (node != null)
     {
         //textConnectionMessage.Text=node.InnerText;
         MessageBox.Show(node.InnerText, "Error");
         return(false);
     }
     return(true);
 }
Beispiel #27
0
        private void butClose_Click(object sender, System.EventArgs e)
        {
            if (textReportComputerName.Text.Trim().ToLower() == "localhost" || textReportComputerName.Text.Trim() == "127.0.0.1")
            {
                MsgBox.Show(this, "Computer name to fetch new reports from cannot be localhost or 127.0.0.1 or any other loopback address.");
                return;
            }
            int reportCheckIntervalMinuteCount = 0;

            try {
                reportCheckIntervalMinuteCount = PIn.Int(textReportCheckInterval.Text);
                if (textReportCheckInterval.Enabled && (reportCheckIntervalMinuteCount < 5 || reportCheckIntervalMinuteCount > 60))
                {
                    throw new ApplicationException("Invalid value.");                    //User never sees this message.
                }
            }
            catch {
                MsgBox.Show(this, "Report check interval must be between 5 and 60 inclusive.");
                return;
            }
            if (radioTime.Checked && (textReportCheckTime.Text == "" || !textReportCheckTime.IsEntryValid))
            {
                MsgBox.Show(this, "Please enter a time to receive reports.");
                return;
            }
            bool doRestartToShowChanges = false;
            bool doInvalidateCache      = false;

            if (Prefs.UpdateString(PrefName.ClaimReportComputerName, textReportComputerName.Text))
            {
                doRestartToShowChanges = true;
                //No point in invalidating prefs since this only affects a workstation on startup.
            }
            if (Prefs.UpdateInt(PrefName.ClaimReportReceiveInterval, reportCheckIntervalMinuteCount))
            {
                doInvalidateCache = true;
            }
            if (radioTime.Checked)
            {
                if (Prefs.UpdateDateT(PrefName.ClaimReportReceiveTime, PIn.DateT(textReportCheckTime.Text)))
                {
                    doInvalidateCache = true;
                }
            }
            else if (textReportCheckTime.Text == "" && Prefs.UpdateDateT(PrefName.ClaimReportReceiveTime, DateTime.MinValue))
            {
                doInvalidateCache = true;
            }
            if (Prefs.UpdateBool(PrefName.ClaimReportReceivedByService, checkReceiveReportsService.Checked))
            {
                if (checkReceiveReportsService.Checked)
                {
                    doInvalidateCache = true;
                }
                else
                {
                    doRestartToShowChanges = true;
                }
            }
            if (doRestartToShowChanges)
            {
                MsgBox.Show(this, "You will need to restart the program for changes to take effect.");
            }
            if (doInvalidateCache)
            {
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            Close();
        }
        private void FormTransworldSetup_Load(object sender, EventArgs e)
        {
            _progCur = Programs.GetCur(ProgramName.Transworld);
            if (_progCur == null)
            {
                MsgBox.Show(this, "The Transworld entry is missing from the database.  Please contact support.");               //should never happen
                return;
            }
            checkEnabled.Checked = _progCur.Enabled;
            if (!PrefC.HasClinicsEnabled)             //clinics are not enabled, use ClinicNum 0 to indicate 'Headquarters' or practice level program properties
            {
                checkEnabled.Text         = Lan.g(this, "Enabled");
                groupClinicSettings.Text  = Lan.g(this, "Transworld Settings");
                comboClinic.Visible       = false;
                labelClinic.Visible       = false;
                labelClinicEnable.Visible = false;
                _listUserClinicNums       = new List <long>()
                {
                    0
                };                                                                //if clinics are disabled, programproperty.ClinicNum will be set to 0
                groupSendActivity.Text = Lan.g(this, "Account Activity Updates"); //remove '(affects all clinics)' from text
                _selectedClinicNum     = 0;
            }
            else              //Using clinics
            {
                groupClinicSettings.Text = Lan.g(this, "Transworld Clinic Settings");
                _listUserClinicNums      = new List <long>();
                //if Transworld is enabled and the user is restricted to a clinic, don't allow the user to disable for all clinics
                if (Security.CurUser.ClinicIsRestricted)
                {
                    if (checkEnabled.Checked)
                    {
                        checkEnabled.Enabled = false;
                    }
                }
                else
                {
                    comboClinic.Items.Add(Lan.g(this, "Headquarters"));
                    //this way both lists have the same number of items in it and if 'Headquarters' is selected the programproperty.ClinicNum will be set to 0
                    _listUserClinicNums.Add(0);
                    comboClinic.SelectedIndex = 0;
                }
                List <Clinic> listClinics = Clinics.GetForUserod(Security.CurUser);
                foreach (Clinic clinicCur in listClinics)
                {
                    comboClinic.Items.Add(clinicCur.Abbr);
                    _listUserClinicNums.Add(clinicCur.ClinicNum);
                    if (Clinics.ClinicNum == clinicCur.ClinicNum)                   //set selected index to the currently selected clinic in FormOpenDental
                    {
                        _selectedClinicNum        = clinicCur.ClinicNum;
                        comboClinic.SelectedIndex = comboClinic.Items.Count - 1;
                    }
                }
            }
            _dictClinicListProgProps = ProgramProperties.GetForProgram(_progCur.ProgramNum) //get list of all props for the program
                                       .GroupBy(x => x.ClinicNum)                           //group each clinic
                                       .ToDictionary(x => x.Key, x => x.ToList());          //turn list into a dictionary of key=ClinicNum, value=List<ProgramProperty> for the clinic
            DateTime dateTSend = PrefC.GetDateT(PrefName.TransworldServiceTimeDue);

            if (dateTSend != DateTime.MinValue)
            {
                textUpdatesTimeOfDay.Text = dateTSend.ToShortTimeString();
            }
            comboSendFrequencyUnits.Items.AddRange(Enum.GetNames(typeof(FrequencyUnit)));
            string[] sendFreqStrs = PrefC.GetString(PrefName.TransworldServiceSendFrequency).Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            if (sendFreqStrs.Length == 2)
            {
                int           sendFreq = PIn.Int(sendFreqStrs[0], false);
                FrequencyUnit sendFreqUnit;
                if (sendFreq > 0 && Enum.TryParse(sendFreqStrs[1], out sendFreqUnit))
                {
                    numericSendFrequency.Value            = sendFreq;
                    comboSendFrequencyUnits.SelectedIndex = (int)sendFreqUnit;
                }
            }
            else              //if not set, default to repeat once a day
            {
                comboSendFrequencyUnits.SelectedIndex = (int)FrequencyUnit.Days;
                numericSendFrequency.Value            = 1;
            }
            FillComboBoxes();
            FillFields();
        }
Beispiel #29
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (comboType.SelectedIndex == -1)
            {
                MsgBox.Show(this, "Please pick a type first.");
                return;
            }
            if (textDateDue.errorProvider1.GetError(textDateDue) != "" ||
                textYears.errorProvider1.GetError(textYears) != "" ||
                textMonths.errorProvider1.GetError(textMonths) != "" ||
                textWeeks.errorProvider1.GetError(textWeeks) != "" ||
                textDays.errorProvider1.GetError(textDays) != "" ||
                textBalance.errorProvider1.GetError(textBalance) != "" ||
                textDisableDate.errorProvider1.GetError(textDisableDate) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            double disableUntilBalance = PIn.Double(textBalance.Text);

            if (disableUntilBalance < 0)
            {
                MsgBox.Show(this, "Disabled balance must be greater than zero.");
                return;
            }
            RecallCur.RecallTypeNum         = _listRecallTypes[comboType.SelectedIndex].RecallTypeNum;
            RecallCur.IsDisabled            = checkIsDisabled.Checked;
            RecallCur.DisableUntilBalance   = disableUntilBalance;
            RecallCur.DisableUntilDate      = PIn.Date(textDisableDate.Text);
            RecallCur.DateDue               = PIn.Date(textDateDue.Text);
            RecallCur.RecallInterval.Years  = PIn.Int(textYears.Text);
            RecallCur.RecallInterval.Months = PIn.Int(textMonths.Text);
            RecallCur.RecallInterval.Weeks  = PIn.Int(textWeeks.Text);
            RecallCur.RecallInterval.Days   = PIn.Int(textDays.Text);
            if (comboStatus.SelectedIndex == 0)
            {
                RecallCur.RecallStatus = 0;
            }
            else
            {
                RecallCur.RecallStatus
                    = _listRecallUnschedStatusDefs[comboStatus.SelectedIndex - 1].DefNum;
            }
            RecallCur.Note     = textNote.Text;
            RecallCur.Priority = (checkASAP.Checked ? RecallPriority.ASAP : RecallPriority.Normal);
            if (IsNew)
            {
                //if(Recalls.IsAllDefault(RecallCur)){//only save if something meaningful
                //	MsgBox.Show(this,"Recall cannot be saved if all values are still default.");
                //	return;
                //}
                Recalls.Insert(RecallCur);
                SecurityLogs.MakeLogEntry(Permissions.RecallEdit, RecallCur.PatNum, "Recall added from the Edit Recall window.");
            }
            else
            {
                /*if(Recalls.IsAllDefault(RecallCur)){
                 *      if(!MsgBox.Show(this,true,"All values are default.  This recall will be deleted.  Continue?")){
                 *              return;
                 *      }
                 *      Recalls.Delete(RecallCur);
                 *      DialogResult=DialogResult.OK;
                 *      return;
                 * }
                 * else{*/
                Recalls.Update(RecallCur);
                SecurityLogs.MakeLogEntry(Permissions.RecallEdit, RecallCur.PatNum, "Recall edited from the Edit Recall window.");
                //}
            }
            //Recalls.Synch(PatCur.PatNum,RecallCur);//This was moved up into FormRecallsPat.FillGrid.  This is the only way to access a recall.
            DialogResult = DialogResult.OK;
        }
Beispiel #30
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (validNumX.errorProvider1.GetError(validNumX) != ""
                | validNumY.errorProvider1.GetError(validNumY) != "")
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }
            bool changed = false;

            if (Prefs.UpdateString(PrefName.MainWindowTitle, textMainWindowTitle.Text)
                | Prefs.UpdateLong(PrefName.ShowIDinTitleBar, comboShowID.SelectedIndex)
                | Prefs.UpdateBool(PrefName.TaskListAlwaysShowsAtBottom, checkTaskListAlwaysShow.Checked)
                | Prefs.UpdateBool(PrefName.TasksCheckOnStartup, checkTasksCheckOnStartup.Checked)
                | Prefs.UpdateBool(PrefName.TasksNewTrackedByUser, checkTasksNewTrackedByUser.Checked)
                | Prefs.UpdateBool(PrefName.TasksShowOpenTickets, checkShowOpenTickets.Checked)
                | Prefs.UpdateBool(PrefName.TitleBarShowSite, checkTitleBarShowSite.Checked)
                | Prefs.UpdateString(PrefName.WebServiceServerName, textWebServiceServerName.Text)
                | Prefs.UpdateBool(PrefName.ReportsPPOwriteoffDefaultToProcDate, checkReportsProcDate.Checked)
                | Prefs.UpdateBool(PrefName.ReportsShowPatNum, checkReportsShowPatNum.Checked)
                | Prefs.UpdateBool(PrefName.ReportPandIschedProdSubtractsWO, checkReportProdWO.Checked)
                )
            {
                changed = true;
            }
            //task list------------------------------------------------------------------------------------------
            if (ComputerPrefs.LocalComputer.TaskKeepListHidden != checkBoxTaskKeepListHidden.Checked)
            {
                ComputerPrefs.LocalComputer.TaskKeepListHidden = checkBoxTaskKeepListHidden.Checked;
                changed = true;              //needed to trigger screen refresh
            }
            if (radioBottom.Checked && ComputerPrefs.LocalComputer.TaskDock != 0)
            {
                ComputerPrefs.LocalComputer.TaskDock = 0;
                changed = true;
            }
            else if (!radioBottom.Checked && ComputerPrefs.LocalComputer.TaskDock != 1)
            {
                ComputerPrefs.LocalComputer.TaskDock = 1;
                changed = true;
            }
            if (ComputerPrefs.LocalComputer.TaskX != PIn.Int(validNumX.Text))
            {
                ComputerPrefs.LocalComputer.TaskX = PIn.Int(validNumX.Text);
                changed = true;
            }
            if (ComputerPrefs.LocalComputer.TaskY != PIn.Int(validNumY.Text))
            {
                ComputerPrefs.LocalComputer.TaskY = PIn.Int(validNumY.Text);
                changed = true;
            }
            //end of tasklist section-----------------------------------------------------------------------------
            if (textSigInterval.Text == "")
            {
                if (Prefs.UpdateLong(PrefName.ProcessSigsIntervalInSecs, 0))
                {
                    changed = true;
                }
            }
            else
            {
                if (Prefs.UpdateLong(PrefName.ProcessSigsIntervalInSecs, PIn.Long(textSigInterval.Text)))
                {
                    changed = true;
                }
            }
            if (changed)
            {
                DataValid.SetInvalid(InvalidType.Prefs, InvalidType.Computers);
                ComputerPrefs.Update(ComputerPrefs.LocalComputer);
            }
            DialogResult = DialogResult.OK;
        }