protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { if (Session["loggedUser"] != null) { int doctorid = Convert.ToInt32(Request.QueryString["id"]); int deleted = new BusinessClass().DeleteDoctor(doctorid); if (deleted == -1) { Response.Redirect("ViewDoctors.aspx?errorMessage=Some error occured. Please try again.", false); } else { Response.Redirect("ViewDoctors.aspx?successMessage=Record Deleted.", false); } } else { Response.Redirect("Login.aspx?errorMessage=You have to login first.", false); } } } catch (Exception ex) { new LogAndErrorsClass().CatchException(ex); Response.Redirect("/ErrorPage.aspx"); } }
static void Main(string[] args) { var firstClass = new FirstClass(10); var busClass = new BusinessClass(20); var economClass = new EconomClass(150); firstClass.Fill(); busClass.Fill(); economClass.Fill(); var pilots = new List<Pilot> { new Pilot(), new Pilot() }; var stuards = new List<Stuard> { new Stuard(), new Stuard(), new Stuard(), new Stuard(), new Stuard(), new Stuard() }; var plane = new Plane.Plane(pilots, stuards); plane.AddUnit(firstClass); plane.AddUnit(busClass); plane.AddUnit(economClass); plane.GetBaggageStatus(); Console.ReadLine(); }
public BizFacade(BusinessClass businessClass) { switch (businessClass) { case BusinessClass.BizManagement: bizManagement = new BizManagement(); break; case BusinessClass.BizBusinessPartner: bizBusinessPartner = new BizBusinessPartner(); break; case BusinessClass.BizSalesOrder: bizSalesOrder = new BizSaleOrder(); break; case BusinessClass.BizQuotation: bizQuotation = new BizQuotation(); break; case BusinessClass.BizInventory: bizInventory = new BizInventory(); break; case BusinessClass.BizFinance: bizFinance = new BizFinance(); break; case BusinessClass.BizCommon: bizCommon = new BizCommon(); break; default: break; } }
private void ConfimAddAirplane_Click(object sender, RoutedEventArgs e) { if (AddAirplaneID.Text != "" && AddAirplaneName.Text != "" && EconomClass.Text != "" && BusinessClass.Text != "" && FirstClass.Text != "") { try { string connectionString = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=testdb;Integrated Security=True"; string query = $"INSERT INTO Airplane (Id,Model,Econom,Business,First) VALUES ('{AddAirplaneID.Text}', '{AddAirplaneName.Text}', '{EconomClass.Text}', '{BusinessClass.Text}', '{FirstClass.Text}');"; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(query, connection); command.ExecuteNonQuery(); connection.Close(); } AddAirplaneID.Clear(); AddAirplaneName.Clear(); EconomClass.Clear(); BusinessClass.Clear(); FirstClass.Clear(); } catch (Exception ee) { MessageBox.Show(ee.Message); } } else { MessageBox.Show("Something wrong"); } }
private void Savebutton5_Click(object sender, EventArgs e) { if (isvalid()) { try { ModelClass obj = new ModelClass() { namep = nametextBox4.Text, purchasep = purchasetextBox1.Text, salep = saletextBox2.Text, availablep = availableQtytextBox3.Text, datap = dateTimePicker1.Value.ToString() }; BusinessClass.businessMethod(obj, "i"); MessageBox.Show("Enter Data Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); dataGridView1.DataSource = ShowData(); ClearRfocusKlyeMethod(); } catch (ApplicationException ex) { MessageBox.Show("Error in Code", ex.Message); } } }
public ActionResult CheckUser(string email, string pass) { inanSoftDBEntities1 db = new inanSoftDBEntities1(); var userModel = db.UserTable.Where(x => x.Email == email && x.Password == pass).FirstOrDefault(); // şuanki kullanıcı atanır if (userModel == null) { return(View("Index")); } else { Session["UserModel"] = userModel; writeLogFile(userModel); BusinessClass business = new BusinessClass(); try { business.checkMondayAndSendReportWithMail(); }catch (Exception ex) { } return(RedirectToAction("Index", "Admin")); } }
public static void SendDataFromStudentTextBox(Control parent, string filePath) { int i = 0; foreach (Control c in parent.Controls) { if (c.GetType() == typeof(TextBox)) { i++; } } string[] mass = new string[i + 1]; foreach (Control c in parent.Controls) { if (c.GetType() == typeof(TextBox)) { TextBox textBox = new TextBox(); textBox = (TextBox)c; mass[textBox.TabIndex - 1] = textBox.Text; } } mass[mass.Length - 1] = filePath; //foreach (var item in mass) MessageBox.Show(Convert.ToString(item)); //BusinessClass.DataInForStudent(textBoxGroupe.Text, textBoxRoom.Text, textBoxName1.Text, textBoxName2.Text, textBoxName3.Text, textBoxTicet.Text, textBoxFormStudy.Text, textBoxCB.Text, textBoxDescription.Text, FilePath); BusinessClass.DataInForStudent(mass); }
private DataTable FillGridChild() { DataTable DtListResult = null; try { DataSet ds = null; objBusinessClass = new BusinessLayer.BusinessClass(); if (ViewState["SanitizationResultId"] != null && ViewState["SanitizationStartDate"] != null && ViewState["SanitizationEndDate"] != null) { long SanitizationResultId = (long)ViewState["SanitizationResultId"]; DateTime FromDate = (DateTime)ViewState["SanitizationStartDate"]; DateTime ToDate = (DateTime)ViewState["SanitizationEndDate"]; ds = objBusinessClass.GetSanitizationSGP125TDataBySanitizationResultIdnSanitizationStartDatenSanitizationEndDateDs(SanitizationResultId, FromDate, ToDate); if (ds != null) { if (ds.Tables.Count > 0) { DtListResult = ds.Tables[0]; } } } } catch (Exception ex) { Exception exx = ex; } return(DtListResult); }
private void WriteUserActivity(string strActivity, string strLogStatus = "") { if (Session["UserName"] != null && Session["UserNameId"] != null && Session["UserTypeId"] != null && Session["UserType"] != null && Session["IPAddress"] != null && Session["hostName"] != null) { ML_UserLog objML_UserLog = new ML_UserLog(); objBusinessClass = new BusinessLayer.BusinessClass(); try { objML_UserLog.UserLog = ML_Common.string2string(Session["UserName"]); objML_UserLog.UserName = ML_Common.string2string(Session["UserName"]); objML_UserLog.UserNameId = ML_Common.string2Long(Session["UserNameId"]); objML_UserLog.Email = string.Empty; objML_UserLog.UserTypeId = ML_Common.string2Long(Session["UserTypeId"]); objML_UserLog.UserType = ML_Common.string2string(Session["UserType"]); objML_UserLog.LogStatus = strLogStatus; objML_UserLog.IPAddress = ML_Common.string2string(Session["IPAddress"]); objML_UserLog.MachineHostName = ML_Common.string2string(Session["hostName"]); objML_UserLog.UserActivity = strActivity; objML_UserLog.Remarks = string.Empty; objBusinessClass.AddUserLog(objML_UserLog); } catch { } } else { Response.Redirect("Login.aspx", false); } }
private void FillObjectToForm(long lngId, bool IsEditFlag = true) { objBusinessClass = new BusinessLayer.BusinessClass(); try { if (ViewState["ReportType"] != null && ViewState["grdSanitizationReportId"] != null) { string ReportType = ML_Common.string2string(ViewState["ReportType"].ToString()); lngId = ML_Common.string2Long(ViewState["grdSanitizationReportId"].ToString()); // string ReportType = ML_Common.GetDropDownValue(ddlReportTypeSearch, true); ML_SanitizationReport objML_SanitizationReport = objBusinessClass.GetSCSanitizationResultByReportTypeandId(lngId, ReportType); if (objML_SanitizationReport != null) { //ViewState["SanitizationResultId"] = objML_SanitizationReport.SanitizationResultId; //ViewState["SanitizationStartDate"] = objML_SanitizationReport.SanitizationStartDate; //ViewState["SanitizationEndDate"] = objML_SanitizationReport.SanitizationEndDate; //FillGridForData(); ShowReport(objML_SanitizationReport.Id, objML_SanitizationReport.ReportType); } //UpdatePanelGridResult.Update(); } } catch (Exception ex) { Exception exc = ex; } }
private void UpdateData(BusinessClass.For @for) { dataGridView1.DataSource = BusinessClass.DataOutPut(@for); PresentationLayerClass.AddItemsToComboBox(comboBox1, BusinessClass.For.Groupe); PresentationLayerClass.AddItemsToComboBox(comboBox2, BusinessClass.For.Hostel); PresentationLayerClass.AddItemsToComboBox(comboBox3, BusinessClass.For.Room); }
private void ConfimAddAirplane_Click(object sender, RoutedEventArgs e) { if (AddAirplaneID.Text != "" && AddAirplaneName.Text != "" && EconomClass.Text != "" && BusinessClass.Text != "" && FirstClass.Text != "") { try { string connectionString = ConfigurationManager.ConnectionStrings["MainConnection"].ConnectionString; string query = $"INSERT INTO Airplane (Id,Model,Econom,Business,First) " + $"VALUES ('{AddAirplaneID.Text}', '{AddAirplaneName.Text}', '{EconomClass.Text}', '{BusinessClass.Text}', '{FirstClass.Text}');"; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(query, connection); command.ExecuteNonQuery(); connection.Close(); } AddAirplaneID.Clear(); AddAirplaneName.Clear(); EconomClass.Clear(); BusinessClass.Clear(); FirstClass.Clear(); } catch (Exception ee) { MessageBox.Show(ee.Message); } } else { MessageBox.Show("Something wrong"); } }
public static void SendDataFromStudentTextBox(Control parent, string filePath, int RowIndex) { int i = 0; foreach (Control c in parent.Controls) { if (c.GetType() == typeof(TextBox)) { i++; } } string[] mass = new string[i + 1]; foreach (Control c in parent.Controls) { if (c.GetType() == typeof(TextBox)) { TextBox textBox = new TextBox(); textBox = (TextBox)c; mass[textBox.TabIndex - 1] = textBox.Text; } } mass[mass.Length - 1] = filePath; BusinessClass.DataInForStudent(mass, RowIndex); }
protected void btnAddHospital_Click(object sender, EventArgs e) { try { String otp = txtOtp.Text.Trim(); if (Session["otp"] != null) { if (otp.Equals(Session["otp"].ToString())) { int activated = new BusinessClass().ActivateUser((User)Session["inactiveUser"]); if (activated != -1) { Response.Redirect("../Login.aspx?successMessage=Account Activated. Please login to continue.", false); } else { Response.Redirect("ConfirmRegistration.aspx?errorMessage=Some error occured. Please try again.", false); } } else { Response.Redirect("ConfirmRegistration.aspx?errorMessage=Invalid OTP. Please try again.", false); } } else { Response.Redirect("../Register.aspx?errorMessage=Seesion expired. Please try again.", false); } } catch (Exception ex) { new LogAndErrorsClass().CatchException(ex); Response.Redirect("/ErrorPage.aspx", false); } }
private void BindDataGrid(String sortExpression = null) { try { BusinessClass businessClass = new BusinessClass(); DataTable dt = businessClass.GetDoctors(0); if (sortExpression != null) { if (ViewState["SortDirection"].ToString() == "ASC") { ViewState["SortDirection"] = "DESC"; } else { ViewState["SortDirection"] = "ASC"; } DataView dvData = new DataView(dt); dvData.Sort = sortExpression + " " + ViewState["SortDirection"]; gvDoctors.DataSource = dvData; } else { gvDoctors.DataSource = dt; } gvDoctors.DataBind(); } catch (Exception ex) { new LogAndErrorsClass().CatchException(ex); Response.Redirect("/ErrorPage.aspx", false); } }
protected void grdItemMaster_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("ADD")) { DropDownList ddlNewCanteenName = (DropDownList)grdItemMaster.FooterRow.FindControl("ddlNewCanteenName"); DropDownList ddlNewCategoryGroupCode = (DropDownList)grdItemMaster.FooterRow.FindControl("ddlNewCategoryGroupCode"); DropDownList ddlNewCategoryItemCode = (DropDownList)grdItemMaster.FooterRow.FindControl("ddlNewCategoryItemCode"); TextBox txtNewItemName = (TextBox)grdItemMaster.FooterRow.FindControl("txtNewItemName"); TextBox txtNewItemEmployeeRate = (TextBox)grdItemMaster.FooterRow.FindControl("txtNewItemEmployeeRate"); CheckBox ChStatusNew = (CheckBox)grdItemMaster.FooterRow.FindControl("ChStatusNew"); if (IsValid) { //errNumber = -1; try { objBusinessClass = new BusinessLayer.BusinessClass(); objML_ItemMaster = new ML_ItemMaster(); objML_ItemMaster.CanteenCode = Convert.ToInt32(ML_Common.clean(ddlNewCanteenName.SelectedValue)); objML_ItemMaster.CategoryGroupCode = Convert.ToInt32(ML_Common.clean(ddlNewCategoryGroupCode.SelectedValue)); objML_ItemMaster.ItemCategoryCode = Convert.ToInt32(ML_Common.clean(ddlNewCategoryItemCode.SelectedValue)); objML_ItemMaster.ItemName = ML_Common.clean(txtNewItemName.Text); objML_ItemMaster.ItemEmployeeRate = Convert.ToDecimal(ML_Common.clean(txtNewItemEmployeeRate.Text)); if (ChStatusNew.Checked) { objML_ItemMaster.ItemActive = 1; } else { objML_ItemMaster.ItemActive = 0; } int obhReturn = objBusinessClass.AddItemMaster(objML_ItemMaster); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Saved Successfully"; FillGrid(); } else if (obhReturn == 2) { lblMsg.Text = "Record Already Exists!"; lblMsg.Visible = true; } } catch (SqlException sqlExc) { // LogManager.LogManager.WriteErrorLog(sqlExc); SqlException sqlEt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); } } } }
protected void Login_button_Click(object sender, EventArgs e) { try { string UserName = UserName_TextBox.Text; string Pass = Pass_TextBox.Text; int Status = BusinessClass.LoginValidationB(UserName, Pass); if (Status == 1) { Session["User_Name"] = UserName_TextBox.Text.ToString(); Response.Redirect("Home.aspx"); } else { Alert_Label.ForeColor = System.Drawing.Color.Red; Alert_Label.Text = "Username Or Password Invalid"; } } catch (Exception Excptn_Login) { string filePath = @"H:\Xpert's Zone\Mission Airways\ErrorLog.txt"; using (StreamWriter writer = new StreamWriter(filePath, true)) { writer.WriteLine("Message :" + Excptn_Login.Message + "<br/>" + Environment.NewLine + Environment.NewLine + "StackTrace :" + Excptn_Login.StackTrace + "" + Environment.NewLine + "Date :" + Environment.NewLine + DateTime.Now.ToString() + "Source :" + Excptn_Login.Source + "<br/>" + Environment.NewLine); writer.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine); } Exception_Label.Text = "Please Enter The Data In Correct Format"; } }
private void BindFilteredDataGrid(String sortExpression = null) { try { BusinessClass businessClass = new BusinessClass(); DataTable dt = businessClass.GetFilteredFilesV2(((User)Session["loggedUser"]).UserId, fromDateTime, toDateTime); if (sortExpression != null) { if (ViewState["SortDirection"].ToString() == "ASC") { ViewState["SortDirection"] = "DESC"; } else { ViewState["SortDirection"] = "ASC"; } DataView dvData = new DataView(dt); dvData.Sort = sortExpression + " " + ViewState["SortDirection"]; gvFiles.DataSource = dvData; } else { gvFiles.DataSource = dt; } gvFiles.DataBind(); } catch (Exception ex) { new LogAndErrorsClass().CatchException(ex); Response.Redirect("/ErrorPage.aspx", false); } }
public void FunctionTest() { var businessClass = new BusinessClass(); var result = businessClass.StripWWWAndCom("www.test.com"); Assert.AreEqual("test", result); }
private void ReloadData() { BusinessClass bc = new BusinessClass(); DataGrid1.DataSource = bc.GetData(); DataGrid1.DataBind(); }
private DataTable BindGridViewBySearch(ML_SanitizationReport objML_SanitizationReport) { DataTable dtSanitizationSGP125TData = new DataTable("GridSearch"); try { DataSet ds = null; objBusinessClass = new BusinessLayer.BusinessClass(); if (objML_SanitizationReport.ReportType == "") { } ds = objBusinessClass.GetSCSanitizationReportBySeacrh(objML_SanitizationReport); if (ds.Tables.Count > 0) { dtSanitizationSGP125TData = ds.Tables[0]; } } catch (Exception ex) { Exception exc = ex; } return(dtSanitizationSGP125TData); }
protected void btnRegister_Click(object sender, EventArgs e) { try { User user = new User(); user.FirstName = txtFirstName.Text.Trim(); user.LastName = txtLastName.Text.Trim(); user.Email = txtEmail.Text.Trim(); user.Password = txtPassword.Text.Trim(); ConfirmRegistration cr = new BusinessClass().CreateUser(user); Session["otp"] = cr.Otp; Session["inactiveUser"] = user; if (cr.Added != -1) { Response.Redirect("Profile/ConfirmRegistration.aspx", false); } else { Response.Redirect("ConfirmRegistration.aspx?errorMessage=Some Error occured. Please try again.", false); } } catch (Exception ex) { new LogAndErrorsClass().CatchException(ex); Response.Redirect("/ErrorPage.aspx", false); } }
protected void Page_Load(object sender, EventArgs e) { try { Document document = new Document(); document.UserId = ((User)Session["loggedUser"]).UserId; document.HospitalId = Convert.ToInt32(Request.QueryString["hospital"].Trim()); document.DoctorId = Convert.ToInt32(Request.QueryString["doctor"].Trim()); document.DocumentType = Convert.ToInt32(Request.QueryString["recordType"].Trim()); document.IssueDate = Request.QueryString["issueDate"].Trim(); String path = Server.MapPath(@"~/files/uploads/"); String folder = path + document.UserId.ToString() + @"\"; List <String> ext = new List <string>() { ".png", ".jpg", ".doc", ".docx", ".pdf" }; List <String> allFiles = new List <string>(); String[] filenames = Request.QueryString["issueDate"].Trim().Split(';'); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } Boolean fileStatus = true; foreach (String filename in filenames) { String extension = Path.GetExtension(filename); if (ext.IndexOf(extension) < 0) { fileStatus = false; } else { //new File("").SaveAs(folder + file.FileName); allFiles.Add(@"/files/uploads/" + document.UserId + @"/" + filename); } } if (!fileStatus) { Response.Redirect("AddNewDocument.aspx?errorMessage=Please choose any '.doc', '.docx', '.pdf', '.jpg', '.png' only.", false); } document = new BusinessClass().SaveDocument(document, allFiles); if (document.status != -1) { Response.Redirect("ViewDocuments.aspx?successMessage=New documents uploaded.", false); } else { Response.Redirect("AddNewDocument.aspx?errorMessage=Some error occured. Please try again.", false); } } catch (Exception ex) { new LogAndErrorsClass().CatchException(ex); Response.Redirect("/ErrorPage.aspx", false); } }
private void reloadData() { BusinessClass biz; biz = new BusinessClass(); DataGrid1.DataSource = biz.GetData(); DataGrid1.DataBind(); }
public void StoredProcedureTest() { UnitTestHelpers.ExecuteSQLCodeFromFile("SampleLinq2SqlUnitTesting.Tests.TestData.PopulateDepartmentTable.sql", "Linq2SqlDemoData"); var businessClass = new BusinessClass(); var result = businessClass.GetAllDepartments(); Assert.AreEqual(3, result.Count); }
private void UpdateUniversity_Load(object sender, EventArgs e) { BusinessClass obj = new BusinessClass(); DataTable dt = obj.GetUniversity(); comboBox1.DataSource = dt; comboBox1.DisplayMember = "Name"; comboBox1.ValueMember = "Name"; }
public void AllEmployeesTest() { UnitTestHelpers.ReadData("SampleLinq2SqlUnitTesting.Tests.TestData.DefaultData.xml"); var businessClass = new BusinessClass(); var allEmployeeNames = businessClass.GetAllEmployeeNames(); Assert.AreEqual(4, allEmployeeNames.Count); }
public void GetBaggageStatus() { foreach (var unit in GetUnits()) { if (unit is FirstClass) _firstClass = unit as FirstClass; if (unit is BusinessClass) _businessClass = unit as BusinessClass; if (unit is EconomClass) _economClass = unit as EconomClass; } if (_pilots == null || _pilots.Count != PilotsRequired || _stuards == null || _stuards.Count != StuardsRequired) { Console.WriteLine("Недостаточно персонала"); return; } if (_firstClass.GetUnits().Count == 0 || _businessClass.GetUnits().Count == 0 || _economClass.GetUnits().Count == 0) { Console.WriteLine("Самолет без пассажиров"); return; } Console.WriteLine("Карта загрузки самолета."); int economBaggage = _economClass.GetUnits().Sum(passenger => passenger.GetBaggage()); int businessBaggage = _businessClass.GetUnits().Sum(businessman => businessman.GetBaggage()); int firstClassBaggage = _firstClass.GetUnits().Sum(firstClassMan => firstClassMan.GetBaggage()); int summary = economBaggage + businessBaggage + firstClassBaggage; Console.WriteLine("Багаж первого класса : {0}", firstClassBaggage); Console.WriteLine("Багаж бизнес класса : {0}", businessBaggage); Console.WriteLine("Багаж эконом класса : {0}", economBaggage); Console.WriteLine("Суммарный вес багажа : {0}", summary); if(summary > MaxWeight) Console.WriteLine("Самолет перегружен"); if (summary - economBaggage > MaxWeight) { Console.WriteLine("Самолет перегружен без учета багажа эконом класса"); } else { int passIndex = 0; while (summary > MaxWeight) { summary -= _economClass.GetUnits()[passIndex].GetBaggage(); passIndex++; } Console.WriteLine("У {0} пассажиров эконом класса снят багаж. Текущий вес багажа {1}. Самолет готов к отправке", passIndex, summary); } }
private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { BusinessClass bc = new BusinessClass(); DataGrid1.DataSource = bc.GetData(); DataGrid1.DataBind(); } }
public void ExecuteDirectSqlStatement() { UnitTestHelpers.ExecuteSQLQuery("INSERT INTO Department (Name) values ('IT')", "Linq2SqlDemoData"); UnitTestHelpers.ExecuteSQLQuery("INSERT INTO Department (Name) values ('Accounting')", "Linq2SqlDemoData"); var businessClass = new BusinessClass(); var result = businessClass.GetAllDepartments(); Assert.AreEqual(2, result.Count); }
private void UniversityDetailsForm_Load(object sender, EventArgs e) { BusinessClass obj = new BusinessClass(); dataGridView1.DataSource = obj.viewUniversity(); dataGridView1.Columns[7].Visible = false; dataGridView1.Columns[8].Visible = false; dataGridView1.Columns[9].Visible = false; dataGridView1.Columns[10].Visible = false; dataGridView1.Columns[11].Visible = false; }
public TabStudents() { InitializeComponent(); BusinessClass.CreateIfEx(); UpdateData(TableName); PresentationLayerClass.NonSortableGrid(dataGridView1); PresentationLayerClass.OnlyReadSwitch(panel1, 3, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSelectGroupe, ButtonErace, ButtonEdit, ButtonSelectRoom, ButtonClear, ButtonOpen, ButtonSave }, false); }
public ActionResult <Employee> Get(int id) { //return "value"; Employee emp; emp = BusinessClass.GetById(connectionString, id); if (emp == null) { //throw new HttpResponseException(HttpStatusCode.NotFound); } return(emp); }