protected void btnUpdate_Click(object sender, EventArgs e) { try { Institute objIns = new Institute(); objIns.EventName = txtEventName.Text.Trim(); objIns.EventDate = txtEventDate.Text.Trim(); objIns.EventId = Convert.ToInt32(hidEventId.Value); bool flag = objdal.UpdateEventDetails(objIns); BindData(); ClearControls(); lblMessage.Text = "Updated Successfully."; } catch { throw; } }
protected void btnDelete_Click(object sender, EventArgs e) { try { ClearControls(); Institute objIns = new Institute(); Button btn = sender as Button; GridViewRow grow = btn.NamingContainer as GridViewRow; objIns.EventId = Convert.ToInt32((grow.FindControl("lblEventId") as Label).Text); bool flag = objdal.DeleteEventDetails(objIns); BindData(); ClearControls(); lblMessage.Text = "Deleted Successfully."; } catch { } }
protected void btnSave_Click(object sender, EventArgs e) { try { Institute objIns = new Institute(); objIns.EventName = txtEventName.Text.Trim(); objIns.EventDate = txtEventDate.Text.Trim(); bool flag = objdal.SaveEventDetails(objIns); BindData(); ClearControls(); lblMessage.Text = "Saved Successfully."; } catch { lblMessage.Text = "Error Occured in backend."; throw; } }
public int UpdateInstitute(Institute institute) { cmd = InstituteCommand(institute, false); try { cmd.Connection.Open(); return(cmd.ExecuteNonQuery()); } catch (Exception ex) { LogManager.Report(ex, institute); return(-1); } finally { cmd.Connection.Close(); } }
public ActionResult SemesterView(Double?InstituteID, Double?DeptID, Double?CourseID) { formModal.semesterViewModal = new SemesterViewModal(); formModal.semesterViewModal.SemesterList.Clear(); if (InstituteID != 123 && DeptID != null && CourseID != null) { Institute inst = allIns.Find(p => p.Ins_id == InstituteID); Department dept = inst.Departments.Find(p => p.D_id == DeptID); Course course = dept.Courses.Find(p => p.C_id == CourseID); foreach (Semester s in course.Semesters) { formModal.semesterViewModal.SemesterList.Add(s); } } return(View(formModal)); }
public async Task <IActionResult> Delete(int id) { var Institute = new Institute { Id = id }; try { _repository.Delete(Institute); await _repository.SaveChanges(); return(Ok(new OperationResult())); } catch { return(BadRequest()); } }
public async Task ShouldNotUpdateInstituteIfIdMissmatch() { var institute = new Institute { Name = "The Best Institute", Address = "Dhaka" }; var createInstitute = await ShouldCreateNewInstitute(institute); institute.Name = "New Name"; var instituteJsonSerialized = JsonConvert.SerializeObject(createInstitute); var content = new StringContent(instituteJsonSerialized, Encoding.UTF8, "application/json"); var response = await _client.PutAsync("/api/institute/22222", content); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); }
public MainWindow() { InitializeComponent(); //this.InitializeComponent(); //CoreWindow.GetForCurrentThread().KeyDown += MyPage_KeyDown; instituteDAL = new InstituteDAL(); studentDAL = new StudentDAL(); miscDAL = new MiscDAL(); rfidDAL = new RfidDAL(); ReadDatabaseFile(); try { if (DateTime.Now.Hour > 10) { btnInOut.Content = "OUT"; } else { btnInOut.Content = "IN"; } institue = instituteDAL.GetInstitute(); this.DataContext = institue; date_TB.Text = DateTime.Now.ToString("dd-MMMM-yyy"); AllStudentList = studentDAL.get_all_admissions(); absentAllStudents(); m_SMSEngine = new SMSEngine(ConnectionString.con_string); StartRefreshTimer(); } catch (Exception ex) { //Debug.WriteLine(ex); msgGRID.Visibility = Visibility.Visible; msgTB.Text = ex.ToString(); } }
public ActionResult Edit(Institute institute) { try { db.Entry(institute).State = EntityState.Modified; institute.ModifiedBy = Convert.ToInt32(Session["emp_id"]); institute.ModifiedOn = DateTime.Now; try { db.SaveChanges(); ViewBag.MessageType = "success"; ViewBag.Message = "Data has been saved successfully."; } catch (DbUpdateException ex) { ViewBag.MessageType = "error"; ViewBag.Message = ex.Message; ModelState.AddModelError(string.Empty, ex.Message); } } catch (DbEntityValidationException ex) { string ErrorMessage = ""; int count = 0; foreach (DbEntityValidationResult validationResult in ex.EntityValidationErrors) { string entityName = validationResult.Entry.Entity.GetType().Name; foreach (DbValidationError error in validationResult.ValidationErrors) { ModelState.AddModelError(string.Empty, error.ErrorMessage); count++; ErrorMessage += string.Concat(count, "-", error.ErrorMessage, "\n"); } } ViewBag.MessageType = "error"; ViewBag.Message = ErrorMessage; } model.Institutes = db.Institutes.OrderByDescending(a => a.InstituteID).ToList(); model.SelectedInstitute = null; model.DisplayMode = "WriteOnly"; ViewBag.IsActive = new SelectList(db.Options, "OptionDesc", "OptionDesc", institute.IsActive); return(View("Index", model)); }
public bool SaveInstituteDetails(Institute Institute) { try { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@InstituteName", Institute.InstituteName), new SqlParameter("@ICName", Institute.ICName), new SqlParameter("@Email", Institute.Email), new SqlParameter("@Password", Institute.Password), new SqlParameter("@MobileNo", Institute.MobileNo) }; return(SqlDbHelper.ExecuteNonQuery("SaveInstituteDetails", CommandType.StoredProcedure, parameters)); } catch (Exception ex) { throw ex; } }
public async Task <Guid> CreateInstitute(InstituteInfo instituteInfo) { var institute = new Institute() { Id = Guid.NewGuid(), Name = instituteInfo.Name, SpecialtiesGuids = instituteInfo.SpecialtiesGuids, Address = instituteInfo.Address, Director = instituteInfo.Director, Url = instituteInfo.Url, Phone = instituteInfo.Phone, Type = instituteInfo.Type }; await _dbContext.Institutes.AddAsync(institute); await _dbContext.SaveChangesAsync(); return(institute.Id); }
public PlanEntry ToModel(IDictionary <long, IExamEntry> examsDict) { var exams = Exams?.Select(e => e.ToModel(examsDict[e.ExamId])) ?? Enumerable.Empty <PlanExam>(); var result = new PlanEntry(exams, this.FinSources) { Id = Id, Title = Title, CodeLong = CodeLong, Degree = Degree, Office = Office, Mode = Mode, Year = Year, GrantSpots = GrantSpots, Institute = Institute.ToModel() }; return(result); }
public static bool AddStudent(Student student, Course course, Institute institute, Admission admission) { bool studentAdded = false; try { AdmissionDAL admDAL = new AdmissionDAL(); studentAdded = admDAL.AddStudent(student, course, institute, admission); } catch (AdmissionException) { throw; } catch (Exception ex) { throw ex; } return(studentAdded); }
public ApplicationResponse UpdateCourseInstitute(Institute model, string DbName) { try { var parameters = new string[] { "Id", "InstituteName", "UniversityId", "CountryId", "StateId", "CityId", "IsBlacklist", "IsActive", "CreatedBy" }; var sqlParameterd = _dbHelper.CreateSqlParamByObj(model, parameters); DataTable dt = _dbHelper.GetDataTable(DbName, "[Common].[Master_EditInstitute]", sqlParameterd); return(new ApplicationResponse { Code = Convert.ToInt32(dt.Rows[0][0]), Message = Convert.ToString(dt.Rows[0][1]), }); } catch (Exception ex) { var helper = new Helpers.ExceptionHelper.DataException(ex); throw helper.GetException(); } }
public ApplicationResponse UpdateInstitute(Institute model, UserContextModel objUser) { try { var validationResponse = _instituteValidation.Validate(InstituteValidation.ValidateAll_key, model, "Course title model can not be empty."); if (validationResponse.Messages != null && validationResponse.Messages.Count != 0) { throw new ValidationException(validationResponse); } model.CreatedBy = objUser.UserID; var data = _qualificationRepository.UpdateCourseInstitute(model, objUser.CompanyCode); return(data); } catch (Exception ex) { var helper = new BusinessException(ex); throw helper.GetException(); } }
public List <Institute> GetInstitutes() { DBConnection dbcon = new DBConnection(); List <Institute> institutes = new List <Institute>(); try { string strQuery = "BindInstituteNames"; SqlCommand cmd = dbcon.setCommandProperties(strQuery); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); sda.Fill(ds); cmd.Dispose(); if (ds.Tables[0].Rows.Count < 0) { return(institutes); } foreach (DataRow item in ds.Tables[0].Rows) { Institute ins = new Institute() { InstituteId = Convert.ToInt32(item["InstituteId"]), InstituteName = Convert.ToString(item["InstituteName"]) }; institutes.Add(ins); } } catch (Exception ex) { throw ex; } finally { if (dbcon != null) { dbcon.closeDBConnection(); } } return(institutes); }
public InstituteProfile(Options opt) { var app = new MainApp(); var doc = new DoctorEndPoint(); var inst = new InstituteEndPoint(); this.comments = GetComments(opt, doc); this.offers = GetDoctorOffers(opt, inst); this.engagment = GetEngagments(opt, doc); this.doctors = GetInstDoctors(opt, doc); this.info = GetInstituteCard(opt, inst); this.cities = app.Set_cities(opt.Lang, opt.Cities); this.city = inst.GetInstCity(this.info.Id, "en").ToLower(); this.country = "sa"; opt.City = this.city.ToLower(); opt.Country = this.country.ToLower(); this.departments = app.GetDepartments(opt); this.info.City_name = inst.GetInstCity(this.info.Id, opt.Lang); }
public async Task <IActionResult> Upsert(int?id) { Institute obj = new Institute(); if (id == null) { //this will be true for Insert/Create return(View(obj)); } //Flow will come here for update obj = await _insRepo.GetAsync(SD.InstituteAPIPath, id.GetValueOrDefault(), HttpContext.Session.GetString("JWToken")); if (obj == null) { return(NotFound()); } return(View(obj)); }
/// <summary> /// Method for fetching the initial details before adding new receipt - RS /// </summary> /// <param name="currentUserInstituteId"></param> /// <param name="currentUser"></param> /// <returns></returns> public async Task <dynamic> GetFinanceReceiptCreationInitialDataAsync(int currentUserInstituteId, ApplicationUser currentUser) { List <FinanceChartOfAccounts> incomeChartOfAccountsList = await _imsDbContext.FinanceChartOfAccounts .Where(x => x.AccountType == ChartOfAccountTypeEnum.Income && x.IsActive) .Include(x => x.Institute) .ToListAsync(); List <UserAc> systemUsersList = new List <UserAc>(); List <ApplicationUser> usersList = await _imsDbContext.Users.ToListAsync(); foreach (ApplicationUser user in usersList) { IdentityRole roleName = null; IdentityUserRole <string> userRoleMapping = await _imsDbContext.UserRoles.FirstOrDefaultAsync(x => x.UserId == user.Id); if (userRoleMapping != null) { roleName = await _imsDbContext.Roles.FirstAsync(x => x.Id == userRoleMapping.RoleId); } if (roleName == null || !roleName.Name.ToLowerInvariant().Equals(_systemRoles.Roles[0].ToLowerInvariant())) { Institute userInstitute = (await _imsDbContext.UserInstituteMappings.Include(x => x.Institute) .FirstOrDefaultAsync(x => x.UserId.Equals(user.Id) && x.InstituteId == currentUserInstituteId))?.Institute; systemUsersList.Add(new UserAc { Id = user.Id, Name = user.Name, InstituteId = userInstitute?.Id, Institute = userInstitute?.Name, Email = user.Email }); } } return(new { IncomeChartOfAccountsList = incomeChartOfAccountsList, SystemUsersList = systemUsersList, LoggedInUserId = currentUser.Id }); }
//[HttpPost] public JsonResult CreateData(Institute model) { string retn = String.Empty; EMSContext db = new EMSContext(); var exist = db.Institutes.Where(e => e.ShortName == model.ShortName).FirstOrDefault(); if (exist == null) { string Message, fileName, actualFileName; Message = fileName = actualFileName = string.Empty; bool flag = false; if (Request.Files != null) { var file = Request.Files[0]; actualFileName = file.FileName; fileName = model.ShortName + Path.GetExtension(file.FileName); int size = file.ContentLength; } var advanced = new Institute(); advanced.Name = model.Name; advanced.ShortName = model.ShortName; advanced.Address = model.Address; advanced.Email = model.Email; advanced.Phone = model.Phone; advanced.Mobile = model.Mobile; advanced.Contact = model.Contact; advanced.IsActive = model.IsActive; advanced.JoinDate = model.JoinDate; advanced.ExpireDate = Convert.ToDateTime(model.ExpireDate); advanced.ModifyId = CommonFunction.CurrentUserId(); advanced.ModifyTime = DateTime.Now; db.Institutes.Add(advanced); db.SaveChanges(); retn = "Success"; } else { retn = "This Short Name is already exist."; } return(Json(retn, JsonRequestBehavior.AllowGet)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Institute institute = db.Institutes.Find(id); if (institute == null) { return(HttpNotFound()); } model.Institutes = db.Institutes.OrderByDescending(a => a.InstituteID).ToList(); model.SelectedInstitute = institute; model.DisplayMode = "Delete"; ViewBag.MessageType = ""; ViewBag.Message = ""; return(View("Index", model)); }
public ActionResult Institute(int id = 0) { var instituteList = FindEducatorsRepository.GetAllInstitutes(); var institute = new Institute(); if (id > 0) { institute = FindEducatorsRepository.GetInstituteById(id); } else { institute.Id = -1; institute.InstituteName = ""; } ViewBag.InstituteList = instituteList; ViewBag.Institute = institute; return(View(institute)); }
public async Task HandleAsync(AddQualification command, ICorrelationContext context) { Institute institute = await _institutessRepo.GetAsync(command.InstituteId); if (institute == null) { throw new MedParkException("qualification_institute_does_not_Exist", $"The institute {command.Id } does not exist."); } Qualifications q = new Qualifications(command.Id) { InstituteId = command.InstituteId, QualificationName = command.QualificationName, YearObtained = command.YearObtained, CredentialId = command.CredentialId }; await _qualificationsRepo.AddAsync(q); }
public async Task <ActionResult> RegisterInstitute(RegisterViewModel model, [Bind(Include = "ID,Name,TypeOfInstitute,PhoneNumber,Email,Password,Address,Logo")] Institute institute, HttpPostedFileBase imgFile) { if (ModelState.IsValid) { string fileName = Path.GetFileNameWithoutExtension(imgFile.FileName); string extension = Path.GetExtension(imgFile.FileName); fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension; model.ProfilePicture = "/Images/Accounts/" + fileName; model.UserRoles = "SchoolAdmin"; institute.Logo = model.ProfilePicture; fileName = Path.Combine(Server.MapPath("~/Images/Accounts/"), fileName); var user = new ApplicationUser { UserName = model.UserName, Email = model.Email, ProfilePicture = model.ProfilePicture }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { imgFile.SaveAs(fileName); await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); institute.AccountID = user.Id; db.Institutes.Add(institute); db.SaveChanges(); await UserManager.AddToRoleAsync(user.Id, model.UserRoles); return(RedirectToAction("Index", "Dashboards")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
/// <summary> /// Inserts institute /// </summary> /// <param name="institute">Institute</param> public virtual void InsertInstitute(Institute institute) { if (institute == null) { throw new ArgumentNullException(nameof(institute)); } if (institute is IEntityForCaching) { throw new ArgumentException("Cacheable entities are not supported by Entity Framework"); } _instituteRepository.Insert(institute); //cache _cacheManager.RemoveByPattern(ResearchInstituteDefaults.InstitutesPatternCacheKey); //_staticCacheManager.RemoveByPattern(ResearchInstituteDefaults.InstitutesPatternCacheKey); //event notification _eventPublisher.EntityInserted(institute); }
protected void btnSave_Click(object sender, EventArgs e) { try { Institute objIns = new Institute(); objIns.InstituteName = txtInstitueName.Text.Trim(); objIns.ICName = txtInstituteCoordinator.Text.Trim(); objIns.Email = txtIEmail.Text.Trim(); objIns.Password = txtIPwd.Text.Trim(); objIns.MobileNo = txtIMobileNo.Text.Trim(); bool flag = objdal.SaveInstituteDetails(objIns); BindData(); ClearControls(); lblMessage.Text = "Saved Successfully."; } catch { lblMessage.Text = "Error Occured in backend."; throw; } }
protected void btnUpdate_Click(object sender, EventArgs e) { try { Institute objIns = new Institute(); objIns.InstituteName = txtInstitueName.Text.Trim(); objIns.ICName = txtInstituteCoordinator.Text.Trim(); objIns.Email = txtIEmail.Text.Trim(); objIns.Password = txtIPwd.Text.Trim(); objIns.MobileNo = txtIMobileNo.Text.Trim(); objIns.InstituteId = Convert.ToInt32(hidInstituteId.Value); bool flag = objdal.UpdateInstituteDetails(objIns); BindData(); ClearControls(); lblMessage.Text = "Updated Successfully."; } catch { throw; } }
public async Task ShouldNotUpdateInstituteIdNotFound() { var institute = new Institute { Name = "The Best Institute", Address = "Dhaka" }; var createInstitute = await ShouldCreateNewInstitute(institute); institute.Name = "New Name"; var notInDatabaseId = Guid.NewGuid(); createInstitute.Id = notInDatabaseId; var instituteJsonSerialized = JsonConvert.SerializeObject(createInstitute); var content = new StringContent(instituteJsonSerialized, Encoding.UTF8, "application/json"); var response = await _client.PutAsync("/api/institute/" + notInDatabaseId, content); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); }
public async Task UpdateInstituteAfterAddingItAsync() { var repository = GetRepository(); var initialName = Guid.NewGuid().ToString(); var initialAddress = Guid.NewGuid().ToString(); var institute = new Institute() { Name = initialName, Address = initialAddress }; await repository.AddAsync(institute); // detach the institute so we get a different instace _dbContext.Entry(institute).State = EntityState.Detached; var newInstitute = (await repository.ListAllAsync()).FirstOrDefault(); Assert.NotSame(institute, newInstitute); // We can use AutoFixure to generate random string // need to check and implement if relevant var newName = Guid.NewGuid().ToString(); var newAddress = Guid.NewGuid().ToString(); newInstitute.Name = newName; newInstitute.Address = newAddress; await repository.UpdateAsync(newInstitute); // Detach the newInstitute so we get a different instace _dbContext.Entry(newInstitute).State = EntityState.Detached; var updatedInstitute = (await repository.ListAllAsync()).FirstOrDefault(); Assert.NotSame(newInstitute, updatedInstitute); Assert.NotEqual(institute.Name, updatedInstitute.Name); Assert.NotEqual(institute.Address, updatedInstitute.Address); }
public Student(int roomNumber) { this.roomNumber = roomNumber; course = Server.rand.Next(1, 6); studentTicket = "BK" + Server.rand.Next(100000, 150000); rating = Server.rand.Next(1, 1000); int s = Server.rand.Next(0, 2); if (s == 1) { base.sex = "Чоловічий"; } else { base.sex = "Жіночий"; } base.mass = Server.rand.Next(40, 130); base.yearsOld = Server.rand.Next(16, 23); Nation nat = (Nation)Server.rand.Next(0, 5); base.nationality = nat.ToString(); int y = Server.rand.Next(0, 2); if (y == 1) { salary = Server.rand.Next(900, 2000); } else { salary = 0; } Institute inst = (Institute)Server.rand.Next(0, 3); institute = inst.ToString(); }