protected void PrescriptionInfoDataSource_Updating(object sender, LinqDataSourceUpdateEventArgs e)
    {
        var prescription = (Prescription)e.NewObject;

        // set the prescribed date for the new object to be updated
        var date = ((TemplateControls_DatePicker)PrescriptionInfoFormView.FindControl("DatePicker")).SelectedDate;

        prescription.Date = date;
    }
示例#2
0
    protected void LabOrderInfoDataSource_Updating(object sender, LinqDataSourceUpdateEventArgs e)
    {
        var labOrder = (LabOrder)e.NewObject;

        // set the order date
        var date = ((TemplateControls_DatePicker)LabOrderInfoFormView.FindControl("DatePicker")).SelectedDate;

        labOrder.Date = date;
    }
示例#3
0
    //<Snippet1>
    protected void LinqDataSource_Updating(object sender, LinqDataSourceUpdateEventArgs e)
    {
        Product originalProduct = (Product)e.OriginalObject;
        Product newProduct      = (Product)e.NewObject;

        if (originalProduct.Category != newProduct.Category)
        {
            newProduct.CategoryChanged = true;
        }
    }
    protected void DoctorDetailsDataSource_Updating(object sender, LinqDataSourceUpdateEventArgs e)
    {
        // get the new object
        var newObject = (Doctor)e.NewObject;

        // get the controls from the view
        var dateOfBirthDatePicker = (TemplateControls_DatePicker)
                                    DoctorDetailsFormView.FindControl("DateOfBirthDatePicker");

        // set the date for the new object
        newObject.DateOfBirth = dateOfBirthDatePicker.SelectedDate;
    }
示例#5
0
        protected void applicationsLinqDataSource_Updating(object sender, LinqDataSourceUpdateEventArgs e)
        {
            CprBroker.Data.Applications.Application newApp = e.NewObject as CprBroker.Data.Applications.Application;
            CprBroker.Data.Applications.Application orgApp = e.OriginalObject as CprBroker.Data.Applications.Application;

            // Approved date
            if (newApp.IsApproved && !orgApp.IsApproved)
            {
                newApp.ApprovedDate = DateTime.Now;
            }
            if (!newApp.IsApproved)
            {
                newApp.ApprovedDate = null;
            }
        }
    protected void VisitDetailsDataSource_Updating(object sender, LinqDataSourceUpdateEventArgs e)
    {
        var newObject = (Visit)e.NewObject;

        // get the ICD drop down list from the formview
        var dl = (DropDownList)VisitDetailsFormView.FindControl("ICDDropdownList");

        // set the ICDID for the new object to be updated
        newObject.ICDID = long.Parse(dl.SelectedValue);

        // get the date picker from the formview
        var date = ((TemplateControls_DatePicker)VisitDetailsFormView.FindControl("DatePicker")).SelectedDate;

        // set the new date for the visit
        newObject.Date = date;
    }
