private void RptInspectionReport_Load(object sender, EventArgs e)
        {
            using (SrisContext ctx = new SrisContext())
            {
                var lastInspection = ctx.InspectionInfo.OrderByDescending(x => x.II_ID).FirstOrDefault();

                tb_ID.Text = lastInspection.II_ID.ToString();


                if (ctx.ProcedureTest.Any(x => x.II_ID == lastInspection.II_ID))
                {
                    cb_Procedure.Checked = true;
                }
                if (ctx.FindingParticular.Any(x => x.II_ID == lastInspection.II_ID))
                {
                    cb_Particulars.Checked = true;
                }
                if (ctx.Recommendation.Any(x => x.II_ID == lastInspection.II_ID))
                {
                    cb_Recommendation.Checked = true;
                }
                if (ctx.UnitSpecification.Any(x => x.II_ID == lastInspection.II_ID))
                {
                    cb_UnitSpecification.Checked = true;
                }



                CrystalReport();
            }
        }
        private void LoadUnitSpecification()
        {
            using (SrisContext ctx = new SrisContext())
            {
                var unitSpecificationList = from p in ctx.UnitSpecification
                                            where p.II_ID == tempIdRequest
                                            select new
                {
                    hr = p.HardwareComponent,
                    r  = p.Remarks
                };
                foreach (var item in unitSpecificationList)
                {
                    dataGridView_UnitSpecs.Rows.Add(item.hr, item.r);
                }
            }

            //SQLCon.DbCon();
            //SQLCon.sqlDataApater = new SqlDataAdapter(
            //   @"SELECT
            //        T1.HardwareComponent AS [Component],
            //        T1.Remarks AS [Description]

            //    FROM
            //      UnitSpecifications AS T1

            //    WHERE
            //        T1.II_ID = @0
            //      ", SQLCon.sqlConnection);
            //SQLCon.sqlDataApater.SelectCommand.Parameters.AddWithValue("@0", tempIdRequest);
            //SQLCon.dataTable = new DataTable();
            //SQLCon.sqlDataApater.Fill(SQLCon.dataTable);
            //dataGridView_UnitSpecs.DataSource = SQLCon.dataTable;
        }
Exemplo n.º 3
0
        private void RegisterAccount()
        {
            if (!(String.IsNullOrEmpty(tb_Username.Text) || String.IsNullOrEmpty(tb_Password.Text) || String.IsNullOrEmpty(tb_FirstName.Text) || String.IsNullOrEmpty(tb_LastName.Text)))
            {
                if (tb_Password.Text == tb_ConfirmPassword.Text)
                {
                    using (SrisContext ctx = new SrisContext())
                    {
                        var registerUser = new Account
                        {
                            Username    = tb_Username.Text,
                            Password    = tb_Password.Text,
                            FirstName   = tb_FirstName.Text,
                            LastName    = tb_LastName.Text,
                            AccessLevel = cb_UserRole.Text,
                            IsActive    = false
                        };
                        ctx.Account.Add(registerUser);
                        ctx.SaveChanges();
                    }

                    MessageBox.Show("Registration Successfull.Please wait for Confirmation");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Password did not match");
                }
            }
            else
            {
                MessageBox.Show("Please filled up the fields");
            }
        }
 private void cb_NamePerformedInspected_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (SrisContext ctx = new SrisContext())
     {
         var pos = ctx.ServiceProvidedBy.Where(x => x.spName == cb_NamePerformedInspected.Text && x.IsActive == true).Select(p => p.spPosition);
         cb_Position.Text = pos.FirstOrDefault();
     }
 }
