private void RegisterHandler() { regBtn.ServerClick += delegate { var redirect = string.Empty; redirect = nav.Register; var logins = new Login_table().Load_record_with(Login_table_support.Column.Username, Login_table_support.LogicalOperator.EQUAL_TO, userBox.Value); if (string.IsNullOrEmpty(logins.Id)) { if (passBox.Value == rePass.Value) { var(check, result) = reg.IsPassword(passBox.Value); if (check) { var uDetails = new User_details(); logins.insert(userBox.Value, enc.GetMD5(enc.StrongEncrypt(passBox.Value)), DateTime.Now.ToString("dd-MM-yyyy"), "3"); uDetails.insert(logins.Id, fnameBox.Value, lname.Value, emailBox.Value, addressBox.Value, contactBox.Value, genderSelect.Value, dob.Value, "patient"); Session["message"] = elements.GetMesage($"Welcome {uDetails.Fname} {uDetails.Lname}, you can now login.", HtmlElements.MessageType.SUCCESS, HtmlElements.UserType.ALL); redirect = nav.Index; } else { Session["message"] = elements.GetMesage(result, HtmlElements.MessageType.INFO, HtmlElements.UserType.ALL); } } else { Session["message"] = elements.GetMesage("Passwords do not match!", HtmlElements.MessageType.INFO, HtmlElements.UserType.ALL); } } else { Session["message"] = elements.GetMesage("Username is not available!", HtmlElements.MessageType.INFO, HtmlElements.UserType.ALL); } Response.Redirect(redirect); }; }
private void SaveDoctor() { SaveBtn.ServerClick += delegate { var redirect = string.Empty; var logins = new Login_table().Load_record_with(Login_table_support.Column.Username, Login_table_support.LogicalOperator.EQUAL_TO, userBox.Value); if (IsEmpty(logins.Id)) { var uDetails = new User_details(); var spTable = new Speciality_table(); if (passBox.Value == rePass.Value) { logins.insert(userBox.Value, enc.GetMD5(enc.StrongEncrypt(passBox.Value)), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "3"); uDetails.insert(logins.Id, Session["fname"].ToString(), Session["lname"].ToString(), Session["email"].ToString(), Session["address"].ToString(), Session["contact"].ToString(), Session["gender"].ToString(), Session["date"].ToString(), "doctor"); ImagePofile(); spTable.insert(logins.Id, Session["profession"].ToString()); new ShiftHandler().SetDocShift(logins.Id); Session["message"] = elements.GetMesage("New doctor has been added :-)", HtmlElements.MessageType.SUCCESS, HtmlElements.UserType.MANAGEMENT); Shift = new Shift(SV.ShiftFilePath, logins.Id); redirect = nav.Dashboard; } else { Session["message"] = elements.GetMesage("Passwords do not match!", HtmlElements.MessageType.SUCCESS, HtmlElements.UserType.MANAGEMENT); redirect = nav.ManNewDoctorDetails; } } else { Session["message"] = elements.GetMesage("Username already exist", HtmlElements.MessageType.SUCCESS, HtmlElements.UserType.MANAGEMENT); redirect = nav.ManNewDoctorDetails; } Response.Redirect(redirect); }; }