示例#7
0
        protected void ldsDataCollector_Updating(object sender, LinqDataSourceUpdateEventArgs e)
        {
            MetricTrac.Bll.DataRule drOld = (MetricTrac.Bll.DataRule)e.OriginalObject;
            MetricTrac.Bll.DataRule drNew = (MetricTrac.Bll.DataRule)e.NewObject;

            if (drOld.RuleClusterID != null)
            {
                MetricTrac.Bll.DataRule.DeleteOrgLocationsClusterList((Guid)drOld.RuleClusterID, (Guid?)drOld.DataRuleID);
            }
            drNew.OrgLocationID = (SelectOrgLocationsID.Length > 0) ? SelectOrgLocationsID[0] : null;
            if (SelectOrgLocationsID.Length > 1 && drOld.RuleClusterID == null)
            {
                drNew.RuleClusterID = Guid.NewGuid();
            }

            if (SelectOrgLocationsID.Length <= 1 && drOld.RuleClusterID != null)
            {
                drNew.RuleClusterID = null;
            }
        }
        protected void ldsGroups_Updating(object sender, LinqDataSourceUpdateEventArgs e)
        {
            ((Group)e.NewObject).Name = ((Group)e.NewObject).Name.Trim();
            ((Group)e.NewObject).Tag  = ((Group)e.NewObject).Tag.Trim();

            //Group group = (Group) e.NewObject;

            //using (CSSDataContext db = new CSSDataContext())
            //{
            //    if (String.IsNullOrEmpty(group.Name) == true)
            //    {
            //        ValidationMessage = "Name cannot be empty.";
            //        e.Cancel = true;
            //    }
            //    else if (db.Groups.FirstOrDefault(p => p.Name == group.Name.Trim() && p.Id != group.Id) != null)
            //    {
            //        ValidationMessage = "Name is already used .";
            //        e.Cancel = true;
            //    }

            //}
        }
    protected void LinqDataSource1_Updating(object sender, LinqDataSourceUpdateEventArgs e)
    {
        lblError.Visible = true;
        PersonInfo p = e.NewObject as PersonInfo;

        /*if (p.SpouseID == 0) p.SpouseID = null;
         * if (p.OccupationID == 0) p.OccupationID = null;
         * if (p.FatherID == 0) p.Father = null;
         * if (p.ManagedBy == 0) p.ManagedBy = null;*/

        using (MyFamilyDatabaseDataContext db = new MyFamilyDatabaseDataContext())
        {
            //Validate if other person's Spouse is not someone else
            PersonInfo spouse = null;
            if (p.SpouseID != null && p.SpouseID != 0)
            {
                spouse = db.PersonInfos.Where(sp => sp.PersonID == p.SpouseID).FirstOrDefault();

                //If Spouse is already married to someone else
                if (spouse.SpouseID != 0 && spouse.SpouseID != null && spouse.SpouseID != p.PersonID)
                {
                    lblError.Text    = "Spouse is invalid. <a href='./PersonInfo.aspx?PersonID=" + spouse.PersonID + "'>" + spouse.FullName + "</a> is already married to " + spouse.Spouse.FullName;
                    lblError.Visible = true;
                    e.Cancel         = true;
                    return;
                }

                //If Spouse gender is same
                if (p.Gender == spouse.Gender)
                {
                    lblError.Text    = "Spouse is invalid. Both can't have same gender.";
                    lblError.Visible = true;
                    e.Cancel         = true;
                    return;
                }
            }
        }
    }