Exemplo n.º 5
0
        private void Bt_SaveUser_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(tb_Username.Text))
            {
                MessageBox.Show("Plesae Fill up the required fields");
            }
            else
            {
                if (String.IsNullOrEmpty(tempId_UserList))
                {
                    if (tb_Password.Text == tb_ConfirmPassword.Text)
                    {
                        SQLCon.DbCon();
                        SQLCon.sqlCommand             = new SqlCommand("INSERT INTO Accounts VALUES(@Username,@Password,@FirstName,@LastName,@AccessLevel,@IsActive,@IsLogon,@MiddleName)", SQLCon.sqlConnection);
                        SQLCon.sqlCommand.CommandType = CommandType.Text;
                        SQLCon.sqlCommand.Parameters.AddWithValue("@Username", tb_Username.Text);
                        SQLCon.sqlCommand.Parameters.AddWithValue("@Password", tb_Password.Text);
                        SQLCon.sqlCommand.Parameters.AddWithValue("@FirstName", tb_FirstName.Text);
                        SQLCon.sqlCommand.Parameters.AddWithValue("@MiddleName", tb_MiddleName.Text);
                        SQLCon.sqlCommand.Parameters.AddWithValue("@LastName", tb_LastName.Text);
                        SQLCon.sqlCommand.Parameters.AddWithValue("@AccessLevel", cb_AccessLevel.Text);
                        SQLCon.sqlCommand.Parameters.AddWithValue("@IsActive", 1);
                        SQLCon.sqlCommand.Parameters.AddWithValue("@IsLogon", 1);
                        SQLCon.sqlCommand.ExecuteNonQuery();
                        MessageBox.Show("User added Successfully");
                        LoadUserList();
                    }
                    else
                    {
                        MessageBox.Show("Password did not match");
                        tb_Password.Clear();
                        tb_ConfirmPassword.Clear();
                    }
                }
                else
                {
                    using (SrisContext ctx = new SrisContext())
                    {
                        int     tempId      = Convert.ToInt32(tempId_UserList);
                        Account userAccount = ctx.Account.Where(x => x.USER_ID == tempId).FirstOrDefault();
                        userAccount.Username    = tb_Username.Text;
                        userAccount.Password    = tb_Password.Text;
                        userAccount.FirstName   = tb_FirstName.Text;
                        userAccount.MiddleName  = tb_MiddleName.Text;
                        userAccount.LastName    = tb_LastName.Text;
                        userAccount.AccessLevel = cb_AccessLevel.Text;
                        userAccount.IsActive    = checkBox_Status.Checked;
                        ctx.SaveChanges();
                        MessageBox.Show("User update Successfully");
                        LoadUserList();
                        tempId_UserList = null;
                        dataGridView_UserList.ClearSelection();
                    }
                }
            }

            ClearText();
        }
Exemplo n.º 6
0
        private void LoadUserList()
        {
            using (SrisContext ctx = new SrisContext())
            {
                dataGridView_UserList.DataSource = ctx.Account.ToList();

                customDesignDataGrid();
            }
        }
        private void cb_ReceivedBy_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                using (SrisContext ctx = new SrisContext())
                {
                    var pos = ctx.ServiceProvidedBy.Where(x => x.spName == cb_ReceivedBy.Text).Select(p => p.spPosition);

                    comboBox1.Text = pos.FirstOrDefault();
                }
            }
            catch (Exception)
            {
            }
        }
 private void LoadProcedureTest()
 {
     using (SrisContext ctx = new SrisContext())
     {
         var procedureTestList = from p in ctx.ProcedureTest
                                 where p.II_ID == tempIdRequest
                                 select new
         {
             hr = p.ProcedureTestDetails,
         };
         foreach (var item in procedureTestList)
         {
             dataGridView_ProcedureTest.Rows.Add(item.hr);
         }
     }
 }
 private void LoadRecommendation()
 {
     using (SrisContext ctx = new SrisContext())
     {
         var recommendationList = from p in ctx.Recommendation
                                  where p.II_ID == tempIdRequest
                                  select new
         {
             hr = p.RecommendationDetails,
         };
         foreach (var item in recommendationList)
         {
             dataGridView_Recommendation.Rows.Add(item.hr);
         }
     }
 }
 private void LoadParticular()
 {
     using (SrisContext ctx = new SrisContext())
     {
         var particularList = from p in ctx.FindingParticular
                              where p.II_ID == tempIdRequest
                              select new
         {
             hr = p.Particulars,
             r  = p.InspectionInfo
         };
         foreach (var item in particularList)
         {
             dataGridView_FindingParticular.Rows.Add(item.hr, item.r);
         }
     }
 }
 private void LoadInpectedBy()
 {
     using (SrisContext ctx = new SrisContext())
     {
         var inspectedList = from p in ctx.InspectedPerformedBy
                             where p.II_ID == tempIdRequest
                             select new
         {
             hr = p.Name,
             r  = p.Position
         };
         foreach (var item in inspectedList)
         {
             dataGridView_PerformedInspected.Rows.Add(item.hr, item.r);
         }
     }
 }
