protected void AddDoctorDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e) { // get the date picker var datePicker = ((TemplateControls_DatePicker)AddDoctorFormView.FindControl("DateOfBirthDatePicker")); // set the date of birth ((Doctor)e.NewObject).DateOfBirth = datePicker.SelectedDate; }
protected void AddPatientDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e) { // get the date picker control from the form view var datePicker = (TemplateControls_DatePicker)AddPatientFormView.FindControl("DateOfBirthDatePicker"); // set the date of birth of the new patient ((Patient)e.NewObject).DateOfBirth = datePicker.SelectedDate; }
void registryDS_Inserting(object sender, LinqDataSourceInsertEventArgs e) { var item = e.NewObject as CentralRegistry; if (item.ItemDate == DateTime.MinValue) { item.ItemDate = null; } }
protected void AddLabOrderDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e) { var labOrder = (LabOrder)e.NewObject; // set the visit ID for the new lab order labOrder.VisitID = long.Parse(Request.QueryString["VisitID"]); // set the order date for the new lab order labOrder.Date = ((TemplateControls_DatePicker)AddLabOrderFormView.FindControl("DatePicker")).SelectedDate; }
protected void AddPrescriptionDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e) { var newPrescription = (Prescription)e.NewObject; // set the prescription date newPrescription.Date = ((TemplateControls_DatePicker)AddPrescriptionFormView.FindControl("DatePicker")).SelectedDate; // set doctor ID newPrescription.DoctorID = long.Parse(((DropDownList)AddPrescriptionFormView.FindControl("DoctorsDropdownList")).SelectedValue); }
protected void AddlabOrderDetailDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e) { // get the new object to be inserted var labOrderDetail = (LabOrderDetail)e.NewObject; // set the lab order ID labOrderDetail.LabOrderID = long.Parse(Request.QueryString["LabOrderID"]); // set the medical service ID var dl = (DropDownList)AddLabOrderDetailFormView.FindControl("MedicalServicesDropdownList"); labOrderDetail.MedicalServiceID = long.Parse(dl.SelectedValue); }
protected void AddPrescriptionDetailDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e) { // get the new object to be inserted var prescriptionDetail = (PrescriptionDetail)e.NewObject; // set the prescription ID property for it prescriptionDetail.PrescriptionID = long.Parse(Request.QueryString["PrescriptionID"]); // set the drug ID property for it var dl = (DropDownList)AddPrescriptionDetailFormView.FindControl("DrugsDropdownList"); prescriptionDetail.DrugID = long.Parse(dl.SelectedValue); }
protected void LinqDataSource1_Inserting(object sender, LinqDataSourceInsertEventArgs e) { lblErrors.Visible = false; PersonInfo p = e.NewObject as PersonInfo; if (p == null) { e.Cancel = true; return; } if (string.IsNullOrEmpty(p.FullName)) { e.Cancel = true; return; } using (MyFamilyDatabaseDataContext db = new MyFamilyDatabaseDataContext()) { //Validate if other person's Spouse is not defined. 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) { lblErrors.Text = "Spouse is invalid. <a href='./PersonInfo.aspx?PersonID=" + spouse.PersonID + "'>" + spouse.FullName + "</a> is already married to " + spouse.Spouse.FullName; lblErrors.Visible = true; e.Cancel = true; return; } //If Spouse gender is same if (p.Gender == spouse.Gender) { lblErrors.Text = "Spouse is invalid. Both can't have same gender."; lblErrors.Visible = true; e.Cancel = true; return; } } //Get New ID int newPersonId = db.PersonInfos.Max(person => person.PersonID) + 1; p.PersonID = newPersonId; } }
protected void AddVisitDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e) { // get the new visit to be inserted var newVisit = (Visit)e.NewObject; // get the value from the formview var icd = ((DropDownList)AddVisitFormView.FindControl("ICDDropdownList")).SelectedValue; var date = ((TemplateControls_DatePicker)AddVisitFormView.FindControl("DatePicker")).SelectedDate; var patientID = ((HiddenField)AddVisitFormView.FindControl("PatientIDField")).Value; // set the new value newVisit.ICDID = long.Parse(icd); newVisit.Date = date; newVisit.PatientID = long.Parse(patientID); }
protected void dsMetricFilter_Inserting1(object sender, LinqDataSourceInsertEventArgs e) { Guid?[] SelectedOrgLocationsID = ((MetricTrac.Control.OrglocationMultipick)mfSaveFilter.FindControl("orgLocationSelect1")).OrgLocationsID; if (SelectedOrgLocationsID != null) { if (SelectedOrgLocationsID.Length > 0) { string LocationsId = MetricTrac.Bll.MetricValue.GetLocationsEncodedString(SelectedOrgLocationsID, ','); if (!String.IsNullOrEmpty(LocationsId)) { ((MetricTrac.Bll.MetricFilter)e.NewObject).OrgLocations = LocationsId; } } } }
protected void applicationsLinqDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e) { e.Cancel = true; CprBroker.Data.Applications.Application newApp = e.NewObject as CprBroker.Data.Applications.Application; var result = Manager.Admin.RequestAppRegistration(Constants.UserToken, Constants.BaseApplicationToken.ToString(), newApp.Name); Master.AppendErrorIfPossible(result); if (StandardReturType.IsSucceeded(result.StandardRetur)) { if (newApp.IsApproved) { var approveResult = Manager.Admin.ApproveAppRegistration(Constants.UserToken, Constants.BaseApplicationToken.ToString(), result.Item.Token); Master.AppendErrorIfPossible(approveResult); } } applicationsGridView.DataBind(); newApplicationDetailsView.DataBind(); }
protected void LinqDataSource2_Inserting(object sender, LinqDataSourceInsertEventArgs e) { news n = (news)e.NewObject; dbcms db = new dbcms(); try { n.id = db.news.Max(d => d.id) + 1; } catch { n.id = 1; } n.ndate = DateTime.Now; n.ping = 0; n.hit = 0; }
protected void dsScoreCardMetric_Inserting(object sender, LinqDataSourceInsertEventArgs e) { }
protected void AddHospitalDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e) { }
protected void ldsPerformanceIndicator_Inserting(object sender, LinqDataSourceInsertEventArgs e) { InsertedPerformanceIndicator = (MetricTrac.Bll.PerformanceIndicator)e.NewObject; }
//<Snippet1> protected void LinqDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e) { Product product = (Product)e.NewObject; product.DateModified = DateTime.Now; }