示例#10
0
        protected void ldsMetricValue_Updating(object sender, LinqDataSourceUpdateEventArgs e)
        {
            // save previous value
            MetricTrac.Bll.MetricValue.Extend OldMetricValue = MVS;
            // get new data
            string Value = String.Empty;

            if (rntValue.Visible)
            {
                Value = rntValue.Value.ToString();
            }
            else
            if (tbValue.Visible)
            {
                Value = tbValue.Text;
            }
            else
            if (chbValue.Visible)
            {
                Value = chbValue.Checked ? bool.TrueString : bool.FalseString;
            }
            else
            if (rdpDateValue.Visible)
            {
                Value = rdpDateValue.SelectedDate.ToString();
            }
            ValueArgument = Value;
            Guid?ActualUoMID = null;

            if (!String.IsNullOrEmpty(ddlInputUnitOfMeasure.SelectedValue))
            {
                ActualUoMID = new Guid(ddlInputUnitOfMeasure.SelectedValue);
            }
            string CustomMetricAlias = null; // if pass null to Isert/Update - nothing changed. It's possible if custom names disabled or bulk edit
            string CustomMetricCode  = null;

            if (MVS.AllowMetricCustomNames)
            {
                CustomMetricAlias = tbAlias.Text;
                CustomMetricCode  = tbCode.Text;
            }

            bool?Approved = false;

            switch (ddlApprovalStatus.SelectedValue)
            {
            case "":
                Approved = null;
                break;

            case "True":
                Approved = true;
                break;

            case "False":
            default:
                Approved = false;
                break;
            }
            ValueArgument = Value + "|" + Approved.ToString();
            string comments     = tbComments.Text;
            string Notes        = ((Micajah.Common.WebControls.TextBox)mfMetricValue.FindFieldControl("Notes")).Text;
            Guid   CurentUserId = Micajah.Common.Security.UserContext.Current.UserId;
            //------------------------------

            Guid _ValueID = Bll.MetricValue.InsertOrUpdate(
                MetricID,
                OperationDate,
                OrgLocationID,
                !FilesUpload.IsEmpty,
                Mode == DataMode.Approve,
                ActualUoMID,
                OldMetricValue.Value,
                Value,
                OldMetricValue.Approved,
                Approved,
                CurentUserId,
                Notes,
                CustomMetricAlias,
                CustomMetricCode);

            if (_ValueID != Guid.Empty)
            {
                FilesUpload.LocalObjectId = _ValueID.ToString();
                if (!FilesUpload.AcceptChanges())
                {
                    if (FilesUpload.ErrorOccurred)
                    {
                        string _errorMessage = String.Empty;
                        foreach (string s in FilesUpload.ErrorMessages)
                        {
                            _errorMessage += s + "\n";
                        }
                        this.ErrorMessage = _errorMessage;
                    }
                }
            }
            else // change this error handler after adding central error tracker
            {
                this.ErrorMessage = "Unable to save changes. Please, try again later.";
            }
            Bll.MetricValue.Extend NewMetricValue = Bll.MetricValue.Get(MetricID, OperationDate, OrgLocationID);
            Bll.Mc_User.Extend     mue            = Bll.Mc_User.GetValueInputUser(OldMetricValue.MetricValueID);
            // build mail to data collector if status or comment were changed
            if ((Mode == DataMode.Approve) && ((!String.IsNullOrEmpty(comments)) || (OldMetricValue.Approved != NewMetricValue.Approved)))
            {
                string MailCaption = OldMetricValue.Approved != NewMetricValue.Approved ? "MetricTrac - Value Status is changed" : "SustainApp - Value has new comment from Data Approver";
                if (OldMetricValue.Approved != NewMetricValue.Approved)
                {
                    Bll.MetricValueChangeLog.LogChange(NewMetricValue.MetricValueID,
                                                       Bll.MetricValueChangeTypeEnum.StatusChanged,
                                                       OldMetricValue.ApprovalStatus,
                                                       NewMetricValue.ApprovalStatus,
                                                       Utils.Mail.BuildLogMessageBody(OldMetricValue, NewMetricValue, comments, Micajah.Common.Security.UserContext.Current, mue, Bll.MetricValueChangeTypeEnum.StatusChanged));
                }
                else
                {
                    Bll.MetricValueChangeLog.LogChange(NewMetricValue.MetricValueID,
                                                       Bll.MetricValueChangeTypeEnum.CommentToDataCollector,
                                                       null,
                                                       comments,
                                                       Utils.Mail.BuildLogMessageBody(OldMetricValue, NewMetricValue, comments, Micajah.Common.Security.UserContext.Current, mue, Bll.MetricValueChangeTypeEnum.CommentToDataCollector));
                }
                if (NewMetricValue.Approved == null && mue != null)
                {
                    Utils.Mail.Send(mue.Email, mue.FullName, MailCaption, Utils.Mail.BuildEmailBody(OldMetricValue, NewMetricValue, comments, Micajah.Common.Security.UserContext.Current));
                }
            }


            // record in change log
            // first time value entered
            if (OldMetricValue.MetricValueID == Guid.Empty)
            {
                Bll.MetricValueChangeLog.LogChange(NewMetricValue.MetricValueID,
                                                   MetricTrac.Bll.MetricValueChangeTypeEnum.ValueEntered,
                                                   String.Empty,
                                                   NewMetricValue.Value,
                                                   Utils.Mail.BuildLogMessageBody(OldMetricValue, NewMetricValue, Notes, Micajah.Common.Security.UserContext.Current, mue, MetricTrac.Bll.MetricValueChangeTypeEnum.ValueEntered));
            }
            else
            {
                // value changed
                if (OldMetricValue.Value != NewMetricValue.Value)
                {
                    Bll.MetricValueChangeLog.LogChange(MVS.MetricValueID,
                                                       MetricTrac.Bll.MetricValueChangeTypeEnum.ValueChanged,
                                                       OldMetricValue.Value,
                                                       NewMetricValue.Value,
                                                       Utils.Mail.BuildLogMessageBody(OldMetricValue, NewMetricValue, Notes, Micajah.Common.Security.UserContext.Current, mue, MetricTrac.Bll.MetricValueChangeTypeEnum.ValueChanged));
                }
                // notes changed
                if (OldMetricValue.Notes != NewMetricValue.Notes)
                {
                    Bll.MetricValueChangeLog.LogChange(MVS.MetricValueID,
                                                       MetricTrac.Bll.MetricValueChangeTypeEnum.NoteChanged,
                                                       OldMetricValue.Notes,
                                                       NewMetricValue.Notes,
                                                       Utils.Mail.BuildLogMessageBody(OldMetricValue, NewMetricValue, Notes, Micajah.Common.Security.UserContext.Current, mue, MetricTrac.Bll.MetricValueChangeTypeEnum.NoteChanged));
                }
            }

            e.Cancel = true;
        }
示例#11
0
 protected void HospitalDetailsDataSource_Updating(object sender, LinqDataSourceUpdateEventArgs e)
 {
 }