protected void btnAdd_Click(object sender, EventArgs e) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { Petient petient = new Petient(); petient.Id = Guid.NewGuid(); petient.First_Name = txtFirstName.Text; petient.Last_Name = txtLastName.Text; petient.Sex = ddlSex.Text; petient.Age = short.Parse(txtAge.Text); petient.Job = txtJob.Text; petient.Country = txtCountry.Text; petient.City = txtCity.Text; petient.City_Location = txtCityLocation.Text; petient.Address = txtAddress.Text; petient.Mobile = txtMobile.Text; petient.Phone = txtPhone.Text; petient.Email = txtEmail.Text; if (ddlIntro.Text != SharedClass.GetIntroducer(SharedClass.IntroType.Others)) { petient.Introducer = ddlIntro.Text; } else { petient.Introducer = txtIntro.Text; } mc.Petients.Add(petient); mc.SaveChanges(); grvPetient.EditIndex = -1; } }
protected void btnSet_Click(object sender, EventArgs e) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { var petientId = Guid.Parse(Request["ID"]); var selectedService = (ucServicesControl.SelectedService != ucServicesControl.OthersValue) ? ucServicesControl.SelectedService : null; var selectedParts = ucServicesControl.SelectedParts; var dateToVisit = cal.Date.Value; var timeToVisit = TimePickerControl.Time.TimeOfDay; var visitingTimeDate = new DateTime(dateToVisit.Year, dateToVisit.Month, dateToVisit.Day, timeToVisit.Hours, timeToVisit.Minutes, 0); var allocatedTime = allocateTimeForPetient(visitingTimeDate, ddlDoctor.SelectedValue, ddlTech.SelectedValue, selectedService); if (allocatedTime == null) { //TODO: Error on allocating time return; } Petient_Visiting_Financial visitingFile = new Petient_Visiting_Financial(); visitingFile.TimeVisitStarts = allocatedTime[0]; //Start visitingFile.TimeVisitEnds = allocatedTime[1]; //End visitingFile.Is_Petient_Returned = false; visitingFile.Is_Money_Paid = false; visitingFile.Is_Petient_Visited = false; visitingFile.Is_Petient_Canceled = false; if (ucServicesControl.SelectedService != ucServicesControl.OthersValue) { visitingFile.Money_To_Pay = costOfService(ucServicesControl.SelectedService); visitingFile.Reason = null; } else { visitingFile.Money_To_Pay = 0; visitingFile.Reason = ucServicesControl.ReasonValue; } visitingFile.Money_Changed = 0; visitingFile.Money_Paid_Cash = 0; visitingFile.Money_Paid_Card = 0; visitingFile.POS_Name = null; int lastBalance = 0; var petientVisitingFiles = mc.Connectors.Where(o => o.PetientId == petientId && o.FinancialId != null && o.Petient_Visiting_Financials.TimeVisitStarts < visitingFile.TimeVisitStarts) .OrderByDescending(o => o.Petient_Visiting_Financials.TimeVisitStarts).ToList(); if (petientVisitingFiles.Count() != 0) { lastBalance = petientVisitingFiles.First().Petient_Visiting_Financials.Balance; } visitingFile.Balance = lastBalance + visitingFile.Money_To_Pay; mc.Petient_Visiting_Financials.Add(visitingFile); createConnections(mc, selectedService, petientId, visitingFile.Id, selectedParts); mc.SaveChanges(); } }
protected void btnDeleteFile_Click(object sender, EventArgs e) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { var btnDelete = (Button)sender; long fileId = long.Parse(btnDelete.CommandArgument); mc.Petient_Files.Remove(mc.Petient_Files.Where(o => o.Id == fileId).First()); mc.SaveChanges(); } }
protected void btnSignUp_Click(object sender, EventArgs e) { if (txtPassword.Text != txtVerifyPassword.Text) { lblErrorSignup.Text = passNotTheSame; return; } else { lblErrorSignup.Text = ""; } var userStore = new UserStore<IdentityUser>(); var userManager = new UserManager<IdentityUser>(userStore); var user = new IdentityUser() { UserName = txtUsername.Text, Email = txtEmail.Text, EmailConfirmed = true }; IdentityResult result = userManager.Create(user, txtPassword.Text); if (result.Succeeded == true) { result = userManager.AddToRole(user.Id, ddlRole.Text); if (result.Succeeded == true) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { BSI__Clinic_Employee employee = new BSI__Clinic_Employee(); employee.Id = user.Id; employee.First_Name = txtFirstName.Text; employee.Last_Name = txtLastName.Text; employee.Created_Date = DateTime.Now; employee.Last_Login = DateTime.Now; employee.Job_Clinic = ddlJobClinic.Text; mc.BSI__Clinic_Employees.Add(employee); mc.SaveChanges(); } } lblErrorSignup.Text = ""; } else { lblErrorSignup.Text = result.Errors.First(); } }
protected void btnSave_Click(object sender, EventArgs e) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { foreach (RepeaterItem item in rptService.Items) { var chkService = ((CheckBox)item.FindControl("chkService")); int serviceId = int.Parse(((Label)item.FindControl("lblId")).Text); short minsForService = short.Parse(((TextBox)item.FindControl("txtMinsForService")).Text); var txtPortion = ((TextBox)item.FindControl("txtPortion")); var employeeId = Request["ID"]; var currentEmployeeService = mc.BSI__Employee_Service_Set.Where(o => o.Employee_Id == employeeId && o.Service_Id == serviceId).ToList(); if (chkService.Checked == true && chkService.Enabled == true) { if (currentEmployeeService.Count() == 0) { BSI__Employee_Service employeeService = new BSI__Employee_Service(); employeeService.Service_Id = serviceId; employeeService.Employee_Id = employeeId; employeeService.Mins_For_Service = minsForService; mc.BSI__Employee_Service_Set.Add(employeeService); addPart(employeeService.Service_Id, employeeId); } else { currentEmployeeService.First().Mins_For_Service = minsForService; editPart(currentEmployeeService.First().Service_Id, employeeId); } } else if(chkService.Enabled == true) { if (currentEmployeeService.Count() != 0) { mc.BSI__Employee_Service_Set.Remove(currentEmployeeService.First()); deletePart(currentEmployeeService.First().Service_Id, employeeId); } } } mc.SaveChanges(); } }
protected void login_Authenticate(object sender, AuthenticateEventArgs e) { var userStore = new UserStore<IdentityUser>(); var manager = new UserManager<IdentityUser>(userStore); var user = manager.Find(login.UserName, login.Password); if (user != null) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { var employee = mc.BSI__Clinic_Employees.Where(o => o.Id == user.Id).First(); if(employee.Is_Active != true) { return; } employee.Last_Login = DateTime.Now; mc.SaveChanges(); } FormsAuthentication.RedirectFromLoginPage(user.Id, false); } }
private void editPart(int? parentServiceId, string employeeId) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { var parts = mc.BSI__Clinic_Services.Where(o => o.Parent_Id == parentServiceId && o.Is_Part == true).ToList(); if (parts.Count() != 0) { foreach (RepeaterItem item in rptService.Items) { int partId = int.Parse(((Label)item.FindControl("lblId")).Text); if (parts.Where(o => o.Id == partId).Count() != 0) { short minsForService = short.Parse(((TextBox)item.FindControl("txtMinsForService")).Text); var employeePart = mc.BSI__Employee_Service_Set.Where(o => o.Employee_Id == employeeId && o.Service_Id == partId).First(); employeePart.Mins_For_Service = minsForService; } } mc.SaveChanges(); } } }
private void deletePart(int? parentServiceId, string employeeId) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { var parts = mc.BSI__Clinic_Services.Where(o => o.Parent_Id == parentServiceId && o.Is_Part == true).ToList(); foreach (var part in parts) { var employeePartToDelete = mc.BSI__Employee_Service_Set.Where(o => o.Service_Id == part.Id && o.Employee_Id == employeeId).ToList(); if (employeePartToDelete.Count() != 0) { mc.BSI__Employee_Service_Set.Remove(employeePartToDelete.First()); } } mc.SaveChanges(); } }
protected void grvPetient_RowUpdating(object sender, GridViewUpdateEventArgs e) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { GridViewRow row = grvPetient.Rows[e.RowIndex]; Guid id = Guid.Parse(grvPetient.DataKeys[e.RowIndex].Value.ToString()); Petient petient = mc.Petients.Where(o => o.Id == id).First(); petient.First_Name = ((TextBox)row.FindControl("txtFirstName")).Text; petient.Last_Name = ((TextBox)row.FindControl("txtLastName")).Text; petient.Sex = ((DropDownList)row.FindControl("ddlSex")).Text; petient.Age = short.Parse(((TextBox)row.FindControl("txtAge")).Text); petient.Job = ((TextBox)row.FindControl("txtJob")).Text; petient.Country = ((TextBox)row.FindControl("txtCountry")).Text; petient.City = ((TextBox)row.FindControl("txtCity")).Text; petient.City_Location = ((TextBox)row.FindControl("txtCityLocation")).Text; petient.Address = ((TextBox)row.FindControl("txtAddress")).Text; petient.Mobile = ((TextBox)row.FindControl("txtMobile")).Text; petient.Phone = ((TextBox)row.FindControl("txtPhone")).Text; petient.Email = ((TextBox)row.FindControl("txtEmail")).Text; var intro = ((DropDownList)row.FindControl("ddlIntro")).Text; if (intro != SharedClass.GetIntroducer(SharedClass.IntroType.Others)) { petient.Introducer = intro; } else { petient.Introducer = ((TextBox)row.FindControl("txtIntro")).Text; ; } mc.SaveChanges(); } grvPetient.EditIndex = -1; }
protected void grvPetient_RowDeleting(object sender, GridViewDeleteEventArgs e) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { Guid id = Guid.Parse(grvPetient.DataKeys[e.RowIndex].Value.ToString()); mc.Petients.Remove(mc.Petients.Where(o => o.Id == id).First()); mc.SaveChanges(); } }
protected void btnEdit_Click(object sender, EventArgs e) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { var financialId = (Request["FinancialID"] != null) ? long.Parse(Request["FinancialID"]) : (long?)null; long fileId = long.Parse(Request["ID"]); var fileToEdit = mc.Petient_Files.Where(o => o.Id == fileId).First(); if (fileToEdit.Connectors.Where(o => o.FinancialId != null).Count() != 0) { fileToEdit.Details = txtDetailsFinancial.Text; } else { string reason = null; int? selectedService = null; List<int> selectedParts = null; getServicesOfFile(financialId, out reason, out selectedService, out selectedParts); fileToEdit.Details = txtDetails.Text; fileToEdit.Reason = reason; createRemoveConnections(mc, selectedService, fileToEdit.Connectors.First().Petient.Id, fileId, selectedParts); } mc.SaveChanges(); if (financialId == null) { Response.Redirect("~/File_Petient.aspx?ID=" + fileToEdit.Connectors.First().Petient.Id); } else { Response.Redirect("~/File_Petient.aspx?ID=" + fileToEdit.Connectors.First().Petient.Id + "&FinancialID=" + financialId); } } }
protected void btnSend_Click(object sender, EventArgs e) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { var financialId = (Request["FinancialID"] != null) ? long.Parse(Request["FinancialID"]) : (long?)null; var petientFile = new Petient_File(); string reason = null; int? selectedService = null; List<int> selectedParts = null; getServicesOfFile(financialId, out reason, out selectedService, out selectedParts); if (financialId != null) { petientFile.Details = txtDetailsFinancial.Text; } else { petientFile.Details = txtDetails.Text; } petientFile.Reason = reason; petientFile.Time = DateTime.Now; mc.Petient_Files.Add(petientFile); createModifyConnections(mc, selectedService, Guid.Parse(Request["ID"]), petientFile.Id, selectedParts); mc.SaveChanges(); } }
protected void btnEdit_Click(object sender, EventArgs e) { if (txtServiceName.Text == ucServicesControl.RootName || txtServiceName.Text == ucServicesControl.OthersName) { return; } var serviceId = int.Parse(ViewState["ServiceToEditId"].ToString()); using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { var serviceToEdit = mc.BSI__Clinic_Services.Where(o => o.Id == serviceId).First(); serviceToEdit.Service_Name = txtServiceName.Text; serviceToEdit.Cost = int.Parse(txtCost.Text); serviceToEdit.Doctor_Base = radioDoctor.Checked; serviceToEdit.Tech_Base = radioTech.Checked; serviceToEdit.Is_Part = chkIsPart.Checked; if (chkIsPart.Checked != true) //A part service inherate its parent's Unit_Name { if (serviceToEdit.Unit_Name == "") { serviceToEdit.Unit_Name = null; } else { serviceToEdit.Unit_Name = ddlUnit.Text; } var partsOfService = serviceToEdit.BSI__Clinic_Services_Child.Where(o => o.Is_Part == true).ToList(); if (partsOfService.Count() != 0) { foreach(var part in partsOfService) { part.Unit_Name = serviceToEdit.Unit_Name; } } } else { serviceToEdit.Unit_Name = serviceToEdit.BSI__Clinic_Services_Parent.Unit_Name; } if (serviceToEdit.Unit_Name != null && txtUnitStandardValue.Text != "") { serviceToEdit.Unit_Standard_Value = short.Parse(txtUnitStandardValue.Text); } else { serviceToEdit.Unit_Standard_Value = null; } if (serviceId != ucServicesControl.SelectedService) { var parentList = mc.BSI__Clinic_Services.Where(o => o.Id == ucServicesControl.SelectedService).ToList(); if (parentList.Count != 0) { if (parentList.First().Is_Part == true) { //TODO: Return error return; } } serviceToEdit.Parent_Id = ucServicesControl.SelectedService; } mc.SaveChanges(); } lblUnit.Visible = true; ddlUnit.Visible = true; btnEditMode.Visible = true; btnDelete.Visible = true; btnAdd.Visible = true; btnEdit.Visible = false; btnCancel.Visible = false; pageReset(); //Rebuild the tree if (serviceId != ucServicesControl.SelectedService) { ucServicesControl.MakeTree(); } }
protected void btnAdd_Click(object sender, EventArgs e) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { if (txtServiceName.Text == ucServicesControl.RootName || txtServiceName.Text == ucServicesControl.OthersName) { return; } BSI__Clinic_Service service = new BSI__Clinic_Service(); service.Service_Name = txtServiceName.Text; service.Cost = int.Parse(txtCost.Text); service.Doctor_Base = radioDoctor.Checked; service.Tech_Base = radioTech.Checked; service.Is_Part = chkIsPart.Checked; var parentList = mc.BSI__Clinic_Services.Where(o => o.Id == ucServicesControl.SelectedService).ToList(); if (parentList.Count() != 0) { if (parentList.First().Is_Part == true) //ERROR: Part can't be parent. { //TODO: Return error return; } service.BSI__Clinic_Services_Parent = parentList.First(); } else if(parentList.Count() == 0 && chkIsPart.Checked == true) //ERROR: Part can't be in root. { //TODO: Return error return; } else { service.BSI__Clinic_Services_Parent = null; } if(chkIsPart.Checked != true) //A part service inherate its parent's Unit_Name { if(service.Unit_Name == "") { service.Unit_Name = null; } else { service.Unit_Name = ddlUnit.Text; } } else { service.Unit_Name = service.BSI__Clinic_Services_Parent.Unit_Name; } if(service.Unit_Name != null) { service.Unit_Standard_Value = short.Parse(txtUnitStandardValue.Text); } else { service.Unit_Standard_Value = null; } mc.BSI__Clinic_Services.Add(service); if (chkIsPart.Checked == true) { addNewPartToEmployeesOfService(mc, service.Id, parentList.First().Id); } mc.SaveChanges(); } pageReset(); ucServicesControl.MakeTree(); }
protected void grvTime_RowUpdating(object sender, GridViewUpdateEventArgs e) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { var row = grvTime.Rows[e.RowIndex]; var financialId = (long)grvTime.DataKeys[e.RowIndex].Value; var financialFile = mc.Petient_Visiting_Financials.Where(o => o.Id == financialId).First(); var petientId = financialFile.Connectors.First().Petient.Id; var chkIsPetientCanceled = (CheckBox)row.FindControl("chkIsPetientCanceled"); //Canceled financialFile.Is_Petient_Canceled = chkIsPetientCanceled.Checked; if (financialFile.Is_Petient_Canceled == true) { //Recalculate Balance On Canceled int lastBalance = 0; var petientVisitingFiles = mc.Connectors.Where(o => o.PetientId == petientId && o.FinancialId != null && o.Petient_Visiting_Financials.TimeVisitStarts < financialFile.TimeVisitStarts) .OrderByDescending(o => o.Petient_Visiting_Financials.TimeVisitStarts).ToList(); if (petientVisitingFiles.Count() != 0) { lastBalance = petientVisitingFiles.ElementAt(petientVisitingFiles.IndexOf(petientVisitingFiles.First())).Petient_Visiting_Financials.Balance; } financialFile.Money_Changed = 0; financialFile.Money_Paid_Cash = 0; financialFile.Money_Paid_Card = 0; financialFile.POS_Name = ""; financialFile.Balance = lastBalance; financialFile.Is_Petient_Returned = false; financialFile.Is_Money_Paid = false; financialFile.Is_Petient_Visited = false; } //Save Changes mc.SaveChanges(); } grvTime.EditIndex = -1; }
protected void grvTime_RowDeleting(object sender, GridViewDeleteEventArgs e) { var id = long.Parse(grvTime.DataKeys[e.RowIndex].Value.ToString()); using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { var financialFileToDelete = mc.Petient_Visiting_Financials.Where(o => o.Id == id).First(); mc.Petient_Visiting_Financials.Remove(financialFileToDelete); mc.SaveChanges(); } }
protected void grvUsers_RowUpdating(object sender, GridViewUpdateEventArgs e) { var row = grvUsers.Rows[e.RowIndex]; var id = grvUsers.DataKeys[e.RowIndex].Value.ToString(); var firstName = ((TextBox)row.FindControl("txtFirstName")).Text; var lastName = ((TextBox)row.FindControl("txtLastName")).Text; var email = ((TextBox)row.FindControl("txtEmail")).Text; var currentPassword = ((TextBox)row.FindControl("txtCurrentPassword")).Text; var newPassword = ((TextBox)row.FindControl("txtNewPassword")).Text; var role = ((DropDownList)row.FindControl("ddlRoleEdit")).Text; var jobClinic = ((DropDownList)row.FindControl("ddlJobClinicEdit")).Text; //TODO: Automatically edit RelationType (exept Writer) on files. var isActive = ((CheckBox)row.FindControl("chkIsActive")).Checked; var userStore = new UserStore<IdentityUser>(); var userManager = new UserManager<IdentityUser>(userStore); var user = userManager.FindById(id); if (user != null && ( userManager.FindById(SharedClass.CurrentUser).UserName == "Admin" || user.UserName != "Admin" )) { if (newPassword != "") { var result = userManager.ChangePassword(id, currentPassword, newPassword); } userManager.SetEmail(id, email); userManager.RemoveFromRoles(id, userManager.GetRoles(id).ToArray()); userManager.AddToRole(id, role); using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { BSI__Clinic_Employee employee = mc.BSI__Clinic_Employees.Where(o => o.Id == id).First(); employee.First_Name = firstName; employee.Last_Name = lastName; employee.Job_Clinic = jobClinic; employee.Is_Active = isActive; mc.SaveChanges(); } } grvUsers.EditIndex = -1; }
protected void grvState_RowUpdating(object sender, GridViewUpdateEventArgs e) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { var row = grvState.Rows[e.RowIndex]; var id = grvState.DataKeys[e.RowIndex].Value; var visitingFile = mc.Petient_Visiting_Financials.Where(o => o.Id == (long)id).First(); var petientId = Guid.Parse(((Label)row.FindControl("lblPetientId")).Text); visitingFile.Is_Petient_Canceled = ((CheckBox)row.FindControl("chkIsPetientCanceled")).Checked; if (visitingFile.Connectors.First().BSI__Employee_Service_Set == null) { visitingFile.Money_To_Pay = int.Parse(((TextBox)row.FindControl("txtMoneyToPay")).Text); } if (visitingFile.Is_Petient_Canceled == false) { var moneyChanged = ((TextBox)row.FindControl("txtMoneyChanged")).Text; visitingFile.Money_Changed = int.Parse(moneyChanged == "" ? "0" : moneyChanged); visitingFile.Money_Paid_Cash = int.Parse(((TextBox)row.FindControl("txtCashPaid")).Text); visitingFile.Money_Paid_Card = int.Parse(((TextBox)row.FindControl("txtCardPaid")).Text); visitingFile.POS_Name = ((DropDownList)row.FindControl("ddlPOS")).Text; visitingFile.Description = ((TextBox)row.FindControl("txtDescription")).Text; visitingFile.Is_Petient_Returned = ((CheckBox)row.FindControl("chkIsPetientReturned")).Checked; visitingFile.Is_Money_Paid = ((CheckBox)row.FindControl("chkIsMoneyPaid")).Checked; visitingFile.Is_Petient_Visited = ((CheckBox)row.FindControl("chkIsPetientVisited")).Checked; var txtOperatorUnitValue = (TextBox)row.FindControl("txtOperatorUnitValue"); if (txtOperatorUnitValue.Visible == true) { if (txtOperatorUnitValue.Text != "") { visitingFile.Operator_Unit_Value = short.Parse(txtOperatorUnitValue.Text); if (visitingFile.Connectors.First().BSI__Employee_Service_Set != null && ModelClass.GetUnitName((long?)id) != SharedClass.GetUnit(SharedClass.UnitType.Shut)) { var parentServiceStandardValue = ModelClass.GetParentServiceStandardValue((long?)id); if(parentServiceStandardValue.HasValue == true && parentServiceStandardValue.Value != 0) { visitingFile.Money_To_Pay = visitingFile.Money_To_Pay * visitingFile.Operator_Unit_Value.Value / parentServiceStandardValue.Value; } } } else { visitingFile.Operator_Unit_Value = null; } } else { visitingFile.Operator_Unit_Value = null; } int lastBalance = 0; var petientVisitingFiles = mc.Connectors.Where(o => o.PetientId == petientId && o.FinancialId != null && o.Petient_Visiting_Financials.TimeVisitStarts < visitingFile.TimeVisitStarts) .OrderByDescending(o => o.Petient_Visiting_Financials.TimeVisitStarts).ToList(); if (petientVisitingFiles.Count() != 0) { lastBalance = petientVisitingFiles.ElementAt(petientVisitingFiles.IndexOf(petientVisitingFiles.First())).Petient_Visiting_Financials.Balance; } visitingFile.Balance = lastBalance + (visitingFile.Money_To_Pay - (visitingFile.Money_Paid_Cash + visitingFile.Money_Paid_Card)); if (visitingFile.Money_Changed != null) { visitingFile.Balance = visitingFile.Balance + visitingFile.Money_Changed.Value; } } else { int lastBalance = 0; var petientVisitingFiles = mc.Connectors.Where(o => o.PetientId == petientId && o.FinancialId != null && o.Petient_Visiting_Financials.TimeVisitStarts < visitingFile.TimeVisitStarts) .OrderByDescending(o => o.Petient_Visiting_Financials.TimeVisitStarts).ToList(); if (petientVisitingFiles.Count() != 0) { lastBalance = petientVisitingFiles.ElementAt(petientVisitingFiles.IndexOf(petientVisitingFiles.First())).Petient_Visiting_Financials.Balance; } visitingFile.Money_Changed = 0; visitingFile.Money_Paid_Cash = 0; visitingFile.Money_Paid_Card = 0; visitingFile.POS_Name = ""; visitingFile.Balance = lastBalance; visitingFile.Is_Petient_Returned = false; visitingFile.Is_Money_Paid = false; visitingFile.Is_Petient_Visited = false; } mc.SaveChanges(); } grvState.EditIndex = -1; }
public static void RemoveConnectorObjectUsingFinancialId( long? Financial, SharedClass.RelationType RelationType ) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { string relation = SharedClass.GetRelationType(RelationType); var connectorToRemove = mc.Connectors.Where(o => o.FinancialId == Financial && o.RelationType == relation).ToList(); if (connectorToRemove.Count() != 0) { mc.Connectors.RemoveRange(connectorToRemove); mc.SaveChanges(); } } }
public void DeleteSelectedService() { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { var selectedServiceId = int.Parse(selectedService); var serviceToDelete = mc.BSI__Clinic_Services.Where(o => o.Id == selectedServiceId); if (serviceToDelete.Count() != 0) { selectedService = serviceToDelete.First().Parent_Id.ToString(); deleteChild(serviceToDelete.First()); mc.BSI__Clinic_Services.RemoveRange(servicesToDelete); mc.SaveChanges(); } } }