コード例 #1
0
        protected void EditButton_Click(object sender, EventArgs e)
        {
            try
            {
                TehnicalModel model = new TehnicalModel()
                {
                    EmployeeID            = Convert.ToInt32(EmployeeIDDropDownList.SelectedValue),
                    Programming_Languages = Programming_LanguagesTextBox.Text,
                    Databases             = DatabasesTextBox.Text,
                    ORM_Technologies      = ORM_TechnologiesTextBox.Text,
                    UI = UITextBox.Text,
                };
                TechnicalAccess access   = new TechnicalAccess();
                string          EditTech = access.EditTechnical(model);
                if (EditTech.Equals("Success"))

                {
                    Response.Write("<script>alert('Details have been Updated successfully');</script>");
                }
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert(('Please enter the values:' " + ex.Message + ");</script>");
            }
        }
コード例 #2
0
        public string EditTechnical(TehnicalModel Tech)
        {
            int result = 0;

            try
            {
                sqlConnection          = OpenConnection();
                sqlCommand             = new SqlCommand();
                sqlCommand.Connection  = sqlConnection;
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.CommandText = "uspEditTechnicalDetails";
                sqlCommand.Parameters.Add("@EmployeeID", SqlDbType.Int).Value = Tech.EmployeeID;
                sqlCommand.Parameters.Add("@UI", SqlDbType.VarChar).Value     = Tech.UI;
                sqlCommand.Parameters.Add("Programming_Languages", SqlDbType.VarChar).Value = Tech.Programming_Languages;
                sqlCommand.Parameters.Add("ORM_Technologies", SqlDbType.VarChar).Value      = Tech.ORM_Technologies;
                sqlCommand.Parameters.Add("Databases", SqlDbType.VarChar).Value             = Tech.Databases;
                result = sqlCommand.ExecuteNonQuery();
                if (result > 0)
                {
                    return("Update:");
                }
                return("Failed");
            }
            catch (Exception ex)
            {
                return("An error has been occured, please contact administrator EditTechnical:" + ex.Message);
            }

            finally
            {
                CloseConncetion(sqlConnection);
            }
        }
コード例 #3
0
        public string SaveTech(TehnicalModel TechModel)
        {
            int result = 0;

            try
            {
                sqlConnection          = OpenConnection();
                sqlCommand             = new SqlCommand();
                sqlCommand.Connection  = sqlConnection;
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.CommandText = "uspSaveTechnicalDetails";
                sqlCommand.Parameters.Add("@UI", SqlDbType.VarChar).Value = TechModel.UI;
                sqlCommand.Parameters.Add("Programming_Languages", SqlDbType.VarChar).Value = TechModel.Programming_Languages;
                sqlCommand.Parameters.Add("ORM_Technologies", SqlDbType.VarChar).Value      = TechModel.ORM_Technologies;
                sqlCommand.Parameters.Add("Databases", SqlDbType.VarChar).Value             = TechModel.Databases;

                result = sqlCommand.ExecuteNonQuery();
                if (result > 0)
                {
                    return("Success");
                }
                return("Failed");
            }
            catch (Exception ex)
            {
                return("An error has been occured, please contact the administartor: " + ex.Message);
            }
            finally
            {
                CloseConncetion(sqlConnection);
            }
        }
コード例 #4
0
        protected void EmployeeIDDropDownList_SelectedIndexChanged1(object sender, EventArgs e)
        {
            TehnicalModel   model         = new TehnicalModel();
            TechnicalAccess Technicaccess = new TechnicalAccess();

            model = Technicaccess.GetTechnical(Convert.ToInt32(EmployeeIDDropDownList.SelectedValue));
            Programming_LanguagesTextBox.Text = model.Programming_Languages;
            DatabasesTextBox.Text             = model.Databases;
            ORM_TechnologiesTextBox.Text      = model.ORM_Technologies;
            UITextBox.Text = model.UI;
        }
コード例 #5
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            try
            {
                TehnicalModel TechDe = new TehnicalModel()
                {
                    Programming_Languages = Programming_LanguagesTextBox.Text,
                    ORM_Technologies      = ORM_TechnologiesTextBox.Text,
                    UI        = UITextBox.Text,
                    Databases = DatabasesTextBox.Text,
                };
                TechnicalAccess projectdata = new TechnicalAccess();
                string          SaveTe      = projectdata.SaveTech(TechDe);
                if (SaveTe.Equals("Success"))

                {
                    Response.Write("<script>alert('Details have been saved successfully');</script>");
                }
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert(('Please enter the values:' " + ex.Message + ");</script>");
            }
        }
コード例 #6
0
        public TehnicalModel GetTechnical(int employeeid)
        {
            TehnicalModel details = new TehnicalModel();

            sqlConnection          = OpenConnection();
            sqlCommand             = new SqlCommand();
            sqlCommand.Connection  = sqlConnection;
            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.CommandText = "uspGetTechnicalDetails";
            sqlCommand.Parameters.Add("@EmployeeID", SqlDbType.Int).Value = Convert.ToInt32(employeeid);
            SqlDataReader Technicaldatareader = sqlCommand.ExecuteReader();

            while (Technicaldatareader.Read())
            {
                details.EmployeeID            = Technicaldatareader.GetInt32(Technicaldatareader.GetOrdinal("EmployeeID"));
                details.Programming_Languages = Technicaldatareader.GetString(Technicaldatareader.GetOrdinal("Programming_Languages"));
                details.Databases             = Technicaldatareader.GetString(Technicaldatareader.GetOrdinal("Databases"));
                details.ORM_Technologies      = Technicaldatareader.GetString(Technicaldatareader.GetOrdinal("ORM_Technologies"));
                details.UI = Technicaldatareader.GetString(Technicaldatareader.GetOrdinal("UI"));
            }
            CloseConncetion(sqlConnection);

            return(details);
        }