Exemplo n.º 12
0
        private void PopulateComboBox_Infoes()
        {
            PopulateComboBox("OfficeDepartments", "OD_ID", "OfficeDepartmentName", cb_RequestingOffice);
            PopulateComboBox("ServiceRequestInfoes", "SR_ID", "RequestedBy", cb_RequestedBy);

            // PopulateComboBox("ServiceProvidedBies", "SP_ID", "spName", cb_ReceivedBy);

            using (SrisContext ctx = new SrisContext())
            {
                var spNameList = ctx.ServiceProvidedBy.Where(x => x.IsActive == true).ToList();
                cb_ReceivedBy.DataSource = spNameList;
                //cb_Course.Items.Add(cb_Course.DataSource = ctx.Courses.ToString());
                cb_ReceivedBy.DisplayMember   = "spName";
                cb_ReceivedBy.ValueMember     = "SP_ID";
                cb_ReceivedBy.SelectedIndex   = -1;
                cb_ReceivedBy.SelectionLength = 0;
            }


            PopulateComboBox("InspectionInfoes", "II_ID", "ComplaintOnUnit", cb_ComplaintOnUnit);
            PopulateComboBox("InspectionInfoes", "II_ID", "TypeOfUnit", cb_TypeOfUnit);
            PopulateComboBox("InspectionInfoes", "II_ID", "PropertyNumber", cb_PropertyNo);

            PopulateComboBox("UnitSpecifications", "US_ID", "HardwareComponent", cb_HardwareComponents);
            PopulateComboBox("UnitSpecifications", "US_ID", "Remarks", cb_ComponentRemarks);

            PopulateComboBox("ProcedureTests", "PT_ID", "ProcedureTestDetails", cb_ProcedureTest);

            PopulateComboBox("FindingParticulars", "FP_ID", "Status", cb_Particular);
            PopulateComboBox("FindingParticulars", "FP_ID", "Particulars", cb_Finding);

            PopulateComboBox("Recommendations", "R_ID", "RecommendationDetails", cb_Recommendation);

            //PopulateComboBox("ServiceProvidedBies", "SP_ID", "spName", cb_NamePerformedInspected);
            using (SrisContext ctx = new SrisContext())
            {
                var spNameList = ctx.ServiceProvidedBy.Where(x => x.IsActive == true && x.spPosition != "PROGRAMMER").ToList();
                cb_NamePerformedInspected.DataSource = spNameList;
                //cb_Course.Items.Add(cb_Course.DataSource = ctx.Courses.ToString());
                cb_NamePerformedInspected.DisplayMember   = "spName";
                cb_NamePerformedInspected.ValueMember     = "SP_ID";
                cb_NamePerformedInspected.SelectedIndex   = -1;
                cb_NamePerformedInspected.SelectionLength = 0;
            }
        }
