public void AssCourseStudenttOutput() { string splGetAssPerCoursePerStudent = "SELECT Firstname, Lastname, Stream, CourseType, Description FROM Student " + "INNER JOIN CourseStudent ON Student.Student_ID = CourseStudent.Student_ID " + "INNER JOIN Course ON CourseStudent.CourseTitle = Course.CourseTitle " + "INNER JOIN Assignment ON Course.CourseTitle = Assignment.CourseTitleA " + "ORDER BY Firstname, Lastname;"; try { using (SqlConnection conn = new SqlConnection(ConnectionString.connection)) { conn.Open(); using (SqlCommand cmSelectAssCourseStudent = new SqlCommand(splGetAssPerCoursePerStudent, conn)) { using (SqlDataReader drAssCourseStudent = cmSelectAssCourseStudent.ExecuteReader()) { Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($"| {"FIRSTNAME",-12} | {"LASTNAME",-12} | {"COURSE PARTICIPATING",-23} | {"ASSIGNMENTS",-16} |"); Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; while (drAssCourseStudent.Read()) { FirstName = drAssCourseStudent["FirstName"].ToString(); LastName = drAssCourseStudent["LastName"].ToString(); Stream = drAssCourseStudent["Stream"].ToString(); CourseType = drAssCourseStudent["CourseType"].ToString(); Description = drAssCourseStudent["Description"].ToString(); // Remove the unessessary empty space characters from inserted strings FirstName = FirstName.Replace(" ", string.Empty); LastName = LastName.Replace(" ", string.Empty); Stream = Stream.Replace(" ", string.Empty); CourseType = CourseType.Replace(" ", string.Empty); Description = Description.Replace(" ", string.Empty); Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine($"| {FirstName,-12} | {LastName,-12} | {Stream,-10} | {CourseType,-10} |{Description,-17} |"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; } Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($"| {"FIRSTNAME",-12} | {"LASTNAME",-12} | {"COURSE PARTICIPATING",-23} | {"ASSIGNMENTS",-16} |"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void personEditor() { Console.WriteLine("Введiть iм'я, прiзвище та стать з нової стрiчки:"); Console.Write("\tIм'я: "); FirstName = Console.ReadLine(); FirstName = FirstName.Replace('?', 'і'); Console.Write("\tПрiзвище: "); LastName = Console.ReadLine(); LastName = LastName.Replace('?', 'і'); if (Regex.Match(FirstName, @"[^a-zA-Zа-яА-Я]").Success || Regex.Match(LastName, @"[^a-zA-Za-яА-Я]").Success) { throw new Exception("Стрiчка може мiстити тiльки символи латиницi або кирилицi"); } Console.Write("\tСтать: "); String gender = Console.ReadLine(); gender = gender.ToLower(); if (gender == "чоловiча" || gender == "чоловiк" || gender == "чолов?к" || gender == "чолов?ча" || gender == "ч") { this.gender = Gender.Чоловiк; } else if (gender == "жiноча" || gender == "жiнка" || gender == "ж?нка" || gender == "ж?ноча" || gender == "ж") { this.gender = Gender.Жiнка; } else { throw new Exception("Такої статi не iснує"); } int day, month, year; Console.WriteLine("Введiть дату народження"); Console.Write("\tДень: "); day = Convert.ToInt32(Console.ReadLine()); if (day > 31 || day <= 0) { throw new Exception("Неможливе значення"); } Console.Write("\tМiсяць: "); month = Convert.ToInt32(Console.ReadLine()); if (month <= 0 || month > 12) { throw new Exception("Неможливе значення"); } Console.Write("\tРiк: "); year = Convert.ToInt32(Console.ReadLine()); if (year <= 0 || year >= DateTime.Today.Year) { throw new Exception("Неможливе значення"); } this.DateOfBirth = new DateTime(year, month, day); }
public void StudentSelectOutput() { string splGetStudent = "SELECT * FROM Student"; try { using (SqlConnection conn = new SqlConnection(ConnectionString.connection)) { conn.Open(); using (SqlCommand cmSelectStudent = new SqlCommand(splGetStudent, conn)) { using (SqlDataReader drStudents = cmSelectStudent.ExecuteReader()) { Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($"| {"STUDENT ID",-12} | {"FIRSTNAME",-12} | {"LASTNAME",-12} | {"BIRTHDATE",-12} | {"TUITION FEES", -12} |"); Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; while (drStudents.Read()) { Student_ID = drStudents["Student_ID"].ToString(); FirstName = drStudents["FirstName"].ToString(); LastName = drStudents["LastName"].ToString(); TuitionFees = drStudents["TuitionFees"].ToString(); BirthDate = drStudents["BirthDate"].ToString(); // Seperate the Date from Time (I will not show time) string[] BirthDateList = BirthDate.Split(' '); // Remove the unessessary empty space characters from inserted strings Student_ID = Student_ID.Replace(" ", string.Empty); FirstName = FirstName.Replace(" ", string.Empty); LastName = LastName.Replace(" ", string.Empty); TuitionFees = TuitionFees.Replace(" ", string.Empty); BirthDate = BirthDate.Replace(" ", string.Empty); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"| {Student_ID,-12} | {FirstName, -12} | {LastName, -12} | {BirthDateList[0],-12} | {TuitionFees + " euro", -13}|"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; } Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($"| {"STUDENT ID",-12} | {"FIRSTNAME",-12} | {"LASTNAME",-12} | {"BIRTHDATE",-12} | {"TUITION FEES", -12} |"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void Output() { string splGetStudents = "SELECT Student.Student_ID, Student.LastName, Student.FirstName, COUNT(Course.CourseType) " + "AS 'NumberOfCourses' FROM Student " + "INNER JOIN CourseStudent ON Student.Student_ID = CourseStudent.Student_ID " + "INNER JOIN Course ON CourseStudent.CourseTitle = Course.CourseTitle " + "GROUP BY Student.Student_ID, Student.LastName, Student.FirstName " + "HAVING COUNT(Course.CourseType) > 1;"; try { using (SqlConnection conn = new SqlConnection(ConnectionString.connection)) { conn.Open(); using (SqlCommand cmSelectStudents = new SqlCommand(splGetStudents, conn)) { using (SqlDataReader drStudents = cmSelectStudents.ExecuteReader()) { Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($"| {"STUDENT ID",-11} | {"FIRSTNAME",-15} | {"LASTNAME",-15} | {"NUMBER OF COURSES",-22} | "); Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine("----------------------------------------------------------------------------"); while (drStudents.Read()) { Student_ID = drStudents["Student_ID"].ToString(); FirstName = drStudents["FirstName"].ToString(); LastName = drStudents["LastName"].ToString(); NumberOfCourses = drStudents["NumberOfCourses"].ToString(); // Remove the unessessary empty space characters from inserted strings Student_ID = Student_ID.Replace(" ", string.Empty); FirstName = FirstName.Replace(" ", string.Empty); LastName = LastName.Replace(" ", string.Empty); NumberOfCourses = NumberOfCourses.Replace(" ", string.Empty); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine($"| {Student_ID,-11} | {FirstName,-15} | {LastName,-15} | {NumberOfCourses,-12} |"); Console.WriteLine("----------------------------------------------------------------------------"); } Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($"| {"STUDENT ID",-11} | {"FIRSTNAME",-15} | {"LASTNAME",-15} | {"NUMBER OF COURSES",-22} | "); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void StudentCoursetOutput() { string splGetStudentCourse = "SELECT Firstname, Lastname, Stream, CourseType FROM Student " + "INNER JOIN CourseStudent ON Student.Student_ID = CourseStudent.Student_ID " + "INNER JOIN Course ON CourseStudent.CourseTitle = Course.CourseTitle;"; try { using (SqlConnection conn = new SqlConnection(ConnectionString.connection)) { conn.Open(); using (SqlCommand cmSelectStudentCourse = new SqlCommand(splGetStudentCourse, conn)) { using (SqlDataReader drStudentCourse = cmSelectStudentCourse.ExecuteReader()) { Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($"| {"FIRSTNAME",-18} | {"LASTNAME",-18} | {"COURSE PARTICIPATING",-30} | "); Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; while (drStudentCourse.Read()) { FirstName = drStudentCourse["FirstName"].ToString(); LastName = drStudentCourse["LastName"].ToString(); Stream = drStudentCourse["Stream"].ToString(); CourseType = drStudentCourse["CourseType"].ToString(); // Remove the unessessary empty space characters from inserted strings FirstName = FirstName.Replace(" ", string.Empty); LastName = LastName.Replace(" ", string.Empty); Stream = Stream.Replace(" ", string.Empty); CourseType = CourseType.Replace(" ", string.Empty); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"| {FirstName,-18} | {LastName,-18} | {Stream,-14} | {CourseType,-13} |"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; } Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($"| {"FIRSTNAME",-18} | {"LASTNAME",-18} | {"COURSE PARTICIPATING",-30} | "); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void TrainerSelectOutput() { string splGetTrainer = "SELECT * FROM Trainer"; try { using (SqlConnection conn = new SqlConnection(ConnectionString.connection)) { conn.Open(); using (SqlCommand cmSelectTrainer = new SqlCommand(splGetTrainer, conn)) { using (SqlDataReader drTrainer = cmSelectTrainer.ExecuteReader()) { Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($"| {"TRAINER ID",-12} | {"FIRSTNAME",-12} | {"LASTNAME",-12} | {"SUBJECT",-12} | {"COURSE TITLE",-12} |"); Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; while (drTrainer.Read()) { Trainer_ID = drTrainer["Trainer_ID"].ToString(); FirstName = drTrainer["FirstName"].ToString(); LastName = drTrainer["LastName"].ToString(); Subject = drTrainer["Subject"].ToString(); CourseTitle = drTrainer["CourseTitle"].ToString(); // Remove the unessessary empty space characters from inserted strings Trainer_ID = Trainer_ID.Replace(" ", string.Empty); FirstName = FirstName.Replace(" ", string.Empty); LastName = LastName.Replace(" ", string.Empty); Subject = Subject.Replace(" ", string.Empty); CourseTitle = CourseTitle.Replace(" ", string.Empty); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"| {Trainer_ID,-12} | {FirstName,-12} | {LastName,-12} | {Subject, -12} | {CourseTitle, -12} |"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; } Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($"| {"TRAINER ID",-12} | {"FIRSTNAME",-12} | {"LASTNAME",-12} | {"SUBJECT",-12} | {"COURSE TITLE",-12} |"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { RegistrationFlow.CanSaveConsentInfo = false; Page.Title = "Customer Verification"; CallCenter_CallCenterMaster1 obj; obj = (CallCenter_CallCenterMaster1)this.Master; obj.SetTitle("Customer Verification"); obj.SetBreadCrumbRoot = "<a href=\"/CallCenter/CallCenterRepDashboard/Index\">Dashboard</a>"; obj.hideucsearch(); CallCenterOrganizationId = 0; if (CurrentOrganizationRole.CheckRole((long)Roles.CallCenterRep)) { CallCenterOrganizationId = CurrentOrganizationRole.OrganizationId; } if (!IsPostBack) { if (CallId != null) { hfCallStartTime.Value = new CallCenterCallRepository().GetCallStarttime(CallId.Value); } if (CallId != null && !string.IsNullOrWhiteSpace(FirstName) && !string.IsNullOrWhiteSpace(LastName) && !string.IsNullOrWhiteSpace(CallBackNumber)) { IProspectCustomerRepository prospectCustomerRepository = new ProspectCustomerRepository(); var listProspectCustomerViewData = prospectCustomerRepository.GetProspectCustomersWithFiltersforCallCenterRep(FirstName, LastName, CallBackNumber.Replace("(", "").Replace(")", "").Replace("-", "")); if (listProspectCustomerViewData != null) { if (listProspectCustomerViewData.Count > 10) { ProspectGridView.DataSource = listProspectCustomerViewData.GetRange(0, 10); ProspectGridView.DataBind(); ProspectCustomerWarningContainerDiv.Style[HtmlTextWriterStyle.Display] = "block"; } else { ProspectGridView.DataSource = listProspectCustomerViewData; ProspectGridView.DataBind(); } hfheader.Value = "divHeaderProspect"; } else { ProspectCustomerNoResultFoundContainerDiv.Style[HtmlTextWriterStyle.Display] = "block"; ProspectCustomerContainerDiv.Style[HtmlTextWriterStyle.Display] = "none"; } } else { ProspectCustomerNoResultFoundContainerDiv.Style[HtmlTextWriterStyle.Display] = "block"; ProspectCustomerContainerDiv.Style[HtmlTextWriterStyle.Display] = "none"; } var masterDal = new MasterDAL(); if (!String.IsNullOrWhiteSpace(Zip)) { _customerDataZip = masterDal.SearchCustomersOnCall(FirstName.Replace("'", "''"), LastName.Replace("'", "''"), Zip, 1, CallBackNumber, CustomerId, MemberId, Hicn, PhoneNumber, EmailId, CallCenterOrganizationId, MbiNumber); if (_customerDataZip != null && _customerDataZip.Count > 0) { grdCustomerListZIP.DataSource = _customerDataZip; grdCustomerListZIP.DataBind(); pnlZIP.Enabled = true; hfheader.Value = "divHeaderZIP"; divNoResultsMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "none"); divResultsMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "block"); if (_customerDataZip.Count > 20) { divMoreResultsMatchingZip.Visible = true; } } else { //pnlZIP.Enabled = false; divNoResultsMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "block"); divResultsMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "none"); //hfheader.Value = "divHeaderOTHERS"; } } else { //pnlZIP.Enabled = false; divNoResultsMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "block"); divResultsMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "none"); //hfheader.Value = "divHeaderOTHERS"; } _customerData = masterDal.SearchCustomersOnCall(FirstName.Replace("'", "''"), LastName.Replace("'", "''"), Zip, 0, CallBackNumber, CustomerId, MemberId, Hicn, PhoneNumber, EmailId, CallCenterOrganizationId, MbiNumber); if (_customerData != null && _customerData.Count > 0) { divNoResultsWithoutMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "none"); divResultsWithoutMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "block"); grdCustomerList.DataSource = _customerData; grdCustomerList.DataBind(); if (_customerData.Count > 20) { divMoreResultsWithoutMatchingZip.Visible = true; } hfheader.Value = "divHeaderOTHERS"; } else { divNoResultsWithoutMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "block"); divResultsWithoutMatchingZip.Style.Add(HtmlTextWriterStyle.Display, "none"); //pnlOTHERS.Enabled = false; //divResults.Style.Add(HtmlTextWriterStyle.Display, "none"); } if (_customerDataZip != null && _customerDataZip.Count > 0) { hfheader.Value = "divHeaderZIP"; } else if (_customerData != null && _customerData.Count > 0) { hfheader.Value = "divHeaderOTHERS"; } } Page.ClientScript.RegisterStartupScript(typeof(string), "jscode_tabSelection", "sel_caption('" + hfheader.Value + "');", true); switch (hfheader.Value) { case "divHeaderOTHERS": tbpnlContainer.ActiveTab = pnlOTHERS; break; case "divHeaderZIP": tbpnlContainer.ActiveTab = pnlZIP; break; case "divHeaderProspect": tbpnlContainer.ActiveTab = pnlProspect; break; default: return; } if (RegistrationFlow.CallQueueCustomerId > 0) { var callQueueCustomerRepository = IoC.Resolve <ICallQueueCustomerRepository>(); var callQueueRepository = IoC.Resolve <ICallQueueRepository>(); var callQueueCriteriaRepository = IoC.Resolve <ICallQueueCriteriaRepository>(); var callQueueCustomer = callQueueCustomerRepository.GetById(RegistrationFlow.CallQueueCustomerId); var callQueue = callQueueRepository.GetById(callQueueCustomer.CallQueueId); CallQueueCriteria callQueueCriteria = null; if (callQueueCustomer.CallQueueCriteriaId.HasValue && callQueueCustomer.CallQueueCriteriaId.Value > 0) { callQueueCriteria = callQueueCriteriaRepository.GetById(callQueueCustomer.CallQueueCriteriaId.Value); } if (callQueue.ScriptId.HasValue && callQueue.ScriptId.Value > 0) { var scriptRepository = IoC.Resolve <IScriptRepository>(); var script = scriptRepository.GetById(callQueue.ScriptId.Value); var scriptText = string.Empty; if (callQueueCriteria != null && callQueueCriteria.CriteriaId == (long)QueueCriteria.PhysicianPartner) { var userSession = IoC.Resolve <ISessionContext>().UserSession; var pcpRepository = IoC.Resolve <IPrimaryCarePhysicianRepository>(); var pcp = callQueueCustomer.CustomerId.HasValue ? pcpRepository.Get(callQueueCustomer.CustomerId.Value) : null; if (pcp != null) { scriptText = "Hi, this is " + HttpUtility.HtmlEncode(userSession.FullName) + " calling on behalf of " + HttpUtility.HtmlEncode(pcp.Name.FullName) + " and Physician partner office. "; } } ScriptTextDiv.InnerHtml = System.Web.Security.AntiXss.AntiXssEncoder.HtmlEncode(scriptText + script.ScriptText, true); } } }
public void Update() { string strsql = "update JobSeeker set " + "TitleId= " + TitleId + ", " + "FirstName= '" + FirstName.Replace("'", "''") + "', " + "LastName= '" + LastName.Replace("'", "''") + "', " + "EmailId= '" + EmailId.Replace("'", "''") + "', " + "Status= '" + Status.Replace("'", "''") + "' " + " where ID =" + Id; SqlConnection ObjConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyJobPortal"].ConnectionString); ObjConnection.Open(); SqlCommand ObjCommand = new SqlCommand(strsql, ObjConnection); ObjCommand.ExecuteNonQuery(); ObjConnection.Dispose(); ObjCommand.Dispose(); }
public void StudentPerSpecificCourse() { string sqlStudentsInInputCourse = "SELECT Student.Student_ID, Firstname, Lastname, Stream, CourseType FROM Student " + "INNER JOIN CourseStudent ON Student.Student_ID = CourseStudent.Student_ID " + "INNER JOIN Course ON CourseStudent.CourseTitle = Course.CourseTitle " + "WHERE Course.CourseTitle = @inputcoursetitle"; try { using (SqlConnection conn = new SqlConnection(ConnectionString.connection)) { conn.Open(); using (SqlCommand cmAssCourseStudent = new SqlCommand(sqlStudentsInInputCourse, conn)) { // Add Parameter 1 SqlParameter parameter = new SqlParameter("@inputcoursetitle", CourseTitle); cmAssCourseStudent.Parameters.Add(parameter); using (SqlDataReader drAssCourseStudent = cmAssCourseStudent.ExecuteReader()) { // Display Title Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("#==========================================================================#"); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"| STUDENTS IN CHOSEN COURSE |"); Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("#==========================================================================#"); Console.ForegroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($"| {"FIRSTNAME",-18} | {"LASTNAME",-18} | {"COURSE PARTICIPATING",-30} | <{"CHOOSE ID",-8}>"); Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; while (drAssCourseStudent.Read()) { Student_ID = drAssCourseStudent["Student_ID"].ToString(); FirstName = drAssCourseStudent["FirstName"].ToString(); LastName = drAssCourseStudent["LastName"].ToString(); Stream = drAssCourseStudent["Stream"].ToString(); CourseType = drAssCourseStudent["CourseType"].ToString(); // Remove the unessessary empty space characters from inserted strings Student_ID = Student_ID.Replace(" ", string.Empty); FirstName = FirstName.Replace(" ", string.Empty); LastName = LastName.Replace(" ", string.Empty); Stream = Stream.Replace(" ", string.Empty); CourseType = CourseType.Replace(" ", string.Empty); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"| {FirstName,-18} | {LastName,-18} | {Stream,-14} | {CourseType,-13} | < {Student_ID,-6}>"); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; } Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($"| {"FIRSTNAME",-18} | {"LASTNAME",-18} | {"COURSE PARTICIPATING",-30} | <{"CHOOSE ID",-8}> "); Console.WriteLine("----------------------------------------------------------------------------"); Console.ForegroundColor = ConsoleColor.White; } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private string MakeFullName() { return((LastName.Replace(" ", "") + " " + FirstName).Trim()); }
public string[] ToMailingStringArray(string callsource) { //string[] _columnHeadings = new string[] { "FirstName", "MiddleName", "FiledDate", "DischargedDate", "LastName", "Suffix", "Address1", "Address2", "City", "State", "PostalCode", "Callsource" }; if (LastName == "Oliver") { Debug.WriteLine(LastName); } _firstName = Capitalize(_firstName).Replace(',', ' ').Trim(); _lastName = Capitalize(_lastName).Replace(',', ' ').Trim(); _city = Capitalize(_city).Replace(',', ' ').Trim(); if (AddrLine1.Contains(",")) { string[] address = AddrLine1.Split(','); string[] _returnString = null; if (address.Length == 2) { address[0] = Capitalize(address[0]); address[1] = Capitalize(address[1]); if (AddrLine2 != null && AddrLine2.Length > 0) { AddrLine2 = Capitalize(AddrLine2); } _returnString = new string[] { CMECF_Internal.ToString(), CaseNumber4Digit, FileDateString, DischargeDateString, FirstName.Replace(",", "").Replace("\"", "'"), MiddleName.Replace(",", "").Replace("\"", "'"), LastName.Replace(",", "").Replace("\"", "'"), Suffix.Replace(",", ""), address[0].Replace("\"", "'"), address[1].Replace("\"", "'"), City, StateCode, PostalCodeString, callsource }; } else if (address.Length == 3) { address[0] = Capitalize(address[0]); address[1] = Capitalize(address[1]); address[2] = Capitalize(address[2]); if (AddrLine2 != null && AddrLine2.Length > 0) { AddrLine2 = Capitalize(AddrLine2); } _returnString = new string[] { CMECF_Internal.ToString(), CaseNumber4Digit, FileDateString, DischargeDateString, FirstName.Replace(",", ""), MiddleName.Replace(",", ""), LastName.Replace(",", ""), Suffix.Replace(",", ""), address[0], address[1] + " " + address[2], City, StateCode, PostalCodeString, callsource }; } else { throw new FormatException("The address for: " + _firstName + " " + _lastName + " is not valid: " + AddrLine1 + " wrong number of commas! Please lookup the record and correct the address"); } return(_returnString); } else { if (_addrLine1 != null && _addrLine1.Length > 0) { _addrLine1 = Capitalize(_addrLine1); } if (_addrLine2 != null && _addrLine2.Length > 0) { _addrLine2 = Capitalize(_addrLine2); } string[] _returnString = new string[] { CMECF_Internal.ToString(), CaseNumber4Digit.Replace(",", ""), FileDateString, DischargeDateString, FirstName.Replace(",", "").Replace("\"", "'"), MiddleName.Replace(",", "").Replace("\"", "'"), LastName.Replace(",", "").Replace("\"", "'"), Suffix.Replace(",", ""), AddrLine1.Replace("\"", "'"), _addrLine2.Replace(",", "").Replace("\"", "'"), City.Replace(",", "").Replace("\"", "'"), StateCode.Replace(",", ""), PostalCodeString.Replace(",", ""), callsource }; return(_returnString); } }
public void Update() { string strsql = "update Person set " + "TitleId= " + TitleId + ", " + "FirstName= '" + FirstName.Replace("'", "''") + "', " + "LastName= '" + LastName.Replace("'", "''") + "', " + "EmailId= '" + EmailId.Replace("'", "''") + "', " + "Password= '******'", "''") + "', " + "Role= '" + Role.Replace("'", "''") + "', " + "Status= '" + Status.Replace("'", "''") + "', " + "EnableEmail= " + Convert.ToInt32(EnableEmail) + " " + " where ID =" + Id; SqlConnection ObjConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyJobPortal"].ConnectionString); ObjConnection.Open(); SqlCommand ObjCommand = new SqlCommand(strsql, ObjConnection); ObjCommand.ExecuteNonQuery(); ObjConnection.Dispose(); ObjCommand.Dispose(); }