コード例 #1
0
        private void bt_MultipleTechinician_Click(object sender, EventArgs e)
        {
            PopulateCheckTechId = tb_ServiceProvided.Text;


            TechnicianForm technicianForm = new TechnicianForm();

            TechnicianForm.Choice = "updateCompletedRequest";
            technicianForm.ShowDialog();

            try
            {
                tb_ServiceProvided.Text = technicianForm.PopulateTechinician.ToString();



                tb_Ids.Text = technicianForm.SelectedProviderId.ToString();
                techId      = technicianForm.SelectedProviderId.ToString().Split(',');

                foreach (var id in techId)
                {
                    string test = id;
                }
            }
            catch (Exception)
            {
                tb_ServiceProvided.Clear();
            }
        }
コード例 #2
0
        private void TechnicianList(string x)
        {
            PopulateCheckTechId = tb_ToBeServiceProvided.Text;


            TechnicianForm technicianForm = new TechnicianForm();

            TechnicianForm.Choice = "ucNewRequest";
            technicianForm.ShowDialog();

            try
            {
                if (x == "providedBy")
                {
                    tb_ServiceProvided.Text = technicianForm.PopulateTechinician.ToString();
                }

                tb_Ids.Text = technicianForm.SelectedProviderId.ToString();
                techId      = technicianForm.SelectedProviderId.ToString().Split(',');

                foreach (var id in techId)
                {
                    string test = id;
                }
            }
            catch (Exception)
            {
                tb_ServiceProvided.Clear();
            }
        }
