public void ProcessRequest(HttpContext context) { string userName = context.Request[Constants.UserName]; string userPass = context.Request[Constants.UserPass]; if (!String.IsNullOrEmpty(userName) && !String.IsNullOrEmpty(userPass)) { try { DataTable dt = SqlHelper.ExcuteTable(String.Format("select * from Users where UserName = '******'", userName)); if (dt == null) { SqlHelper.ExcuteNoQuery("insert into Users values(@UserName,@UserPass,'','','')", new SqlParameter[] { new SqlParameter("UserName", userName), new SqlParameter("UserPass", Encription.MD5Encrypt(userPass)) }); } else { dt.Rows[0].BeginEdit(); dt.Rows[0]["UserPass"] = Encription.MD5Encrypt(userPass); dt.Rows[0].EndEdit(); SqlHelper.UpdateTable(dt, "Users"); } }catch (Exception ex) { context.Response.Write(ex.ToString()); return; } context.Response.Write(userName + "账户重置成功!"); return; } context.Response.Write("重置账户参数不正确!"); }
public Task <bool> Handle(AlterarUsuarioCommand message, CancellationToken cancellationToken) { #region Basic Validations if (!message.IsValid()) { NotifyValidationErrors(message); return(Task.FromResult(false)); } #endregion var password = Encription.Encrypt(message.Password, Encription.Key256, 256); var usuario = new Usuario( message.Id, message.Nome, message.Idade, message.Documento, message.TipoDocumento, message.Genero, message.Pai, message.Mae, message.Telefone, message.Celular, message.Email, password, message.UsuarioId ); _usuarioRepository.Update(usuario); if (Commit()) { _bus.RaiseEvent(new AlterarUsuarioEvent()); } return(Task.FromResult(true)); }
public IActionResult Login([FromBody] UserLoginDTO userLoginDto) { try { User user = _eyadtakDbContext.Users.FirstOrDefault(x => x.UserEmail == userLoginDto.Email); if (user == null || Encription.Decrypt(user?.Password, "SecretCode_hamed") != userLoginDto.Password) { return(Ok(new { message = "Wrong Email or Password", ErrorHappen = true })); } if (!user.Active) { return(Ok(new { message = "Your account is not active yet, please check your email", ErrorHappen = true })); } List <int> abilitiesIds = _eyadtakDbContext.Users_Roles.Where(x => x.UserId == user.UserId).Include(x => x.Role).SelectMany(x => x.Role.Role_Ability).Select(x => x.Ability.AbilityId).ToList(); string token = _jwt.GenerateToken(user.UserId); return(Ok(new { Token = token, AbilitiesIds = abilitiesIds, userName = user.UserName, userEmail = user.UserEmail, ErrorHappen = false })); } catch (Exception e) { return(Ok(new { message = "Something went wrong", ErrorHappen = true })); throw e; } }
private string method_0() { string result = ""; if (File.Exists(string_0)) { byte[] cipher = File.ReadAllBytes(string_0); string s = Encription.decryptByte_1(cipher); MessageBox.Show(s); MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(s)); DataSet dataSet = new DataSet("Config"); dataSet.ReadXml((Stream)stream); if (dataSet != null) { result = "Data Source=" + dataSet.Tables[0].Rows[0]["SERVER"].ToString(); result = result + ";Initial Catalog=" + dataSet.Tables[0].Rows[0]["DATABASE"].ToString(); if (dataSet.Tables[0].Rows[0]["USERNAME"].ToString() != "") { result = result + ";User ID=" + dataSet.Tables[0].Rows[0]["USERNAME"].ToString(); } if (dataSet.Tables[0].Rows[0]["PASSWORD"].ToString() != "") { result = result + ";Password="******"PASSWORD"].ToString(); } result += ";Connection Timeout=300"; MessageBox.Show(result); string_1 = string.Concat(dataSet.Tables[0].Rows[0]["SERVER"]); string_1 = string_1.Split('\\')[0]; } } return(result); }
public IActionResult ChangePassword([FromBody] ChangePasswordDTO changePasswordDTO) { try { int userId = (int)this.HttpContext.Items["userId"]; User userToChangeHisPassword = _eyadtakDbContext.Users.FirstOrDefault(x => x.UserId == userId); userToChangeHisPassword.Password = Encription.Decrypt(userToChangeHisPassword.Password, "SecretCode_hamed"); if (userToChangeHisPassword.Password != changePasswordDTO.OldPassword) { return(Ok(new { message = "Old password is wrong", ErrorHappen = true })); } if (changePasswordDTO.NewPassword.Length < 5) { return(Ok(new { message = "New password can't be less than 5 char", ErrorHappen = true })); } userToChangeHisPassword.Password = Encription.Encrypt(changePasswordDTO.NewPassword, "SecretCode_hamed"); _eyadtakDbContext.Users.Update(userToChangeHisPassword); _eyadtakDbContext.SaveChanges(); return(Ok(new { message = "Password Changed Successfully", ErrorHappen = false })); } catch (Exception e) { return(Ok(new { message = "Something went wrong", ErrorHappen = true })); throw e; } }
public UsuarioViewModel ObterUsuario(UsuarioAuthenticateViewModel vm) { vm.Password = Encription.Encrypt(vm.Password, Encription.Key256, 256); var usuario = _usuarioRepository.ObterPorEmailPassword(vm.Email, vm.Password); return(_mapper.Map <UsuarioViewModel>(usuario)); }
/// <summary> /// 写入Mysql数据 /// </summary> /// <param name="examinedby"></param> /// <param name="WriteString"></param> private void WriteMysql(string observation_id, string examined_by, String WriteString) { Encription encription = new Encription(); ANICshare share = new ANICshare(); string dbHost = "192.168.0.10"; string dbPort = "3366"; string dbUser = "******"; //資料庫使用者帳號 string dbPass = "******"; //資料庫使用者密碼 string dbName = "alpine"; //資料庫名稱 string db_testName = "alpine_test"; //資料庫名稱 string LoginName = "100053"; //資料庫名稱 string LoginPass = "******"; //資料庫名稱 share.dbHost = dbHost; share.dbPort = dbPort; share.dbUser = dbUser; share.dbPass = dbPass; share.dbName = dbName; share.db_testName = db_testName; share.refresh_connection(); // CExecSql sql = new CExecSql(); // sql.SaveImage(examinedby, Convert.FromBase64String(WriteString)); StringBuilder sql = new StringBuilder(); bool insert = false; String photo_id_str = ""; string photo_id = share.Get_mysql_database_MaxID("care_wound_document", "wound_photo_id"); // string ordering = share.Get_mysql_database_MaxID_ordering("care_wound_document", "ordering", string.Format("observation_id = {0}", observation_id)); string ordering = share.Get_mysql_database_MaxID_ordering("care_wound_document", "ordering", string.Format("observation_id = {0}", observation_id)); string[] values = new string[] { photo_id, observation_id, ordering, examined_by }; sql.Append("Insert into care_wound_document(wound_photo_id,observation_id,ordering,created_by,created_datetime,document_photo) Values({0},{1},{2},'{3}',now(),?parval);"); // String cmdText = "select * from client_documents2 Where client_photo_id IN (@id) and valid = 'Y'"; // sql.Append("select document_photo from client_documents2 Where client_photo_id = '{0}' and valid = 'Y';"); string comm = string.Format(sql.ToString(), values); //byte[] image_bytes = Convert.FromBase64String(photo_data); int a = share.ExecBoldSql(comm.ToString(), WriteString); if (a > 0) { insert = true; } }
private bool CorrectPassword(string password) { string OriginalPassword = Encription.Decrypt(user.Password, "SecretCode_hamed"); if (OriginalPassword != password) { return(false); } return(true); }
//only allowed for Doctors public IActionResult DoctorInfo() { string userName = new Encription().Decrypt(new ApplicationKeys().Key_UserName, _session.GetString("x").ToString()); string password = new Encription().Decrypt(new ApplicationKeys().Key_Password, _session.GetString("y").ToString()); bool IsExisted = _context.Account.Any(x => x.UserName.ToLower().Equals(userName) && x.Password.Equals(password)); int? SelectedDoctorId = null; if (IsExisted) { //generate list of profession var ListOfProfessions = _context.Profession.ToList(); SelectList ProfessionList = new SelectList(ListOfProfessions, "ProfessionId", "Name"); ViewData["ProfessionId"] = ProfessionList; //generate list of Nationality var listOfCountries = _context.Country.ToList(); SelectList CountryList = new SelectList(listOfCountries, "CountryId", "Name"); ViewData["Nationality"] = CountryList; Account account = _context.Account.Where(x => x.UserName.ToLower().Equals(userName) && x.Password.Equals(password)).FirstOrDefault(); int? accountId = account.AccountId; //check if this account is for a doctor //if not return to the login page if (account.AccountTypeId != AccountType_Doctor) { return(RedirectToAction("Login", "Account")); } //Check if the doctor has filled his info before bool IsDoctorExisted = _context.Doctor.Any(x => x.AccountId == accountId); // if doctor never filled his info before create neew one if (!IsDoctorExisted) { Doctor Thisdoctor = new Doctor(); Thisdoctor.AccountId = accountId; _context.Doctor.Add(Thisdoctor); _context.SaveChanges(); SelectedDoctorId = Thisdoctor.DoctorId; return(View(Thisdoctor)); } // if doctor record is already created // get account id of selected doctor else { Doctor doctor = _context.Doctor.Where(x => x.AccountId == accountId).FirstOrDefault(); SelectedDoctorId = doctor.DoctorId; return(View(doctor)); } } else { return(RedirectToAction("Login", "Account")); } }
/// <summary> /// Decodes an encrypted string. /// </summary> /// <param name="source">The string to decode.</param> /// <returns>The decoded string.</returns> private static string Decode(string source) { var result = string.Empty; if (!string.IsNullOrEmpty(source) && !string.IsNullOrWhiteSpace(source)) { var encription = new Encription(); result = encription.Decrypt(source); } return(result); }
public Result SelfPasswordChange(ChangePasswordModel changePassword) { try { result = new Result(); result.isSucess = false; Dictionary <int, CheckSessionData> dictionary = CheckSessionData.GetSessionValues(); int userGroupId = Convert.ToInt32(dictionary[6].Id == "" ? 0 : Convert.ToInt32(dictionary[6].Id)); if (userGroupId != 0) { int userId = Convert.ToInt32(dictionary[3].Id); string userName = dictionary[4].Id; _userFactory = new UserFactory(); bool status = _userFactory.GetAll().Any(x => x.UserName == userName && x.UserGroupID == userGroupId); if (status == true) { SEC_UserInformation tblUserInformation; tblUserInformation = _userFactory.FindBy(x => x.ID == userId).FirstOrDefault(); _passwordFactory = new UserPasswordFactory(); Encription encription = new Encription(); SEC_Password tblPassword = _passwordFactory.GetAll().FirstOrDefault(x => x.ID == tblUserInformation.PasswordID); if (tblPassword != null) { tblPassword.OldPassword = tblPassword.NewPassword; tblPassword.NewPassword = encription.Encrypt(changePassword.NewPassword.Trim()); tblPassword.IsSelfChanged = true; tblPassword.UpdatedDate = DateTime.Now; tblPassword.UpdatedBy = userId; _passwordFactory.Edit(tblPassword); } result = _passwordFactory.Save(); if (result.isSucess) { result.message = "Changed Password Sucessfully"; return(result); } } result.message = "Password not Changed try again"; return(result); } result.message = "LogOut"; } catch (Exception exception) { result.isSucess = false; result.message = exception.Message; } return(result); }
public IActionResult Register([FromBody] UserRegisterDTO userRegisterDto) { try { if (userRegisterDto.Password.Length < 5) { return(Ok(new { message = "Password can't be less than 5 char", ErrorHappen = true })); } User userObj = _eyadtakDbContext.Users.FirstOrDefault(x => x.UserEmail == userRegisterDto.Email); if (userObj != null) { return(Ok(new { message = "This Email Already Exsist", ErrorHappen = true })); } User user = new User() { Password = Encription.Encrypt(userRegisterDto.Password, "SecretCode_hamed"), UserName = userRegisterDto.Name, UserEmail = userRegisterDto.Email, Active = false, RegisterDate = DateTime.Now, RecoveryCode = -1, GenderId = userRegisterDto.GenderId, PhoneNumber = userRegisterDto.PhoneNumber }; user.User_Role = new List <User_Role>(); user.User_Role.Add(new User_Role() { RoleId = userRegisterDto.RoleId, UserId = user.UserId }); _eyadtakDbContext.Users.Add(user); _eyadtakDbContext.SaveChanges(); string token = _jwt.GenerateToken(user.UserId); _email.SendAccountActivationEmail(user.UserEmail, _configuration.GetSection("Frontend:Url").Value + "/account/activate-account/?token=" + token); return(Ok(new { message = "User Registerd Successfully", ErrorHappen = false })); } catch (Exception e) { return(Ok(new { message = e.Message, ErrorHappen = true })); throw e; } }
public ActionResult DoResetPass(string p_user_name, string p_password, string p_re_password) { try { var userBL = new UserBL(); int re = userBL.DoResetPass(p_user_name, Encription.EncryptAccountPassword(p_user_name, p_password), p_re_password, SessionData.CurrentUser.Username); return(Json(new { success = re })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { success = -1 })); } }
public ActionResult Index([Bind(Include = "Email, Password")] Employee employee) { if (ModelState.IsValid) { string hashedPassword = Encription.ComputeSha256Hash(employee.Password); Employee emp = db.Employee.Where(x => x.Email == employee.Email && x.Password == hashedPassword && x.Status == 1).FirstOrDefault(); if (emp != null) { Session["Employee"] = emp; return(RedirectToAction("Index", "Home")); } } ViewBag.Message = "Email hoặc password không khớp !!!"; return(View()); }
public ActionBusinessResult AddUser(UserInfo userAdd, string GroupId) { var passwordEncrypt = Encription.EncryptAccountPassword(userAdd.Username, userAdd.Password); userAdd.Password = passwordEncrypt; var result = UserDA.AddUser(userAdd, GroupId); if (result > 0) { this.SetActionSuccess(true); ModuleMemoryData.MemoryData.GetCache_represent(); } return(this.SetActionResult(result, KnMessageCode.AddUserSuccess)); }
public ActionBusinessResult ChangeUserSelfPassword(UserInfo userInfo, string newPassword) { userInfo.Password = Encription.EncryptAccountPassword(userInfo.Username, userInfo.Password); userInfo.ModifiedBy = userInfo.Username; newPassword = Encription.EncryptAccountPassword(userInfo.Username, newPassword); var result = UserDA.ChangeUserPassword(userInfo, newPassword); if (result > 0) { this.SetActionSuccess(true); AccountManagerBL.AddToAccountForceReLoginCollection(userInfo.Id); } return(this.SetActionResult(result, KnMessageCode.ChangePasswordUserSuccess)); }
public ActionBusinessResult DoLoginAccount(string userName, string password, string language) { var passwordEncrypt = Encription.EncryptAccountPassword(userName, password); var result = this.CheckUserLogin(userName, passwordEncrypt); if (this.GetActionSuccess()) { this.LoadAllRolesOfUser(); this.CurrentUserInfo.HtmlMenu = this.GetUserHtmlMenu(language); this.CurrentUserInfo.LoginTime = DateTime.Now; AccountManagerBL.UpdateDicAccountLogin(this.CurrentUserInfo); } return(result); }
public ActionResult UpdatePass(decimal user_id, string user_name, string pass) { decimal _ck = -1; try { var userBL = new UserBL(); int re = userBL.DoResetPass(user_name, Encription.EncryptAccountPassword(user_name, pass), pass, user_name); return(Json(new { success = re })); } catch (Exception ex) { Logger.LogException(ex); } return(Json(new { success = _ck })); }
public IActionResult Create([Bind("UserName", "Password", "AccountTypeId", "RecoveryQuestion", "RecoveryAnswer")] Account account) { string userName = new Encription().Decrypt(new ApplicationKeys().Key_UserName, _session.GetString("x").ToString()); string password = new Encription().Decrypt(new ApplicationKeys().Key_Password, _session.GetString("y").ToString()); if (ModelState.IsValid) { bool existedBefore = _context.Account.Any(x => x.UserName.ToLower().TrimEnd().Equals(account.UserName.ToLower().TrimEnd())); if (!existedBefore) { _context.Account.Add(account); _context.SaveChanges(); } } return(RedirectToAction("Index")); }
public void Post(string id) { Card cards = JsonConvert.DeserializeObject <Card>(id); var board = _cache.Get <Board>("currentState"); BoardManager.SetCardToNewLane(board, cards.ID, cards.CardProgress); _cache.Set("currentState", board, TimeSpan.FromDays(1)); var serlizedList = JsonConvert.SerializeObject(board.AllCards); string allText = System.IO.File.ReadAllText("configuration.json"); EncriptionKey key = JsonConvert.DeserializeObject <EncriptionKey>(allText); var filekey = Encription.GetEncriptedFile(key); filekey.Description = serlizedList; Encription.EncriptedFile(filekey); Encription.SaveDataSet(filekey); }
public IActionResult Login([Bind("UserName", "Password")] Account account) { Encription encription = new Encription(); bool existed = _context.Account.Any(x => x.UserName.TrimEnd().ToLower().Equals(account.UserName.TrimEnd().ToLower()) && x.Password.Equals(account.Password)); if (existed) { Account selectedAccount = _context.Account.Where(x => x.UserName.TrimEnd().ToLower().Equals(account.UserName.TrimEnd().ToLower()) && x.Password.Equals(account.Password)).FirstOrDefault(); int? AccountTypeId = selectedAccount.AccountTypeId; ApplicationKeys appKeys = new ApplicationKeys(); string UserNameEncription = encription.Encrypt(appKeys.Key_UserName, selectedAccount.UserName); string PasswordEncription = encription.Encrypt(appKeys.Key_Password, selectedAccount.Password); //HttpContext.Session.SetString("x", UserNameEncription); //HttpContext.Session.SetString("y", PasswordEncription); _session.SetString("x", UserNameEncription); _session.SetString("y", PasswordEncription); if (AccountTypeId == AccountType_Doctor) { ViewData["Layout"] = "_DoctorLayout"; //ViewData["ContactLayout"] = "~/Views/Shared/_DoctorLayout.cshtml"; return(RedirectToAction("DoctorDefault", "Home", new { id = UserNameEncription, y = PasswordEncription })); } else if (AccountTypeId == AccountType_Admin) { ViewData["Layout"] = "_AdminLayout"; //ViewData["ContactLayout"] = "~/Views/Shared/_AdminLayout.cshtml"; return(RedirectToAction("AdminDefault", "Home", new { id = UserNameEncription, y = PasswordEncription })); } else if (AccountTypeId == AccountType_Patient) { ViewData["Layout"] = "_PatientLayout"; //ViewData["ContactLayout"] = "~/Views/Shared/_PatientLayout.cshtml"; return(RedirectToAction("PatientDefault", "Home", new { id = UserNameEncription, y = PasswordEncription })); } else { return(RedirectToAction("Login")); } } else { return(RedirectToAction("Login")); } }
public RegistrarNovoUsuarioCommand(Guid usuarioId, string nome, int idade, TipoDocumento tipoDocumento, string documento, Genero genero, string pai, string mae, long telefone, long celular, string email, string password, IEnumerable <Guid>?appsId = null) { UsuarioId = usuarioId; Nome = nome; Idade = idade; Documento = documento; TipoDocumento = tipoDocumento; Genero = genero; Pai = pai; Mae = mae; Telefone = telefone; Celular = celular; Email = email; Password = Encription.Encrypt(password, Encription.Key256, 256); AppsId = appsId; }
public ActionResult XacNhanKhachHangDK(decimal pID, string pEmail) { var lstUsers = new List <RegisterInfo>(); try { string _pass = CommonFunction.AppsCommon.CreateRandomString(10); var passwordEncrypt = Encription.EncryptAccountPassword(pEmail, _pass); UserBL objBL = new UserBL(); RegisterInfo pInfo = new RegisterInfo(); pInfo.Id = pID; pInfo.Modifiedby = SessionData.CurrentUser.Username; pInfo.ModifiedDate = SessionData.CurrentUser.CurrentDate; pInfo.KeySecret = passwordEncrypt; pInfo.Status = 1; int preturn = objBL.RegisterUpdate(pInfo); if (preturn >= 0) { Email_Info _Email_Info = new Email_Info { EmailFrom = EmailHelper.EmailOriginal.EMailFrom, Pass = EmailHelper.EmailOriginal.PassWord, Display_Name = EmailHelper.EmailOriginal.DisplayName, EmailTo = pEmail, EmailCC = "", Subject = "Email thông báo đăng ký mở tài khoản thành công", Content = "Dear Customer, Quí khách đăng ký thành công tài khoản username:"******" password:"******"\n quí khách vui lòng truy cập vào địa chỉ <a href='http://pathlaw.net/vi-vn/account/login'>http://pathlaw.net/vi-vn/account/login</a> để đổi mật khẩu của tài khoản. \n cảm ơn quí khách hàng. ", LstAttachment = new List <string>(), }; CommonFunction.AppsCommon.EnqueueSendEmail(_Email_Info); //EmailHelper.SendMail(pEmail, "", "Email thông báo đăng ký mở tài khoản thành công", "Dear Customer, Quí khách đăng ký thành công tài khoản username:"******" password:"******"\n quí khách vui lòng truy cập vào địa chỉ <a href='http://pathlaw.net/vi-vn/account/login'>http://pathlaw.net/vi-vn/account/login</a> để đổi mật khẩu của tài khoản. \n cảm ơn quí khách hàng. ", new List<string>()); } return(Json(new { status = preturn })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { status = -3 })); } }
public ActionResult ChangePassword([FromBody] ChangePasswordDto changePasswordDto) { User user = userData.GetUser(HttpContext); user.Password = Encription.Decrypt(user.Password, "SecretCode_hamed"); if (user.Password != changePasswordDto.OldPassword) { return(Json(new { statusCode = ResponseStatus.ValidationError, responseMessage = ValidationMessages.IncorrectPassword })); } if (changePasswordDto.NewPassword.Length < 5) { return(Json(new { statusCode = ResponseStatus.ValidationError, responseMessage = ValidationMessages.ShortPassword })); } user.Password = Encription.Encrypt(changePasswordDto.NewPassword, "SecretCode_hamed"); db.Users.Update(user); db.SaveChanges(); userData.SetUser(HttpContext, user); return(Json(new { statusCode = ResponseStatus.Success })); }
public IActionResult Register([FromBody] UserRegisterDTO userRegisterDto) { User user = UserMapper.Map(userRegisterDto); FillEmptyFields(user); UserValidator validator = new UserValidator(ValidationMode.Create, db); var result = validator.Validate(user); if (!result.IsValid) { return(Json(new { statusCode = ResponseStatus.ValidationError, responseMessage = result.Errors })); } user.Password = Encription.Encrypt(user.Password, "SecretCode_hamed"); db.Add(user); db.SaveChanges(); string token = jwt.GenerateToken(user.Id); email.SendAccountActivationEmail(user.Email, "https://localhost:44340/Account/ActivateAccount/?token=" + token); return(Json(new { statusCode = ResponseStatus.Success, responseMessage = user.Id })); }
public Board Get() { string allText = System.IO.File.ReadAllText("configuration.json"); EncriptionKey key = JsonConvert.DeserializeObject <EncriptionKey>(allText); var filekey = Encription.GetEncriptedFile(key); Encription.DeEncriptedFile(filekey); List <Card> cards = JsonConvert.DeserializeObject <List <Card> >(filekey.Description); if (cards == null) { cards = new List <Card>(); } Board board = BoardManager.SetUpBoard(cards); _cache.Set("currentState", board, TimeSpan.FromDays(1)); //return View(personlist); return(board); }
public ActionResult RecoverPassword([FromBody] RecoverPasswordDTO recoverPasswordDTO) { User user = _eyadtakDbContext.Users.FirstOrDefault(s => s.UserEmail == recoverPasswordDTO.UserEmail); if (user == null) { return(Ok(new { message = "This Email does not Exsist", ErrorHappen = true })); } if (user.RecoveryCode != recoverPasswordDTO.RecoveryCode) { return(Ok(new { message = "This Code is not Correct", ErrorHappen = true })); } if (recoverPasswordDTO.NewPassword.Length < 5) { return(Ok(new { message = "Password Lenght can't be less than 5 char", ErrorHappen = true })); } user.Password = Encription.Encrypt(recoverPasswordDTO.NewPassword, "SecretCode_hamed"); user.RecoveryCode = -1; _eyadtakDbContext.Update(user); _eyadtakDbContext.SaveChanges(); return(Ok(new { message = "Password Changed Successfully", ErrorHappen = false })); }
public ActionResult RecoverPassword([FromBody] UserLoginDTO userLoginDTO, [FromQuery] string code) { User user = db.Users.Include(x => x.ProfilePhotos).Where(s => s.Email == userLoginDTO.Email && s.IsDeleted == false).FirstOrDefault(); if (user == null) { return(Json(new { statusCode = ResponseStatus.ValidationError, responseMessage = ValidationMessages.EmailNotExsist })); } if (user.RecoveryCode.ToString() != code) { return(Json(new { statusCode = ResponseStatus.ValidationError, responseMessage = ValidationMessages.WrongCode })); } if (userLoginDTO.Password.Length < 5) { return(Json(new { statusCode = ResponseStatus.ValidationError, responseMessage = ValidationMessages.ShortPassword })); } user.Password = Encription.Encrypt(userLoginDTO.Password, "SecretCode_hamed"); user.RecoveryCode = null; db.Update(user); db.SaveChanges(); userData.SetUser(HttpContext, user); return(Json(new { statusCode = ResponseStatus.Success })); }
public void Put(string id) { // Card cards = value; Card cards = JsonConvert.DeserializeObject <Card>(id); cards.CardProgress = LaneType.Backlog; cards.Date = DateTime.Now.ToShortDateString(); var board = _cache.Get <Board>("currentState"); cards.ID = board.LastID + 1; board.LastID = cards.ID; BoardManager.AddCardToBoard(board, cards); _cache.Set("currentState", board, TimeSpan.FromDays(1)); var serlizedList = JsonConvert.SerializeObject(board.AllCards); string allText = System.IO.File.ReadAllText("configuration.json"); EncriptionKey key = JsonConvert.DeserializeObject <EncriptionKey>(allText); var filekey = Encription.GetEncriptedFile(key); filekey.Description = serlizedList; Encription.EncriptedFile(filekey); Encription.SaveDataSet(filekey); }
protected void Page_Load(object sender, EventArgs e) { Encription.SchrijfNaarLogFile("page load", ""); int Itemnummer = 0; int ProjectNummer = 0; if (Request["pdf"] != null) { customerId = Convert.ToInt32(Request["cid"]); pnlButtons.Visible = false; pnlImage.Visible = true; } else { int Medewerker_Id; int Medewerker_Role; if (!Authentication.IsAuthenticated(out Medewerker_Id, out Medewerker_Role)) { Response.Redirect(CompanyModuleBase.GetUrl("Page_Account_Login") + "?ReturnUrl=" + Server.UrlEncode(Request.Url.ToString())); } // pnlImage.Visible = false; pnlImage.Visible = true; } try { Itemnummer = Convert.ToInt32(Request["i"]); } catch { Itemnummer = 0; } try { ProjectNummer = Convert.ToInt32(Request["p"]); } catch { ProjectNummer = 0; } var _db = new Ncdo.Company.Data.Entiteiten.Entities(); Ncdo.Company.Data.Entiteiten.Items Item; Ncdo.Company.Data.Entiteiten.Projecten Project; Ncdo.Company.Data.Entiteiten.Item_Soorten Soort; Ncdo.Company.Data.Entiteiten.Item_Soort_Types Type; Ncdo.Company.Data.Entiteiten.Klanten Klant; Ncdo.Company.Data.Entiteiten.Klant_Locaties Locatie; TextKlant.Text = ""; TextLocatie.Text = ""; TextItemSoort.Text = ""; TextItemType.Text = ""; Item = Ncdo.Company.Data.Functies.Items.GetById(Itemnummer); Project = Ncdo.Company.Data.Functies.Projecten.GetById(ProjectNummer); TextItemNummer.Text = Item.Item_Identifier; TextProjectNummer.Text = Project.ProjectNr; TextOmschrijving.Text = Project.Omschrijving; TextBegindatum.Text = string.Format("{0:dd-MM-yyyy}", Project.Begindatum); TextEinddatum.Text = string.Format("{0:dd-MM-yyyy}", Project.Einddatum); TextResultaat.Text = ""; if (Item.Item_Soort_Id != 0) { Soort = Ncdo.Company.Data.Functies.Item_Soorten.GetById(Item.Item_Soort_Id); TextItemSoort.Text = Soort.Naam; } if (Item.Item_Type_Id != null) { Type = Ncdo.Company.Data.Functies.Item_Soort_Types.GetById((int)Item.Item_Type_Id); TextItemType.Text = Type.Naam; } if (Item.Klant_Id != 0) { Klant = Ncdo.Company.Data.Functies.Klanten.GetById((int)Item.Klant_Id); TextKlant.Text = Klant.Bedrijfsnaam; } if (Item.Locatie_Id != null) { Locatie = Ncdo.Company.Data.Functies.Klant_Locaties.GetById((int)Item.Locatie_Id); TextLocatie.Text = Locatie.Naam; } int[] ArrayGeplandeTijden = new int[28]; ArrayGeplandeTijden = OndersteunendeFuncties.GeefGeplandeTijdenArray(Itemnummer); var resultBasis = from ic in _db.Item_Calculaties where (ic.Item_Id == Itemnummer) && (!ic.Meerwerk) group ic by ic.Item_Id into grp select new { TotBasis = grp.Sum(ic => ic.Totaalbedrag) }; decimal Basis = 0; if (resultBasis.Count() > 0) { Basis = resultBasis.First().TotBasis; } TextBasisOpbrengsten.Text = Basis.ToString("C", new CultureInfo("nl-NL")); var resultMeerwerk = from ic in _db.Item_Calculaties where (ic.Item_Id == Itemnummer) && (ic.Meerwerk) group ic by ic.Item_Id into grp select new { TotMeerwerk = grp.Sum(ic => ic.Totaalbedrag) }; decimal Meerwerk = 0; if (resultMeerwerk.Count() > 0) { Meerwerk = resultMeerwerk.First().TotMeerwerk; } TextMeerwerk.Text = Meerwerk.ToString("C", new CultureInfo("nl-NL")); var resultMateriaal = from m in _db.Materialen where (m.Item_Id == Itemnummer) group m by m.Item_Id into grp select new { TotMateriaal = grp.Sum(p => (p.Aantal * p.Prijs) * (1 + p.Opslag / 100)) }; decimal MateriaalOpbrengsten = 0; if (resultMateriaal.Count() > 0) { MateriaalOpbrengsten = Convert.ToDecimal(resultMateriaal.First().TotMateriaal); } TextMateriaalOpbrengsten.Text = MateriaalOpbrengsten.ToString("C", new CultureInfo("nl-NL")); decimal dTextTotaleOpbrengsten = Basis + Meerwerk + MateriaalOpbrengsten; TextTotaleOpbrengsten.Text = dTextTotaleOpbrengsten.ToString("C", new CultureInfo("nl-NL")); var resultKosten = from m in _db.ManagementInfo join p in _db.Projecten on m.Project_id equals p.Project_Id join i in _db.Items on p.Project_Id equals i.Project_Id where (p.Project_Id == ProjectNummer) //where (i.Item_Id == itemId) select new { Uren = m.AantalUren, Basis = m.Arbeid, Materiaal = m.Materiaal, Materieel = m.Materieel, Onderaannemer = m.Onderaanneming, Overige = m.OverigeKosten }; decimal dBasisKosten = 0; decimal dMateriaalKosten = 0; decimal dMaterieelKosten = 0; decimal dOnderaannemerKosten = 0; decimal dOverigeKosten = 0; decimal dTotaleKosten = 0; decimal dUrenNavis = 0; if (resultKosten.Count() > 0) { dBasisKosten = Convert.ToDecimal(resultKosten.First().Basis); dMateriaalKosten = Convert.ToDecimal(resultKosten.First().Materiaal); dMaterieelKosten = Convert.ToDecimal(resultKosten.First().Materieel); dOnderaannemerKosten = Convert.ToDecimal(resultKosten.First().Onderaannemer); dOverigeKosten = Convert.ToDecimal(resultKosten.First().Overige); dTotaleKosten = dBasisKosten + dMateriaalKosten + dMaterieelKosten + dOnderaannemerKosten + dOverigeKosten; dUrenNavis = Convert.ToDecimal(resultKosten.First().Uren); } TextBasisKosten.Text = dBasisKosten.ToString("C", new CultureInfo("nl-NL")); TextMateriaalKosten.Text = dMateriaalKosten.ToString("C", new CultureInfo("nl-NL")); TextMaterieel.Text = dMaterieelKosten.ToString("C", new CultureInfo("nl-NL")); TextOnderaannemer.Text = dOnderaannemerKosten.ToString("C", new CultureInfo("nl-NL")); TextOverige.Text = dOverigeKosten.ToString("C", new CultureInfo("nl-NL")); TextTotaleKosten.Text = dTotaleKosten.ToString("C", new CultureInfo("nl-NL")); TextMinutenNavis.Text = (dUrenNavis * 60).ToString(); var resultMedewerkers = from u in _db.Uitvoeringen join m in _db.Medewerkers on u.Medewerker_Id equals m.Medewerker_Id where u.Item_Id == Itemnummer group u by new { m.GebruikersNaam, u.Medewerker_Id // u.TotaleMinuten } into grp select new { Medewerker = grp.Key.GebruikersNaam, MedewerkerId = grp.Key.Medewerker_Id }; var tr = new TableRow(); tr.CssClass = "oneven"; ItemOverzicht.Rows.Add(tr); var tc = new TableCell(); tc = new TableCell(); tc.Text = "Gepland"; tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[0].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[2].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[1].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[3].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[4].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[5].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[6].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[7].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[8].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[9].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[10].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[16].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[17].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[11].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[19].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[13].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[14].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[20].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ArrayGeplandeTijden[24].ToString(); tr.Cells.Add(tc); double dTotGepland = (double)ArrayGeplandeTijden[24] / 60.00; tc = new TableCell(); tc.Text = dTotGepland.ToString("N1"); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ""; tr.Cells.Add(tc); bool isOneven = false; double dSubTotaalMinMedewerker = 0; double dSubTotaalUrenMedewerker = 0; double dEindTotaalMinMedewerker = 0; double dEindTotaalUrenMedewerker = 0; double[] ArraySubTotaalStap = new double[18]; Encription.SchrijfNaarLogFile("begin", ""); foreach (var element in resultMedewerkers) { dSubTotaalMinMedewerker = 0; tr = new TableRow(); if (isOneven) { tr.CssClass = "oneven"; isOneven = false; } else { tr.CssClass = "even"; isOneven = true; } ItemOverzicht.Rows.Add(tr); tc = new TableCell(); tc.Text = element.Medewerker; tr.Cells.Add(tc); var resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 1) select new { Tijd = u.TotaleMinuten }; int TijdStap1; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[0] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 3) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[1] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 2) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[2] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 4) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[3] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 5) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[4] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 6) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[5] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 7) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[6] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 8) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[7] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 9) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[8] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 10) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[9] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 11) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[10] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 17) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[11] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 18) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[12] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 12) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[13] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 20) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[14] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 14) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[15] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 13) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[16] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); resultStap1 = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where (u.Item_Id == Itemnummer) && (u.Medewerker_Id == element.MedewerkerId) && (ug.Stap_Id == 21) select new { Tijd = u.TotaleMinuten }; tc = new TableCell(); if (resultStap1.Count() > 0) { TijdStap1 = resultStap1.First().Tijd; dSubTotaalMinMedewerker += TijdStap1; ArraySubTotaalStap[17] += TijdStap1; tc.Text = TijdStap1.ToString(); } else { tc.Text = ""; } tr.Cells.Add(tc); tc = new TableCell(); tc.Text = dSubTotaalMinMedewerker.ToString(); tr.Cells.Add(tc); dSubTotaalUrenMedewerker = dSubTotaalMinMedewerker / 60.00; tc = new TableCell(); tc.Text = dSubTotaalUrenMedewerker.ToString("N1"); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = ""; tr.Cells.Add(tc); dEindTotaalMinMedewerker += dSubTotaalMinMedewerker; Encription.SchrijfNaarLogFile("stap", ""); } Encription.SchrijfNaarLogFile("totalen", ""); tr = new TableRow(); if (isOneven) { tr.CssClass = "oneven"; } else { tr.CssClass = "even"; } ItemOverzicht.Rows.Add(tr); tc = new TableCell(); tc.Text = "Totaal"; tr.Cells.Add(tc); for (int i = 0; i < 18; i++) { tc = new TableCell(); tc.Text = ArraySubTotaalStap[i].ToString(); tr.Cells.Add(tc); } tc = new TableCell(); tc.Text = dEindTotaalMinMedewerker.ToString(); tr.Cells.Add(tc); dEindTotaalUrenMedewerker = dEindTotaalMinMedewerker / 60.00; tc = new TableCell(); tc.Text = dEindTotaalUrenMedewerker.ToString("N1"); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = dUrenNavis.ToString("N1"); tr.Cells.Add(tc); TextMinutenBasis.Text = ArrayGeplandeTijden[24].ToString(); TextMinutenWorkfl.Text = dEindTotaalMinMedewerker.ToString(); double TotToezichtBasis = ArrayGeplandeTijden[25]; double TotWvbBasis = ArrayGeplandeTijden[26]; double TotDirectenBasis = ArrayGeplandeTijden[27]; TextToezichtBasis.Text = TotToezichtBasis.ToString(); TextWvbBasis.Text = TotWvbBasis.ToString(); TextDirectenBasis.Text = TotDirectenBasis.ToString(); var resultToezichtWorkf = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where ((u.Item_Id == Itemnummer) && ((ug.Stap_Id == 3) || (ug.Stap_Id == 7))) group u by u.TotaleMinuten into grp select new { ToezichtWorkf = grp.Sum(u => u.TotaleMinuten) }; var resultWvbWorkf = from u in _db.Uitvoeringen join ug in _db.Uitvoering_Gegevens on u.Stap_Gegevens_Id equals ug.Stap_Gegevens_Id where ((u.Item_Id == Itemnummer) && ((ug.Stap_Id == 1) || (ug.Stap_Id == 2) || (ug.Stap_Id == 13) || (ug.Stap_Id == 15) || (ug.Stap_Id == 21))) group u by u.TotaleMinuten into grp select new { WvbWorkf = grp.Sum(u => u.TotaleMinuten) }; double TotToezichtWorkfl = 0; double TotWvbWorkfl = 0; double TotDirectenWorkfl = 0; if (resultToezichtWorkf.Count() > 0) { TotToezichtWorkfl = Convert.ToDouble(resultToezichtWorkf.First().ToezichtWorkf); } if (resultWvbWorkf.Count() > 0) { TotWvbWorkfl = Convert.ToDouble(resultWvbWorkf.First().WvbWorkf); } TotDirectenWorkfl = dEindTotaalMinMedewerker - TotWvbWorkfl - TotToezichtWorkfl; TextToezichtWorkfl.Text = TotToezichtWorkfl.ToString(); TextWvbWorkfl.Text = TotWvbWorkfl.ToString(); TextDirectenWorkfl.Text = TotDirectenWorkfl.ToString(); IEnumerable <Item_Fotos> lCurrentFotos = Data.Functies.Item_Fotos.GetByItemId(Itemnummer); var fotoDiv = new HtmlGenericControl("div"); fotoDiv.Attributes.Add("class", "Company-foto-thumb"); var fotoA = new HtmlGenericControl("a"); fotoA.Attributes.Add("href", ResolveClientUrl(ConfigurationManager.AppSettings.Get(ApplicationSettings.UploadUrl) + lCurrentFotos.First().Item_Id + "//" + lCurrentFotos.First().GUID + lCurrentFotos.First().Type)); fotoDiv.Controls.Add(fotoA); var img = new Image { ImageUrl = ResolveClientUrl(ConfigurationManager.AppSettings.Get(ApplicationSettings.UploadUrl) + lCurrentFotos.First().Item_Id + "//" + lCurrentFotos.First().GUID + lCurrentFotos.First().Type), Width = 100, Height = 150 }; fotoA.Controls.Add(img); imtectdetailfotoslider.Controls.Add(fotoDiv); }