예제 #1
0
        protected void ProjectEditButton_Click1(object sender, EventArgs e)
        {
            Pioneertech.Consultancy.model.ProjectDetail projectDetail = new Pioneertech.Consultancy.model.ProjectDetail
            {
                ProjectName = ProjectNameTextBox.Text,
                ClientName  = ClientNameTextBox.Text,
                Location    = LocationTextBox.Text,
                Roles       = RolesTextBox.Text,
                EmployeeId  = Convert.ToInt32(ProjectEmployeeIdDropDownList.Text)
            };
            int EmployeeId = int.Parse(ProjectEmployeeIdDropDownList.Text);


            SqlConnection mssqlconnection = new SqlConnection("Data Source=DESKTOP-I3T5H70;" +
                                                              "Initial Catalog=PioneerTech;" +
                                                              "Integrated Security=true");

            mssqlconnection.Open();
            string sql = "UPDATE [ProjectDetail] SET[ProjectName] = " +
                         "'" + projectDetail.ProjectName + "',[ClientName] = '" + projectDetail.ClientName + "',[Location] = '" + projectDetail.Location + "',[Roles] =' " + projectDetail.Roles +
                         "'WHERE EmployeeID = " + EmployeeId;
            SqlCommand command             = new SqlCommand(sql, mssqlconnection);
            int        numberOfRowEffected = command.ExecuteNonQuery();

            mssqlconnection.Close();

            if (numberOfRowEffected > 0)
            {
                string display = "Employee Project Data is Successfully Edited";
                ClientScript.RegisterStartupScript(this.GetType(), "Operation was", "alert('" + display + "');", true);
            }
            else
            {
                string display = "Employee Project Data not Edited. Please try again.";
                ClientScript.RegisterStartupScript(this.GetType(), "Operation was", "alert('" + display + "');", true);
            }
        }
예제 #2
0
        protected void ProjectSaveButton_Click(object sender, EventArgs e)
        {
            Pioneertech.Consultancy.model.ProjectDetail projectDetail = new Pioneertech.Consultancy.model.ProjectDetail
            {
                ProjectName = ProjectNameTextBox.Text,
                ClientName  = ClientNameTextBox.Text,
                Location    = LocationTextBox.Text,
                Roles       = RolesTextBox.Text,
                EmployeeId  = Convert.ToInt32(EmployeeIdTextBox.Text)
            };
            EmployeeDataAccessLayer projectDAL = new EmployeeDataAccessLayer();
            int numberOfRowEffected            = projectDAL.SaveEmployeeProjectData(projectDetail);

            if (numberOfRowEffected > 0)
            {
                string display = "Project Data is Successfully Saved";
                ClientScript.RegisterStartupScript(this.GetType(), "Operation was", "alert('" + display + "');", true);
            }
            else
            {
                string display = "Project Data not Saved. Please try again.";
                ClientScript.RegisterStartupScript(this.GetType(), "Operation was", "alert('" + display + "');", true);
            }
        }