public static void AddCar(string CarName, int YearMade, string CarDescription, List <string> CarParts, bool IsCarActive = true) { AddProject(CarName, YearMade, CarDescription, IsCarActive); int ProjectID = -1; ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetData(); foreach (NuRacingDataSet.ProjectRow projectRow in projectTable.Rows) { if (projectRow.Project_Name == CarName && projectRow.Project_YearMade == YearMade && projectRow.Project_Description == CarDescription && projectRow.Project_Active == IsCarActive) { ProjectID = projectRow.Project_UID; break; } } if (ProjectID != -1) { foreach (string CarPart in CarParts) { WorkType.AddWorkType(ProjectID, CarPart); } } }
public static void AddCar(string CarName, int YearMade, string CarDescription, List<string> CarParts, bool IsCarActive = true) { AddProject(CarName, YearMade, CarDescription, IsCarActive); int ProjectID = -1; ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetData(); foreach (NuRacingDataSet.ProjectRow projectRow in projectTable.Rows) { if (projectRow.Project_Name == CarName && projectRow.Project_YearMade == YearMade && projectRow.Project_Description == CarDescription && projectRow.Project_Active == IsCarActive) { ProjectID = projectRow.Project_UID; break; } } if (ProjectID != -1) { foreach (string CarPart in CarParts) { WorkType.AddWorkType(ProjectID, CarPart); } } }
public static List <ProjectInfo> getUserProjects(string Username, bool OnlyActive) { if (!User.UsernameExists(Username)) { throw new ArgumentException("Username doesn't exist"); } ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetData(); List <ProjectInfo> result = new List <ProjectInfo>(); foreach (NuRacingDataSet.ProjectRow projectRow in projectTable.Rows) { if (!( (OnlyActive && (!projectRow.Project_Active)) || !(Project.userInvolvedIn(Username, projectRow.Project_UID)))) { result.Add(new ProjectInfo(projectRow)); } } return(result); }
public static ProjectInfo getProject(int ProjectID) { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetProject(ProjectID); if (projectTable.Rows.Count == 0) { throw new ArgumentException("Project doesn't exist"); } return(new ProjectInfo((NuRacingDataSet.ProjectRow)projectTable.Rows[0])); }
public static bool projectActive(int ProjectID) { if (!projectExists(ProjectID)) { throw new ArgumentException("Project doesn't exist"); } else { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetProject(ProjectID); return(((NuRacingDataSet.ProjectRow)projectTable.Rows[0]).Project_Active); } }
private void rptDeliveryNotes_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { PositionTableAdapter _tdPosition = new PositionTableAdapter(); _tdPosition.FillByProjectID(dsDeliveryNotes1.Position, _Projectid); ProjectTableAdapter _tdProject = new ProjectTableAdapter(); _tdProject.FillByProjectID(dsDeliveryNotes1.Project, _Projectid); CustomerTableAdapter _tdCustomer = new CustomerTableAdapter(); _tdCustomer.FillByCustmerID(dsDeliveryNotes1.Customer, _Custid); }
public static List <ProjectInfo> getProjects(bool OnlyActive = true) { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetData(); List <ProjectInfo> result = new List <ProjectInfo>(); foreach (NuRacingDataSet.ProjectRow projectRow in projectTable.Rows) { if (!(OnlyActive && !projectRow.Project_Active)) { result.Add(new ProjectInfo(projectRow)); } } return(result); }
public void updateDatabase() { if (beenChanged) { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetProject(projectID); NuRacingDataSet.ProjectRow projectRow = (NuRacingDataSet.ProjectRow)(projectTable.Rows[0]); projectRow.Project_Active = active; projectRow.Project_Name = name; projectRow.Project_Description = description; projectRow.Project_UID = projectID; projectRow.Project_Status = status; projectRow.Project_StatusChangedDate = statusLastChanged; projectAdapter.Update(projectTable); } }
public static void AddProject(string ProjectName, int YearOfProject, string ProjectDescription, bool IsActive = true) { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = new NuRacingDataSet.ProjectDataTable(); projectAdapter.Fill(projectTable); NuRacingDataSet.ProjectRow newProjectRow = projectTable.NewProjectRow(); newProjectRow.Project_Name = ProjectName; newProjectRow.Project_YearMade = YearOfProject; newProjectRow.Project_Description = ProjectDescription; newProjectRow.Project_Active = IsActive; newProjectRow.Project_Status = "Planning"; newProjectRow.Project_StatusChangedDate = DateTime.Now; projectTable.AddProjectRow(newProjectRow); projectAdapter.Update(projectTable); }
static DesignBid() { // load data dsNBD = new NBD_DataSet(); ProjectTableAdapter daProject = new ProjectTableAdapter(); ClientTableAdapter daClient = new ClientTableAdapter(); WorkerTableAdapter daWorker = new WorkerTableAdapter(); MaterialReqTableAdapter daMatReq = new MaterialReqTableAdapter(); LabourReqTableAdapter daLabReq = new LabourReqTableAdapter(); try { daProject.Fill(dsNBD.Project); daClient.Fill(dsNBD.Client); daWorker.Fill(dsNBD.Worker); daMatReq.Fill(dsNBD.MaterialReq); daLabReq.Fill(dsNBD.LabourReq); } catch (DataException dex) { catcher = dex.Message; }// added a dex catcher }
public static void AddProject(string ProjectName, int YearOfProject, string ProjectDescription, bool IsActive = true) { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = new NuRacingDataSet.ProjectDataTable(); projectAdapter.Fill(projectTable); NuRacingDataSet.ProjectRow newProjectRow = projectTable.NewProjectRow(); newProjectRow.Project_Name = ProjectName; newProjectRow.Project_YearMade = YearOfProject; newProjectRow.Project_Description = ProjectDescription; newProjectRow.Project_Active = IsActive; newProjectRow.Project_Status = "Planning"; newProjectRow.Project_StatusChangedDate = DateTime.Now; projectTable.AddProjectRow(newProjectRow); projectAdapter.Update(projectTable); }
public void resetData() { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetProject(projectID); NuRacingDataSet.ProjectRow projectRow = (NuRacingDataSet.ProjectRow)(projectTable.Rows[0]); active = projectRow.Project_Active; name = projectRow.Project_Name; description = projectRow.Project_Description; projectID = projectRow.Project_UID; status = projectRow.Project_Status; statusLastChanged = projectRow.Project_StatusChangedDate; if (projectRow.IsProject_YearMadeNull()) { yearMade = null; } else { yearMade = projectRow.Project_YearMade; } beenChanged = false; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request["q"] != null) { if (Session["Login"].ToString() != null) { Session["Login"] = null; Session["Name"] = null; Response.Redirect(ConfigurationManager.AppSettings.GetValues("mainURL") + "signin.aspx"); } } UserProfileTableAdapter userProfileTableAdapter = new UserProfileTableAdapter(); UserProfile userProfile = userProfileTableAdapter.GetUserProfileByID(Convert.ToInt32(Session["Login"])); DataTable dtUserProfile = userProfileTableAdapter.GetDataByStatus("ACTIVE"); if (userProfile.DepartmentID == 1) { if (userProfile.UserRoleID == 1) { ltlCustomer.Visible = true; ltlDepartmentView.Visible = true; ltlInvoiceReportView.Visible = true; ltlUserProfileView.Visible = true; ltlUserRoleView.Visible = true; ltlRiver.Visible = true; ltlRiverView.Visible = true; //chartWaterLevel.Visible = true; //string[] x = new string[dtWaterLevel.Rows.Count]; //int[] y = new int[dtWaterLevel.Rows.Count]; //for (int i = 0; i < dtWaterLevel.Rows.Count; i++) //{ // x[i] = dtWaterLevel.Rows[i][2].ToString(); // y[i] = Convert.ToInt32(dtWaterLevel.Rows[i][0]); //} //chartWaterLevel.Series[0].Points.DataBindXY(x, y); //chartWaterLevel.Series[0].ChartType = SeriesChartType.Column; //chartWaterLevel.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //chartWaterLevel.Legends[0].Enabled = true; } } else if (userProfile.DepartmentID == 2) { if (userProfile.UserRoleID == 2) { ltlCustomerView.Visible = true; ltlDepartmentView.Visible = true; ltlUserProfileView.Visible = true; ltlUserRoleView.Visible = true; } else if (userProfile.UserRoleID == 3) { ltlCustomerView.Visible = true; ltlDepartmentView.Visible = false; ltlInvoiceReportView.Visible = true; ltlUserProfileView.Visible = false; ltlUserRoleView.Visible = false; } } else if (userProfile.DepartmentID == 3) { if (userProfile.UserRoleID == 4) { ltlCustomerView.Visible = false; ltlDepartmentView.Visible = false; ltlUserProfileView.Visible = false; ltlUserRoleView.Visible = false; } } else if (userProfile.DepartmentID == 4) { if (userProfile.UserRoleID == 5 || userProfile.UserRoleID == 6) { ltlCustomerView.Visible = false; ltlDepartmentView.Visible = false; ltlInvoiceReportView.Visible = false; ltlUserProfileView.Visible = false; ltlUserRoleView.Visible = false; } } else if (userProfile.DepartmentID == 5) { if (userProfile.UserRoleID == 7) { ltlCustomerView.Visible = true; ltlDepartmentView.Visible = false; ltlInvoiceReportView.Visible = false; ltlUserProfileView.Visible = false; ltlUserRoleView.Visible = false; } } else if (userProfile.DepartmentID == 6) { if (userProfile.UserRoleID == 8) { ltlCustomerView.Visible = false; ltlDepartmentView.Visible = false; ltlInvoiceReportView.Visible = false; ltlUserProfileView.Visible = false; ltlUserRoleView.Visible = false; } } DataTable dtUserProfileList = userProfileTableAdapter.GetDataByStatus("ACTIVE"); ltlUser.Text = dtUserProfileList.Rows.Count.ToString(); CustomerTableAdapter customeTableAdapter = new CustomerTableAdapter(); DataTable dtCustomerList = customeTableAdapter.GetDataByStatus("ACTIVE"); ltlCustomer.Text = dtCustomerList.Rows.Count.ToString(); ProjectTableAdapter projectTableAdapter = new ProjectTableAdapter(); DataTable dtProjectList = projectTableAdapter.GetDataByStatus("ACTIVE"); DepartmentTableAdapter departmentTableAdapter = new DepartmentTableAdapter(); DataTable dtDepartmentList = departmentTableAdapter.GetDataByStatus("ACTIVE"); ltlDepartment.Text = dtDepartmentList.Rows.Count.ToString(); UserRoleTableAdapter userRoleTableAdapter = new UserRoleTableAdapter(); DataTable dtUserRole = userRoleTableAdapter.GetDataByStatus("ACTIVE"); ltlUserRole.Text = dtUserRole.Rows.Count.ToString(); WaterLevelTableAdapter waterLevelTabeleAdapter = new WaterLevelTableAdapter(); DataTable dtWaterLevel = waterLevelTabeleAdapter.GetDataByStatus("ACTIVE"); ltlWaterLevel.Text = dtWaterLevel.Rows.Count.ToString(); RiverTableAdapter riverTableAdapter = new RiverTableAdapter(); DataTable dtRiver = riverTableAdapter.GetDataByStatus("ACTIVE"); ltlRiver.Text = dtRiver.Rows.Count.ToString(); DamTableAdapter damTableAdapter = new DamTableAdapter(); DataTable dtDam = damTableAdapter.GetDataByStatus("ACTIVE"); ltlDam.Text = dtDam.Rows.Count.ToString(); WaterLevelDamTableAdapter waterLevelDamTabeleAdapter = new WaterLevelDamTableAdapter(); DataTable dtWaterLevelDam = waterLevelDamTabeleAdapter.GetDataByStatus("ACTIVE"); ltlWaterLevelDam.Text = dtWaterLevelDam.Rows.Count.ToString(); } }
public static ProjectInfo getProject(int ProjectID) { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetProject(ProjectID); if (projectTable.Rows.Count == 0) { throw new ArgumentException("Project doesn't exist"); } return new ProjectInfo((NuRacingDataSet.ProjectRow) projectTable.Rows[0]); }
public static List<ProjectInfo> getProjects(bool OnlyActive = true) { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetData(); List<ProjectInfo> result = new List<ProjectInfo>(); foreach (NuRacingDataSet.ProjectRow projectRow in projectTable.Rows) { if (!(OnlyActive && !projectRow.Project_Active)) { result.Add(new ProjectInfo(projectRow)); } } return result; }
public static List<ProjectInfo> getUserProjects(string Username, bool OnlyActive) { if (!User.UsernameExists(Username)) { throw new ArgumentException("Username doesn't exist"); } ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetData(); List<ProjectInfo> result = new List<ProjectInfo>(); foreach (NuRacingDataSet.ProjectRow projectRow in projectTable.Rows) { if (!( (OnlyActive && (!projectRow.Project_Active)) || !(Project.userInvolvedIn(Username, projectRow.Project_UID)))) { result.Add(new ProjectInfo(projectRow)); } } return result; }
public void resetData() { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetProject(projectID); NuRacingDataSet.ProjectRow projectRow = (NuRacingDataSet.ProjectRow)(projectTable.Rows[0]); active = projectRow.Project_Active; name = projectRow.Project_Name; description = projectRow.Project_Description; projectID = projectRow.Project_UID; status = projectRow.Project_Status; statusLastChanged = projectRow.Project_StatusChangedDate; if (projectRow.IsProject_YearMadeNull()) { yearMade = null; } else { yearMade = projectRow.Project_YearMade; } beenChanged = false; }
public static bool projectActive(int ProjectID) { if (!projectExists(ProjectID)) { throw new ArgumentException("Project doesn't exist"); } else { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetProject(ProjectID); return ((NuRacingDataSet.ProjectRow)projectTable.Rows[0]).Project_Active; } }
public void updateDatabase() { if (beenChanged) { ProjectTableAdapter projectAdapter = new ProjectTableAdapter(); NuRacingDataSet.ProjectDataTable projectTable = projectAdapter.GetProject(projectID); NuRacingDataSet.ProjectRow projectRow = (NuRacingDataSet.ProjectRow)(projectTable.Rows[0]); projectRow.Project_Active = active; projectRow.Project_Name = name; projectRow.Project_Description = description; projectRow.Project_UID = projectID; projectRow.Project_Status = status; projectRow.Project_StatusChangedDate = statusLastChanged; projectAdapter.Update(projectTable); } }