public static bool ShowClockInRequest() { ServiceGet serviceGet = new ServiceGet(); FrmClockIn frmClockIn = new FrmClockIn(); if (frmClockIn.ShowDialog() == DialogResult.OK) { if (frmClockIn.Success) { return(true); } int check = serviceGet.Login(frmClockIn.MaNV, frmClockIn.pass.ToLower(), StaticClass.storeId); if (check == 2) { return(true); } if (check == 0) { Alert.Show("Đăng nhập sai mã nhân\n viên !", Color.Red); return(false); } if (check == 1) { Alert.Show("Password không đúng !", Color.Red); return(false); } if (check == 3) { Alert.Show("Tài khoản bị vô hiệu.", Color.Red); return(false); } } return(false); }
public CrudApplication() : base() { var provider = ServiceGet.GetProvider(); Write = ServiceGet.GetProvider()?.GetService <IModifyApplication <T, CreateT> >(); Read = ServiceGet.GetProvider()?.GetService <IReadonlyApplication <T, GetT> >(); }
public Controller() { var provider = ServiceGet.GetProvider(); _mapper = provider?.GetService <IMapper>(); _conn = provider?.GetService <ConnectionMultiplexer>(); _cache = _conn?.GetDatabase(); }
public static void Print(ReportClass reportClass, string printerName) { Service.ServiceGet serviceGet = new ServiceGet(); Printer printer = serviceGet.GetPrinterByName(StaticClass.storeId, StaticClass.stationId, printerName); if (!(printer == null || printer.Details == "NONE" || printer.Disable == true)) { reportClass.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true); reportClass.PrintOptions.PrinterName = printer.Details; reportClass.PrintOptions.ApplyPageMargins(new PageMargins(1, 2, 1, 0)); reportClass.PrintToPrinter(1, false, 0, 0); } }
private void button51_Click(object sender, EventArgs e) { if (!Employee.CheckGrant(StaticClass.storeId, StaticClass.cashierId, Employee.CFA_Open_Cash_Drawer)) { return; } //rptOpenDrawer rptOpenDrawer = new rptOpenDrawer(); //Utilities.Utils.Print(rptOpenDrawer,Printer.PrinterHoadon); Service.ServiceGet serviceGet = new ServiceGet(); Printer printer = serviceGet.GetPrinterByName(StaticClass.storeId, StaticClass.stationId, Printer.PrinterHoadon); if (!(printer == null || printer.Details == "NONE" || printer.Disable == true)) { Service.CashdrawerService.OpenCashDrawer1(printer.Details); } }
public static bool CheckGrant(string storeId, string cashierId, int grantNum) { get_GUI getGui = new get_GUI(); DataTable emp = getGui.GetEmpById(cashierId); Service.ServiceGet service = new ServiceGet(); switch (grantNum) { case XEM_BAN_KHAC: if (emp.Rows[0][XEM_BAN_KHAC].ToString() == "P") { return(true); } else if (emp.Rows[0][XEM_BAN_KHAC].ToString() == "Y") { FrmAdminPass frm = new FrmAdminPass(); if (frm.ShowDialog() == DialogResult.OK) { if (!service.checkAdminPass(frm.text, storeId)) { MessageBox.Show("Password không đúng !"); return(false); } else { return(true); } } else { return(false); } } else { return(false); } break; default: return(false); } }
public static bool ShowAdminPassRequest() { Service.ServiceGet serviceGet = new ServiceGet(); FrmAdminPass frm = new FrmAdminPass(); if (frm.ShowDialog() == DialogResult.OK) { if (!serviceGet.checkAdminPass(frm.text, StaticClass.storeId)) { Alert.Show("Password không đúng !"); return(false); } else { return(true); } } return(false); }
private void creTextBox2_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { Service.ServiceGet serviceGet = new ServiceGet(); if (serviceGet.checkAdminPass(creTextBox2.Text, StaticClass.storeId)) { Success = true; StaticClass.isAdmin = true; DialogResult = DialogResult.OK; } if (serviceGet.LoginBySwipe(creTextBox2.Text, StaticClass.storeId) == 0) { Success = true; DialogResult = DialogResult.OK; } creTextBox1.SelectAll(); creTextBox1.Focus(); } }
public static void Print(ReportClass reportClass, string printerName) { Service.ServiceGet serviceGet = new ServiceGet(); Printer printer = serviceGet.GetPrinterByName(StaticClass.storeId, StaticClass.stationId, printerName); if (!(printer == null || printer.Details == "NONE" || printer.Disable == true)) { if (StaticClass.mode == "AUT") { reportClass.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true); } else if (StaticClass.mode == "SQL") { //reportClass.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, // StaticClass.userName, StaticClass.password); reportClass.SetDatabaseLogon(StaticClass.userName, StaticClass.password, StaticClass.serverName, StaticClass.databaseName, true); reportClass.DataSourceConnections[0].IntegratedSecurity = false; } else { return; } if (printerName == "Hóa đơn") { reportClass.PrintOptions.ApplyPageMargins(new PageMargins(1, 2, 1, 0)); } try { reportClass.PrintOptions.PrinterName = printer.Details; reportClass.PrintToPrinter(1, false, 0, 0); } catch (Exception) { Alert.Show("Lỗi máy in", Color.Red); } } }
private static bool check(string storeId, string cashierId, string columnName) { get_GUI getGui = new get_GUI(); DataTable emp = getGui.GetEmployeeByID(storeId, cashierId); Service.ServiceGet service = new ServiceGet(); if (emp.Rows[0][columnName].ToString() == "Y") { return(true); } else if (emp.Rows[0][columnName].ToString() == "P") { FrmAdminPass frm = new FrmAdminPass(); if (frm.ShowDialog() == DialogResult.OK) { if (!service.checkAdminPass(frm.text, storeId)) { Alert.Show("Password không đúng !", Color.Red); return(false); } else { return(true); } } else { return(false); } } else if (emp.Rows[0][columnName].ToString() == "N") { Alert.Show("Bạn không có quyền để\n thực hiện chức năng này", Color.Red); return(false); } return(false); }
public ReadOnlyController() : base() { Read = ServiceGet.GetProvider()?.GetService <IReadonlyApplication <T, GetT> >(); }
private void FrmEditLayout_Load(object sender, EventArgs e) { //ArrayList a = new ArrayList(); //a.Add(new MyButton(100,100,50,50)); //ArrayList b = new ArrayList(); //b.Add(new MyButton(200, 200, 100, 100)); //ArrayList c = new ArrayList(); //c.Add(new MyButton(200, 200, 100, 100)); //ArrayList d = new ArrayList(); //d.Add(new MyButton(200, 200, 100, 100)); //ArrayList f = new ArrayList(); //f.Add(new MyButton(200, 200, 100, 100)); //listPanel.Add("khu 1", new panel("khu 1")); //listPanel.Add("khu 2", new panel(b, "khu 2")); //listPanel.Add("khu 3", new panel(c, "khu 3")); //listPanel.Add("khu 4", new panel(d, "khu 4")); //listPanel.Add("khu 5", new panel(f, "khu 5")); //sections.Add("khu 1"); //sections.Add("khu 2"); //sections.Add("khu 3"); //sections.Add("khu 4"); //sections.Add("khu 5"); //this.Controls.Add((panel)listPanel["khu 1"]); //this.Controls.Add((panel)listPanel["khu 2"]); //this.Controls.Add((panel)listPanel["khu 3"]); //this.Controls.Add((panel)listPanel["khu 4"]); //this.Controls.Add((panel)listPanel["khu 5"]); serviceGet = new ServiceGet(); DataTable sectionList = serviceGet.getSections("1001"); for (int i = 0; i < sectionList.Rows.Count; i++) { string sectionName = sectionList.Rows[i][1].ToString(); ArrayList buttons = serviceGet.getTablesEdit("1001", sectionName); Color color1 = Color.FromArgb((int)sectionList.Rows[i][2]); Color color2 = Color.FromArgb((int)sectionList.Rows[i][3]); listPanel.Add(sectionName, new panel(buttons, sectionName, color1, color2)); sections.Add(sectionName); if (buttons.Count != 0) { ((panel)listPanel[sectionName]).colorBar3.color_prop = ((MyButton)buttons[0]).borColor; } this.Controls.Add((panel)listPanel[sectionName]); } button10.changeColor(Color.White, Color.Red); pageIndex = 1; selectedSection = 1; if (listPanel.Count % 4 == 0) { pageNum = listPanel.Count / 4; } else { pageNum = listPanel.Count / 4 + 1; } int x; if (pageIndex * 4 <= listPanel.Count) { x = 4; } else { x = listPanel.Count % 4; } changeColorButton(x); checkInvisible(); }
public static bool CheckGrant(string storeId, string cashierId, int grantNum) { if (!StaticClass.isAdmin) { get_GUI getGui = new get_GUI(); DataTable emp = getGui.GetEmpById(cashierId); Service.ServiceGet service = new ServiceGet(); switch (grantNum) { case XEM_BAN_KHAC: return(check(storeId, cashierId, "CFA_Other_Tables")); case CFA_INVOICE_DELETE_ITEMS: return(check(storeId, cashierId, "CFA_Invoice_DeleteItems")); case CFA_INVOICE_DISCOUNT: return(check(storeId, cashierId, "CFA_Invoice_Discount")); case CFA_INVOICE_PRICE_CHANGE: return(check(storeId, cashierId, "CFA_Invoice_PriceChange")); case CFA_INVOICE_VOID: return(check(storeId, cashierId, "CFA_Invoice_Void")); case CFA_TRANSFER_TABLE: return(check(storeId, cashierId, "CFA_Transfer_Tables")); case CFA_INVOICE_QUAN_CHANGE: return(check(storeId, cashierId, "CFA_ENDTRANS_CASH")); case CFA_INVOICE_RETURN: return(check(storeId, cashierId, "CFA_Refund_Item")); case CFA_SETUP_TAX: return(check(storeId, cashierId, "CFA_Setup_Tax")); case CFA_SETUP_PRINTER: return(check(storeId, cashierId, "CFA_Setup_DefPrinter")); case CFA_SETUP_RECEIPT_NOTES: return(check(storeId, cashierId, "CFA_SETUP_RECEIPT_NOTES")); case CFA_SETUP_DEPTS_EDIT: return(check(storeId, cashierId, "CFA_Depts_Edit")); case CFA_SETUP_INVENT_EDIT: return(check(storeId, cashierId, "CFA_Inven_Edit")); case CFA_SETUP_EDIT_EMP: return(check(storeId, cashierId, "CFA_SETUP_EDIT_EMPLOYEES")); case CFA_REPORT_DISPLAY: return(check(storeId, cashierId, "CFA_Reports_Display")); case CFA_TS_CONFIG: return(check(storeId, cashierId, "CFA_TS_CONFIG")); case CFA_Open_Cash_Drawer: return(check(storeId, cashierId, "CFA_Open_Cash_Drawer")); case CFA_Cust_Edit: return(check(storeId, cashierId, "CFA_Cust_Edit")); case CFA_PRINT_HOLD: return(check(storeId, cashierId, "CFA_PRINT_HOLD")); case CFA_ENDTRANS_ACCOUNT: return(check(storeId, cashierId, "CFA_ENDTRANS_ACCOUNT")); case CFA_AUCTION_SHIP: return(check(storeId, cashierId, "CFA_AUCTION_SHIP")); case CFA_PULLBACK_INVOICE: return(check(storeId, cashierId, "CFA_PULLBACK_INVOICE")); default: return(false); } } else { return(true); } }
public ModifyController() { Write = ServiceGet.GetProvider()?.GetService <IModifyApplication <T, CreateT> >(); }
public ModifyApplication() { Repository = ServiceGet.GetProvider()?.GetService <IModifyRepository <T> >(); }
public static void UseCoreServiceGet(this IApplicationBuilder app) { ServiceGet.SetProvider(app.ApplicationServices); }
public ReadonlyApplication() : base() { Repository = ServiceGet.GetProvider()?.GetService <IReadonlyRepository <T> >(); }
public FrmManager() { InitializeComponent(); selectedButton = ""; serviceGet = new ServiceGet(); }
public FrmBanHang() { InitializeComponent(); serviceGet = new ServiceGet(); getGui = new get_GUI(); //for (int i = 1; i < 8;i++ ) //{ // button tmp = (button)panel1.Controls["button" + i.ToString()]; // tmp.changeColor(Color.White,Color.Orange); //} //for (int i = 15; i < 43; i++) //{ // button tmp = (button)panel2.Controls["button" + i.ToString()]; // tmp.changeColor(Color.White, Color.Gray); //} button45.changeColor(Color.White, Color.OrangeRed); button46.changeColor(Color.White, Color.OrangeRed); button47.changeColor(Color.White, Color.Orange); button48.changeColor(Color.White, Color.Yellow); button49.changeColor(Color.White, Color.OrangeRed); button50.changeColor(Color.White, Color.Gray); button52.changeColor(Color.White, Color.Gray); button53.changeColor(Color.White, Color.Orange); button54.changeColor(Color.White, Color.Green); //listNhomHang = new ArrayList(); //for (int i = 1; i < 18; i++) //{ // listNhomHang.Add(i.ToString()); //} //for (int i = 1; i < 70; i++) //{ // listMatHang.Add(i.ToString()); //} listMatHang = new ArrayList(); listIdNhomHang = new ArrayList(); listNhomHang = new ArrayList(); listIdMatHang = new ArrayList(); DataTable tblnhomhang = serviceGet.GetDepartments("1001"); for (int i = 0; i < tblnhomhang.Rows.Count; i++) { listNhomHang.Add(tblnhomhang.Rows[i][2].ToString()); listIdNhomHang.Add(tblnhomhang.Rows[i][24].ToString()); } DataTable tblMathang = getGui.GetInventoryByDept("0", listIdNhomHang[0].ToString(), "1001"); for (int i = 0; i < tblMathang.Rows.Count; i++) { listMatHang.Add(tblMathang.Rows[i][3].ToString()); listIdMatHang.Add(tblMathang.Rows[i][7].ToString()); } if (listNhomHang.Count % 7 == 0) { numOfPageNhom = listNhomHang.Count / 7; } else { numOfPageNhom = listNhomHang.Count / 7 + 1; } if (listMatHang.Count % 28 == 0) { numOfPageMatHang = listMatHang.Count / 28; } else { numOfPageMatHang = listMatHang.Count / 28 + 1; } pageIndexNhom = 1; selectIndexNhom = 1; pageIndexMatHang = 1; LoadNhomHang(); LoadMatHang(); }
public static void Run() { Course c1 = new Course(); Assignment a1 = new Assignment(); Trainer tr1 = new Trainer(); Student s1 = new Student(); StudentsPerCourse sPC = new StudentsPerCourse(); TrainersPerCourse tPC = new TrainersPerCourse(); AssignmentsPerCourse aPC = new AssignmentsPerCourse(); AssignmetsPerStudent aPS = new AssignmetsPerStudent(); AssignmentsPerCoursePerStudent aPCPS = new AssignmentsPerCoursePerStudent(); StudentsWithMoreThanOneCourse sMTOC = new StudentsWithMoreThanOneCourse(); ServiceGet serviseGet = new ServiceGet(); ServiceInsert serviseInsert = new ServiceInsert(); ServiceCheck serviceCheck = new ServiceCheck(); string userInput2 = "", userInput3 = "", userInput5 = ""; int selectCourse; do { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine("\tWellcome to Private School! What would you like to do?"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\t0. Exit."); Console.WriteLine("\t1. Course."); Console.WriteLine("\t2. Assignment."); Console.WriteLine("\t3. Trainer."); Console.WriteLine("\t4. Student."); Console.Write("\n\tPlease enter the appropriate number to select the field you are interested in : "); userInput2 = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n\t=================================================================================\n"); Console.ForegroundColor = ConsoleColor.White; //UserInput2 = 1, normal mode, Course-------------------------------------------------------------------------------------------------------------------- if (userInput2 == "1") { do { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine("\tYou are in the course mode! What would you like to do?"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\t0. Exit."); Console.WriteLine("\t1. New course."); Console.WriteLine("\t2. Output list with all courses."); Console.WriteLine("\t3. Add students at courses."); Console.WriteLine("\t4. Output students per course."); Console.WriteLine("\t5. Add trainers at courses."); Console.WriteLine("\t6. Output trainers per course."); Console.WriteLine("\t7. Add assignments at courses."); Console.WriteLine("\t8. Output assignments per course."); Console.WriteLine("\t9. Go back."); Console.Write("\n\tPlease enter the appropriate number to select the field you are interested in : "); userInput3 = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n\t=================================================================================\n"); Console.ForegroundColor = ConsoleColor.White; //UserInput3 = 1, normal mode, New course------------------------------------------------------------------------------------------------------- if (userInput3 == "1") { serviseInsert.InsertCourse(); } //UserInput3 = 2, normal mode, List of courses------------------------------------------------------------------------------------------------------- else if (userInput3 == "2") { c1.ListOfCoursecOutput(serviseGet.GetAllCourses()); MyStaticClass.PressKeyToContinue(); } //UserInput3 = 3, normal mode, Add students at courses------------------------------------------------------------------------------------------------------- else if (userInput3 == "3") { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine("\tSelect the number of course that you want to add students."); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; List <Course> allCourses = serviseGet.GetAllCourses(); c1.ListOfCoursecOutput(allCourses); Console.WriteLine(); do { Console.Write("\tEnter the apropriate number : "); selectCourse = MyStaticClass.InputTryToConvertToInt(); } while (selectCourse <= 0 || selectCourse > allCourses.Count); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n\t=================================================================================\n"); Console.ForegroundColor = ConsoleColor.White; do { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\tSelect how you want to add a student."); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(); Console.WriteLine("\t1. Add a new student."); Console.WriteLine("\t2. Add an excisting student."); Console.WriteLine("\t9. Go back."); Console.Write("\n\tPlease enter the appropriate number to select the field you are interested in : "); userInput5 = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n\t=================================================================================\n"); Console.ForegroundColor = ConsoleColor.White; if (userInput5 == "1") { serviseInsert.InsertStudent(); List <Student> students = serviseGet.GetAllStudents(); serviseInsert.InsertStudentAtCourse((int)students[students.Count - 1].Sid, (int)allCourses[selectCourse - 1].Cid); } else if (userInput5 == "2") { string addAnotherStudentfromList; bool notSuccededAdd = true; do { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine("\tSelect the number of student."); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; List <Student> allStudents = serviseGet.GetAllStudents(); s1.ListOfStudentsOutput(allStudents); do { int userSelectStudent = 0; try { Console.WriteLine(); Console.Write("\tEnter a propriate number : "); userSelectStudent = Convert.ToInt32(Console.ReadLine()); if (userSelectStudent >= 0 && userSelectStudent <= allStudents.Count) { if (serviceCheck.ExistStudentsPerCourse((int)allStudents[userSelectStudent - 1].Sid, (int)allCourses[selectCourse - 1].Cid)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(); Console.WriteLine("\tThe student already exist in the course."); Console.ForegroundColor = ConsoleColor.White; notSuccededAdd = true; } else { serviseInsert.InsertStudentAtCourse((int)allStudents[userSelectStudent - 1].Sid, (int)allCourses[selectCourse - 1].Cid); notSuccededAdd = false; } } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\tPlease select a propriate number."); Console.ForegroundColor = ConsoleColor.White; notSuccededAdd = true; } } catch (Exception) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\tPlease select a propriate number."); Console.ForegroundColor = ConsoleColor.White; notSuccededAdd = true; } } while (notSuccededAdd); //Ask to add another student from the list in course do { Console.WriteLine(); Console.Write("\tWould you like to add another student from the list in course? Y/N : "); addAnotherStudentfromList = Console.ReadLine(); Console.WriteLine(); } while (addAnotherStudentfromList.ToUpper() != "Y" && addAnotherStudentfromList.ToUpper() != "N"); } while (addAnotherStudentfromList.ToUpper() != "N"); } } while ((userInput5 != "1" && userInput5 != "2") && userInput5 != "9"); } //UserInput3 = 4, normal mode, Output students per course------------------------------------------------------------------------------------------------------- else if (userInput3 == "4") { sPC.ListOfStudentsPerCourseOutput(serviseGet.GetStudentsPerCourse()); MyStaticClass.PressKeyToContinue(); } //UserInput3 = 5, normal mode, Add trainers at courses------------------------------------------------------------------------------------------------------- else if (userInput3 == "5") { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine("\tSelect the number of course that you want to add trainers."); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; List <Course> allCourses = serviseGet.GetAllCourses(); c1.ListOfCoursecOutput(allCourses); Console.WriteLine(); do { Console.Write("\tEnter the apropriate number : "); selectCourse = MyStaticClass.InputTryToConvertToInt(); } while (selectCourse <= 0 || selectCourse > allCourses.Count); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n\t=================================================================================\n"); Console.ForegroundColor = ConsoleColor.White; do { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\tSelect how you want to add a trainer."); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(); Console.WriteLine("\t1. Add a new trainer."); Console.WriteLine("\t2. Add an excisting trainer."); Console.WriteLine("\t9. Go back."); Console.Write("\n\tPlease enter the appropriate number to select the field you are interested in : "); userInput5 = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n\t=================================================================================\n"); Console.ForegroundColor = ConsoleColor.White; } while ((userInput5 != "1" && userInput5 != "2") && userInput5 != "9"); if (userInput5 == "1") { serviseInsert.InsertTrainer(); List <Trainer> trainers = serviseGet.GetAllTrainers(); serviseInsert.InsertTrainerAtCourse((int)trainers[trainers.Count - 1].Tid, (int)allCourses[selectCourse - 1].Cid); } else if (userInput5 == "2") { string addAnotherTrainerfromList; bool notSuccededAdd = true; do { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine("\tSelect the number of trainer."); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; List <Trainer> allTrainers = serviseGet.GetAllTrainers(); tr1.ListOfTrainersOutput(allTrainers); do { int selectTrainer = 0; try { Console.WriteLine(); Console.Write("\tEnter a propriate number : "); selectTrainer = Convert.ToInt32(Console.ReadLine()); if (selectTrainer >= 0 && selectTrainer <= allTrainers.Count) { if (serviceCheck.ExistTrainerPerCourse((int)allTrainers[selectTrainer - 1].Tid, (int)allCourses[selectCourse - 1].Cid)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(); Console.WriteLine("\tThe trainer already exist in the course."); Console.ForegroundColor = ConsoleColor.White; notSuccededAdd = true; } else { serviseInsert.InsertTrainerAtCourse((int)allTrainers[selectTrainer - 1].Tid, (int)allCourses[selectCourse - 1].Cid); notSuccededAdd = false; } } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\tPlease select a propriate number."); Console.ForegroundColor = ConsoleColor.White; notSuccededAdd = true; } } catch (Exception) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\tPlease select a propriate number."); Console.ForegroundColor = ConsoleColor.White; notSuccededAdd = true; } } while (notSuccededAdd); //Ask to add another student from the list in course do { Console.WriteLine(); Console.Write("\tWould you like to add another student from the list in course? Y/N : "); addAnotherTrainerfromList = Console.ReadLine(); Console.WriteLine(); } while (addAnotherTrainerfromList.ToUpper() != "Y" && addAnotherTrainerfromList.ToUpper() != "N"); } while (addAnotherTrainerfromList.ToUpper() != "N"); } } //UserInput3 = 6, normal mode, Output trainers per course------------------------------------------------------------------------------------------------------- else if (userInput3 == "6") { tPC.ListOfTrainersPerCourseOutput(serviseGet.GetTrainersPerCourse()); MyStaticClass.PressKeyToContinue(); } //UserInput3 = 7, normal mode, Add assignments at courses------------------------------------------------------------------------------------------------------- else if (userInput3 == "7") { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine("\tSelect the number of course that you want to add assignments."); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; List <Course> allCourses = serviseGet.GetAllCourses(); c1.ListOfCoursecOutput(allCourses); Console.WriteLine(); do { Console.Write("\tEnter the apropriate number : "); selectCourse = MyStaticClass.InputTryToConvertToInt(); } while (selectCourse <= 0 || selectCourse > allCourses.Count); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n\t=================================================================================\n"); Console.ForegroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\tSelect how you want to add an assignment."); Console.ForegroundColor = ConsoleColor.White; do { Console.WriteLine(); Console.WriteLine("\t1. Add a new assignment."); Console.WriteLine("\t2. Add an excisting assignment."); Console.WriteLine("\t9. Go back."); Console.Write("\n\tPlease enter the appropriate number to select the field you are interested in : "); userInput5 = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n\t=================================================================================\n"); Console.ForegroundColor = ConsoleColor.White; } while ((userInput5 != "1" && userInput5 != "2") && userInput5 != "9"); if (userInput5 == "1") { serviseInsert.InsertNewAssignmentAtCourse((int)allCourses[selectCourse - 1].Cid); } else if (userInput5 == "2") { string addAnotherAssignmentfromList; bool notSuccededAdd = true; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine("\tSelect the number of the assignment."); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; List <Assignment> allAssignments = serviseGet.GetAllAssignments(); a1.ListOfAssignmentsOutput(allAssignments); do { int selectAssignment = 0; try { Console.WriteLine(); Console.Write("\tEnter a propriate number : "); selectAssignment = Convert.ToInt32(Console.ReadLine()); if (selectAssignment >= 0 && selectAssignment <= allAssignments.Count) { serviseInsert.InsertAssignmentAtCourse((int)allAssignments[selectAssignment - 1].Aid, (int)allCourses[selectCourse - 1].Cid); notSuccededAdd = false; } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\tPlease select a propriate number."); Console.ForegroundColor = ConsoleColor.White; notSuccededAdd = true; } } catch (Exception) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\tPlease select a propriate number."); Console.ForegroundColor = ConsoleColor.White; notSuccededAdd = true; } } while (notSuccededAdd); } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n\t=================================================================================\n"); Console.ForegroundColor = ConsoleColor.White; } //UserInput3 = 8, normal mode, Output assignments per course------------------------------------------------------------------------------------------------------- else if (userInput3 == "8") { aPC.OutputAssignmetsPerCourse(serviseGet.GetAssignmetsPerCourse()); MyStaticClass.PressKeyToContinue(); } } while (userInput3 != "0" && userInput3 != "9"); } //UserInput2 = 2, normal mode, Assignment-------------------------------------------------------------------------------------------------------------------- else if (userInput2 == "2") { do { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine("\tYou are in the assignment mode! What would you like to do?"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\t0. Exit."); Console.WriteLine("\t1. New assignment."); Console.WriteLine("\t2. Output list with all assignments."); Console.WriteLine("\t3. Output list with assignments per course per student."); Console.WriteLine("\t9. Go back."); Console.Write("\n\tPlease enter the appropriate number to select the field you are interested in : "); userInput3 = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n\t=================================================================================\n"); Console.ForegroundColor = ConsoleColor.White; //UserInput3 = 1, normal mode, New Assignment------------------------------------------------------------------------------------------------------- if (userInput3 == "1") { serviseInsert.InsertAssignment(); } //UserInput3 = 2, normal mode, List of assignments------------------------------------------------------------------------------------------------------- else if (userInput3 == "2") { a1.ListOfAssignmentsWithoutMarkOutput(serviseGet.GetAllAssignments()); MyStaticClass.PressKeyToContinue(); } else if (userInput3 == "3") { aPCPS.ListOfAssignmentsPerCoursePerStudentOutput(serviseGet.GetAssignmentsPerCoursePerStudents()); MyStaticClass.PressKeyToContinue(); } } while ((userInput3 != "0" && userInput3 != "9") && (userInput3 != "1" && (userInput3 != "2" && userInput3 != "3"))); } //UserInput2 = 3, normal mode, Trainer-------------------------------------------------------------------------------------------------------------------- else if (userInput2 == "3") { do { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine("\tYou are in the trainer mode! What would you like to do?"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\t0. Exit."); Console.WriteLine("\t1. New trainer."); Console.WriteLine("\t2. Output list with all trainers."); Console.WriteLine("\t9. Go back."); Console.Write("\n\tPlease enter the appropriate number to select the field you are interested in : "); userInput3 = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n\t=================================================================================\n"); Console.ForegroundColor = ConsoleColor.White; //UserInput3 = 1, normal mode, New trainer------------------------------------------------------------------------------------------------------- if (userInput3 == "1") { serviseInsert.InsertTrainer(); } //UserInput3 = 2, normal mode, List of trainers------------------------------------------------------------------------------------------------------- else if (userInput3 == "2") { tr1.ListOfTrainersOutput(serviseGet.GetAllTrainers()); MyStaticClass.PressKeyToContinue(); } } while ((userInput3 != "0" && userInput3 != "9") && (userInput3 != "1" && userInput3 != "2")); } //UserInput2 = 4, normal mode, Student-------------------------------------------------------------------------------------------------------------------- else if (userInput2 == "4") { do { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine("\tYou are in the student mode! What would you like to do?"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\t0. Exit."); Console.WriteLine("\t1. New student."); Console.WriteLine("\t2. Output list with all students."); Console.WriteLine("\t3. Output list witn students who belongs to more than one course."); Console.WriteLine("\t9. Go back."); Console.Write("\n\tPlease enter the appropriate number to select the field you are interested in : "); userInput3 = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n\t=================================================================================\n"); Console.ForegroundColor = ConsoleColor.White; //UserInput3 = 1, normal mode, New Student------------------------------------------------------------------------------------------------------- if (userInput3 == "1") { serviseInsert.InsertStudent(); } //UserInput3 = 2, normal mode, List of students------------------------------------------------------------------------------------------------------- else if (userInput3 == "2") { s1.ListOfStudentsOutput(serviseGet.GetAllStudents()); MyStaticClass.PressKeyToContinue(); } //UserInput3 = 3, normal mode, List of students who belongs to more than one course------------------------------------------------------------------------------------------------------ - else if (userInput3 == "3") { sMTOC.ListOfStudentsOutput(serviseGet.GetStudentsWithMoreThanOneCourses()); MyStaticClass.PressKeyToContinue(); } } while ((userInput3 != "0" && userInput3 != "9") && (userInput3 != "1" && userInput3 != "2") && (userInput3 != "3")); } } while ((userInput2 != "0" && userInput2 != "9") && userInput3 != "0"); Console.WriteLine("\n\tTHANK YOU!!!"); Console.ReadKey(); }
public CrudController() { App = ServiceGet.GetProvider()?.GetService <ICrudApplication <T, GetT, CreateT> >(); }
public void FrmLogin_Load(object sender, EventArgs e) { //OleDbConnection m_cnADONetConnection = new OleDbConnection(); //OleDbDataAdapter m_daDataAdapter; //OleDbCommandBuilder m_cbCommandBuilder; //DataTable m_dtDict = new DataTable(); //m_cnADONetConnection.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Windows.Forms.Application.StartupPath + @"\ConfigDatabase.mdb"; //m_cnADONetConnection.Open(); //m_daDataAdapter = new OleDbDataAdapter("Select * From DatabaseInfo", m_cnADONetConnection); //m_cbCommandBuilder = new OleDbCommandBuilder(m_daDataAdapter); //m_daDataAdapter.Fill(m_dtDict); //if (m_dtDict.Rows.Count != 0) //{ // StaticClass.mode = m_dtDict.Rows[0]["Mode"].ToString(); // if (m_dtDict.Rows[0]["InstanceName"].ToString() == "" ) // { // StaticClass.serverName = m_dtDict.Rows[0]["ServerName"].ToString(); // } // else // { // StaticClass.serverName = m_dtDict.Rows[0]["ServerName"].ToString() + "\\" + m_dtDict.Rows[0]["InstanceName"].ToString(); // } // StaticClass.databaseName = m_dtDict.Rows[0]["DatabaseName"].ToString(); // Services.get_GUI.serverName = StaticClass.serverName; // Services.get_GUI.databaseName = StaticClass.databaseName; //} serviceGet = new ServiceGet(); getGui = new get_GUI(); button45.changeColor(Color.White, Color.Red); button46.changeColor(Color.White, Color.FromArgb(0, 150, 0)); button9.changeColor(Color.White, Color.Red); button7.changeColor(Color.White, Color.FromArgb(0, 150, 0)); button13.changeColor(Color.White, Color.Gray); button24.changeColor(Color.White, Color.Yellow); button25.changeColor(Color.White, Color.Yellow); button26.changeColor(Color.White, Color.Yellow); button27.changeColor(Color.White, Color.Yellow); button28.changeColor(Color.White, Color.Yellow); button29.changeColor(Color.White, Color.Yellow); button30.changeColor(Color.White, Color.Yellow); button31.changeColor(Color.White, Color.Yellow); button32.changeColor(Color.White, Color.Yellow); button33.changeColor(Color.White, Color.Yellow); button34.changeColor(Color.White, Color.Yellow); button35.changeColor(Color.White, Color.Yellow); button36.changeColor(Color.White, Color.Yellow); button37.changeColor(Color.White, Color.Yellow); button38.changeColor(Color.White, Color.Yellow); button39.changeColor(Color.White, Color.Yellow); button40.changeColor(Color.White, Color.Yellow); button41.changeColor(Color.White, Color.Yellow); button42.changeColor(Color.White, Color.Yellow); button43.changeColor(Color.White, Color.Yellow); button44.changeColor(Color.White, Color.Yellow); button48.changeColor(Color.White, Color.Yellow); button49.changeColor(Color.White, Color.Yellow); button50.changeColor(Color.White, Color.Yellow); button51.changeColor(Color.White, Color.Yellow); button52.changeColor(Color.White, Color.Yellow); button53.changeColor(Color.White, Color.Orange); button54.changeColor(Color.White, Color.Yellow); button55.changeColor(Color.White, Color.OrangeRed); panel2.Visible = false; panel1.Visible = true; textBox1.Clear(); textBox2.Clear(); bool focus = textBox1.Focus(); bool f = textBox1.Focused; this.Refresh(); DataTable setup = getGui.GetSetupByStore(StaticClass.storeId); string path = setup.Rows[0]["Company_Info_5"].ToString(); FileInfo fi = new FileInfo(path); if (path != "" && fi.Exists) { pictureBox1.Image = Image.FromFile(path); } label3.Text = setup.Rows[0]["Invoice_Notes_10"].ToString(); }
public FrmLogin() { InitializeComponent(); serviceGet = new ServiceGet(); }