Exemplo n.º 13
0
        private void SaveWeekly()
        {
            try
            {
                using (SrisContext ctx = new SrisContext())
                {
                    SQLCon.DbCon();
                    SQLCon.sqlCommand             = new SqlCommand("INSERT INTO SystemDevelopments VALUES(@USER_ID,@DateAccomplish,@Accomplishment,@Remarks,@WeeklyMonthly,@SystemTitle)", SQLCon.sqlConnection);
                    SQLCon.sqlCommand.CommandType = CommandType.Text;
                    SQLCon.sqlCommand.Parameters.AddWithValue("@USER_ID", WelcomeForm.AccountID);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@Remarks", tb_Memo.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@Accomplishment", tb_Accomplishment.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@SystemTitle", cb_SystemTitle.Text);


                    if (radioButton_Weekly.Checked == true)
                    {
                        SQLCon.sqlCommand.Parameters.AddWithValue("@DateAccomplish", dateTimePicker_Date.Value.Date);
                        SQLCon.sqlCommand.Parameters.AddWithValue("@WeeklyMonthly", 1);
                    }
                    else
                    {
                        string month      = cb_Month.Text.ToString();
                        string year       = DateTime.Now.Year.ToString();
                        string dateInput  = month + " 1, " + year;
                        var    parsedDate = DateTime.Parse(dateInput);
                        SQLCon.sqlCommand.Parameters.AddWithValue("@DateAccomplish", Convert.ToDateTime(parsedDate));
                        SQLCon.sqlCommand.Parameters.AddWithValue("@WeeklyMonthly", 0);
                    }
                }

                SQLCon.sqlCommand.ExecuteNonQuery();
                MessageBox.Show("Save Successfully");

                ClearText();
                LoadWeeklyRpt();
                LoadListSystemTitle(cb_SystemTitle);
                DesignTable();
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void btUpdate_Click(object sender, EventArgs e)
        {
            using (SrisContext ctx = new SrisContext())
            {
                //var unitSpecification = new UnitSpecification();
                //foreach (DataGridViewRow row in dataGridView_UnitSpecs.Rows)
                //{
                //    unitSpecification.HardwareComponent = row.Cells["Column2"].Value.ToString();
                //    unitSpecification.Remarks = row.Cells["Column3"].Value.ToString();
                //    unitSpecification.II_ID = tempIdRequest;
                //    ctx.UnitSpecification.Add(unitSpecification);
                //    ctx.SaveChanges();
                //}


                var unitSpecificationUpdate = new UnitSpecification();
                foreach (DataGridViewRow itemUnitSpecification in dataGridView_UnitSpecs.Rows)
                {
                    string hardWareComponents = itemUnitSpecification.Cells["Column2"].Value.ToString();
                    string hardwareRemarks    = itemUnitSpecification.Cells["Column3"].Value.ToString();

                    if (!(ctx.UnitSpecification.Any(x => x.II_ID == tempIdRequest && x.HardwareComponent == hardWareComponents && x.Remarks == hardwareRemarks)))
                    {
                        unitSpecificationUpdate.HardwareComponent = itemUnitSpecification.Cells["Column2"].Value.ToString();
                        unitSpecificationUpdate.Remarks           = itemUnitSpecification.Cells["Column3"].Value.ToString();
                        unitSpecificationUpdate.II_ID             = tempIdRequest;
                        ctx.UnitSpecification.Add(unitSpecificationUpdate);
                        ctx.SaveChanges();
                    }
                    else
                    {
                        var usID = ctx.UnitSpecification.Where(x => x.II_ID == tempIdRequest && x.HardwareComponent == hardWareComponents && x.Remarks == hardwareRemarks).Select(p => p.US_ID).FirstOrDefault().ToString();
                        unitSpecificationUpdate.HardwareComponent = itemUnitSpecification.Cells["Column2"].Value.ToString();
                        unitSpecificationUpdate.Remarks           = itemUnitSpecification.Cells["Column3"].Value.ToString();
                        unitSpecificationUpdate.II_ID             = tempIdRequest;
                        unitSpecificationUpdate.US_ID             = Int32.Parse(usID);
                        ctx.UnitSpecification.Attach(unitSpecificationUpdate);
                        ctx.Entry(unitSpecificationUpdate).State = System.Data.Entity.EntityState.Modified;
                        ctx.SaveChanges();
                    }
                }
            }
        }
Exemplo n.º 15
0
        private void LoadUserList()
        {
            using (SrisContext ctx = new SrisContext())
            {
                dataGridView_UserList.DataSource = ctx.Account.ToList();

                customDesignDataGrid();
            }

            dataGridView_UserList.Columns["IsLogOn"].Visible           = false;
            dataGridView_UserList.Columns["TypeOfServices"].Visible    = false;
            dataGridView_UserList.Columns["TechnicianRequest"].Visible = false;
            dataGridView_UserList.Columns["SystemDevelopment"].Visible = false;


            custom_Class custom_Class = new custom_Class();

            cb_AccessLevel.DataSource = Enum.GetValues(typeof(custom_Class.List));
        }
        private void UpdateInspectionArchived_Load(object sender, EventArgs e)
        {
            LoadUnitSpecification();
            LoadProcedureTest();
            LoadParticular();
            LoadRecommendation();
            LoadInpectedBy();

            PopulateComboBox("OfficeDepartments", "OD_ID", "OfficeDepartmentName", cb_RequestingOffice);
            PopulateComboBox("ServiceRequestInfoes", "SR_ID", "RequestedBy", cb_RequestedBy);

            // PopulateComboBox("ServiceProvidedBies", "SP_ID", "spName", cb_ReceivedBy);

            using (SrisContext ctx = new SrisContext())
            {
                var spNameList = ctx.ServiceProvidedBy.Where(x => x.IsActive == true).ToList();
                cb_ReceivedBy.DataSource = spNameList;
                //cb_Course.Items.Add(cb_Course.DataSource = ctx.Courses.ToString());
                cb_ReceivedBy.DisplayMember   = "spName";
                cb_ReceivedBy.ValueMember     = "SP_ID";
                cb_ReceivedBy.SelectedIndex   = -1;
                cb_ReceivedBy.SelectionLength = 0;
            }


            PopulateComboBox("InspectionInfoes", "II_ID", "ComplaintOnUnit", cb_ComplaintOnUnit);
            PopulateComboBox("InspectionInfoes", "II_ID", "TypeOfUnit", cb_TypeOfUnit);
            PopulateComboBox("InspectionInfoes", "II_ID", "PropertyNumber", cb_PropertyNo);

            PopulateComboBox("UnitSpecifications", "US_ID", "HardwareComponent", cb_HardwareComponents);
            PopulateComboBox("UnitSpecifications", "US_ID", "Remarks", cb_ComponentRemarks);

            PopulateComboBox("ProcedureTests", "PT_ID", "ProcedureTestDetails", cb_ProcedureTest);

            PopulateComboBox("FindingParticulars", "FP_ID", "Status", cb_Particular);
            PopulateComboBox("FindingParticulars", "FP_ID", "Particulars", cb_Finding);

            PopulateComboBox("Recommendations", "R_ID", "RecommendationDetails", cb_Recommendation);

            //PopulateComboBox("ServiceProvidedBies", "SP_ID", "spName", cb_NamePerformedInspected);
            using (SrisContext ctx = new SrisContext())
            {
                var spNameList = ctx.ServiceProvidedBy.Where(x => x.IsActive == true && x.spPosition != "PROGRAMMER").ToList();
                cb_NamePerformedInspected.DataSource = spNameList;
                //cb_Course.Items.Add(cb_Course.DataSource = ctx.Courses.ToString());
                cb_NamePerformedInspected.DisplayMember   = "spName";
                cb_NamePerformedInspected.ValueMember     = "SP_ID";
                cb_NamePerformedInspected.SelectedIndex   = -1;
                cb_NamePerformedInspected.SelectionLength = 0;
            }

            tempIdRequest                 = Convert.ToInt32(dgvr_UpdateArchiveInspection.Cells[0].Value.ToString());
            cb_RequestingOffice.Text      = dgvr_UpdateArchiveInspection.Cells[1].Value.ToString();
            cb_RequestedBy.Text           = dgvr_UpdateArchiveInspection.Cells[2].Value.ToString();
            cb_ReceivedBy.Text            = dgvr_UpdateArchiveInspection.Cells[3].Value.ToString();
            comboBox1.Text                = dgvr_UpdateArchiveInspection.Cells[4].Value.ToString();
            dateTimePicker_Received.Value = Convert.ToDateTime(dgvr_UpdateArchiveInspection.Cells[5].Value.ToString());
            cb_TypeOfUnit.Text            = dgvr_UpdateArchiveInspection.Cells[6].Value.ToString();
            cb_ComplaintOnUnit.Text       = dgvr_UpdateArchiveInspection.Cells[7].Value.ToString();
            cb_PropertyNo.Text            = dgvr_UpdateArchiveInspection.Cells[8].Value.ToString();
        }