コード例 #3
0
        private void SaveRequest(string message)
        {
            dateTimeRequested = dtp_Requested_Date.Value.Date + dtp_Requested_Time.Value.TimeOfDay;

            TechnicianForm technicianForm = new TechnicianForm();

            SQLCon.DbCon();


            SQLCon.sqlCommand = new SqlCommand(@"INSERT INTO ServiceRequestInfoes (TypeOfServiceProvided, RequestedBy, OfficeDepartmentName, DateRequested, TimeLeft, DateAccomplished, Status, Techinicians, RemarkDeatails, DateEntered, AssignedTechnician)  VALUES(
                        @TypeOfServiceProvided,
                        @RequestedBy,
                        @OfficeDepartmentName,
                        @DateRequested,
                        @TimeLeft,
                        @DateAccomplished,
                        @Status,
                        @Techinicians,
                        @RemarkDeatails,
                        @DateEntered,
                        @AssignedTechnician);SELECT SCOPE_IDENTITY();", SQLCon.sqlConnection);

            SQLCon.sqlCommand.CommandType = CommandType.Text;
            SQLCon.sqlCommand.Parameters.AddWithValue("@TypeOfServiceProvided", cb_Service.Text);
            SQLCon.sqlCommand.Parameters.AddWithValue("@RequestedBy", tb_RequestedBy.Text);
            SQLCon.sqlCommand.Parameters.AddWithValue("@OfficeDepartmentName", cb_Office.Text);
            SQLCon.sqlCommand.Parameters.AddWithValue("@DateRequested", dateTimeRequested);
            SQLCon.sqlCommand.Parameters.AddWithValue("@TimeLeft", DBNull.Value); //Time Left Column
            SQLCon.sqlCommand.Parameters.AddWithValue("@RemarkDeatails", cb_Remarks.Text);
            SQLCon.sqlCommand.Parameters.AddWithValue("@Techinicians", tb_ServiceProvided.Text);
            SQLCon.sqlCommand.Parameters.AddWithValue("@AssignedTechnician", tb_ToBeServiceProvided.Text);

            if (radioButton_Yes.Checked == true)
            {
                SQLCon.sqlCommand.Parameters.AddWithValue("@Status", true);
                SQLCon.sqlCommand.Parameters.AddWithValue("@DateAccomplished", dtp_Accomplished.Value.Date);
                SQLCon.sqlCommand.Parameters.AddWithValue("@DateEntered", dtp_Accomplished.Value.Date);
            }
            else
            {
                SQLCon.sqlCommand.Parameters.AddWithValue("@Status", false);
                SQLCon.sqlCommand.Parameters.AddWithValue("@DateAccomplished", DBNull.Value);
                SQLCon.sqlCommand.Parameters.AddWithValue("@DateEntered", DBNull.Value);
            }

            SQLCon.sqlCommand.ExecuteNonQuery();

            ClearTextbox();
            LoadRequest();
            PopulateComboBox_Infoes();
            MetroFramework.MetroMessageBox.Show(this, message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #4
0
        private void SaveRequest()
        {
            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                //SQL
                //try
                //{

                if (tb_ServiceProvided.Text.Contains(","))
                {
                    TechnicianForm technicianForm = new TechnicianForm();
                    SQLCon.DbCon();


                    SQLCon.sqlCommand = new SqlCommand(@"INSERT INTO ServiceRequestInfoes (TypeOfServiceProvided, RequestedBy, OfficeDepartmentName, DateRequested, TimeLeft, DateAccomplished, Status, Techinicians, RemarkDeatails, DateEntered)  VALUES(
                        @TypeOfServiceProvided,
                        @RequestedBy,
                        @OfficeDepartmentName,
                        @DateRequested,
                        @TimeLeft,
                        @DateAccomplished,
                        @Status,
                        @Techinicians,
                        @RemarkDeatails,
                        @DateEntered);SELECT SCOPE_IDENTITY();", SQLCon.sqlConnection);

                    SQLCon.sqlCommand.CommandType = CommandType.Text;
                    SQLCon.sqlCommand.Parameters.AddWithValue("@TypeOfServiceProvided", cb_Service.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@RequestedBy", tb_RequestedBy.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@OfficeDepartmentName", cb_Office.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@DateRequested", dtp_Requested.Value);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@TimeLeft", DBNull.Value); //Time Left Column
                    SQLCon.sqlCommand.Parameters.AddWithValue("@RemarkDeatails", cb_Remarks.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@Techinicians", tb_ServiceProvided.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@DateAccomplished", dtp_Accomplished.Value);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@Status", true);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@DateEntered", DateTime.Now);
                    SQLCon.sqlCommand.ExecuteNonQuery();

                    //   SQLCon.sqlCommand = new SqlCommand
                }
                else
                {
                    TechnicianForm technicianForm = new TechnicianForm();
                    SQLCon.DbCon();


                    SQLCon.sqlCommand = new SqlCommand(@"INSERT INTO ServiceRequestInfoes (TypeOfServiceProvided, RequestedBy, OfficeDepartmentName, DateRequested, TimeLeft, DateAccomplished, Status, Techinicians, RemarkDeatails, DateEntered)  VALUES(
                        @TypeOfServiceProvided,
                        @RequestedBy,
                        @OfficeDepartmentName,
                        @DateRequested,
                        @TimeLeft,
                        @DateAccomplished,
                        @Status,
                        @Techinicians,
                        @RemarkDeatails,
                        @DateEntered);SELECT SCOPE_IDENTITY();", SQLCon.sqlConnection);

                    SQLCon.sqlCommand.CommandType = CommandType.Text;
                    SQLCon.sqlCommand.Parameters.AddWithValue("@TypeOfServiceProvided", cb_Service.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@RequestedBy", tb_RequestedBy.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@OfficeDepartmentName", cb_Office.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@DateRequested", dtp_Requested.Value);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@TimeLeft", DBNull.Value); //Time Left Column
                    SQLCon.sqlCommand.Parameters.AddWithValue("@RemarkDeatails", cb_Remarks.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@Techinicians", tb_ServiceProvided.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@DateAccomplished", dtp_Accomplished.Value);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@Status", true);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@DateEntered", DateTime.Now);
                    SQLCon.sqlCommand.ExecuteNonQuery();

                    ClearTextbox();

                    PopulateComboBox_Infoes();
                    MetroFramework.MetroMessageBox.Show(this, "New Request Added Succesfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //int insertedID = Convert.ToInt32(SQLCon.sqlCommand.ExecuteScalar());

                    //string strValue = tb_Ids.Text;
                    //string[] strArray = strValue.Split(',');

                    //foreach (object obj in strArray)
                    //{

                    //    string tempSP_ID = new string(tb_Ids.Text.ToArray());


                    //    SQLCon.sqlCommand = new SqlCommand("INSERT INTO TechnicianRequests VALUES(@1, @2);", SQLCon.sqlConnection);
                    //    SQLCon.sqlCommand.CommandType = CommandType.Text;
                    //    SQLCon.sqlCommand.Parameters.AddWithValue("@1", obj);
                    //    SQLCon.sqlCommand.Parameters.AddWithValue("@2", insertedID);
                    //    SQLCon.sqlCommand.ExecuteNonQuery();



                    //}


                    ClearTextbox();

                    PopulateComboBox_Infoes();
                    MetroFramework.MetroMessageBox.Show(this, "New Request Added Succesfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                //}
                //catch (Exception e)
                //{

                //    MetroFramework.MetroMessageBox.Show(this, "" + e, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //}
            }
        }
コード例 #5
0
        private void SaveRequest()
        {
            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                //SQL
                try
                {
                    TechnicianForm technicianForm = new TechnicianForm();
                    SQLCon.DbCon();


                    SQLCon.sqlCommand             = new SqlCommand("INSERT INTO ServiceRequestInfoes VALUES(@1, @2, @3, @4, @5, @6, @7, @8, @9);SELECT SCOPE_IDENTITY();", SQLCon.sqlConnection);
                    SQLCon.sqlCommand.CommandType = CommandType.Text;
                    SQLCon.sqlCommand.Parameters.AddWithValue("@1", cb_Service.SelectedValue);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@2", tb_RequestedBy.Text);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@3", cb_Office.SelectedValue);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@4", dtp_Requested.Value);
                    SQLCon.sqlCommand.Parameters.AddWithValue("@5", DBNull.Value); //Time Left Column


                    if (cb_Remarks.SelectedIndex == -1)
                    {
                        SQLCon.sqlCommand.Parameters.AddWithValue("@7", 19);
                    }
                    else
                    {
                        SQLCon.sqlCommand.Parameters.AddWithValue("@7", cb_Remarks.SelectedValue);
                    }

                    SQLCon.sqlCommand.Parameters.AddWithValue("@9", tb_ServiceProvided.Text);
                    if (ch_Status.Checked == true)
                    {
                        SQLCon.sqlCommand.Parameters.AddWithValue("@6", dtp_Accomplished.Value);
                        SQLCon.sqlCommand.Parameters.AddWithValue("@8", 1);
                    }
                    else
                    {
                        SQLCon.sqlCommand.Parameters.AddWithValue("@6", DBNull.Value);
                        SQLCon.sqlCommand.Parameters.AddWithValue("@8", 0);
                    }



                    int insertedID = Convert.ToInt32(SQLCon.sqlCommand.ExecuteScalar());

                    string   strValue = tb_Ids.Text;
                    string[] strArray = strValue.Split(',');

                    foreach (object obj in strArray)
                    {
                        string tempSP_ID = new string(tb_Ids.Text.ToArray());


                        SQLCon.sqlCommand             = new SqlCommand("INSERT INTO TechnicianRequests VALUES(@1, @2);", SQLCon.sqlConnection);
                        SQLCon.sqlCommand.CommandType = CommandType.Text;
                        SQLCon.sqlCommand.Parameters.AddWithValue("@1", obj);
                        SQLCon.sqlCommand.Parameters.AddWithValue("@2", insertedID);
                        SQLCon.sqlCommand.ExecuteNonQuery();
                    }


                    LoadRequest();

                    MetroFramework.MetroMessageBox.Show(this, "New Request Added Succesfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ClearTextbox();
                }
                catch (Exception)
                {
                    MetroFramework.MetroMessageBox.Show(this, "Please Assign Technicians", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }