public static COMN_EducatinalBackground GetCOMN_EducatinalBackgroundByEducationalBacgroundID(int EducationalBacgroundID) { COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground(); SqlCOMN_EducatinalBackgroundProvider sqlCOMN_EducatinalBackgroundProvider = new SqlCOMN_EducatinalBackgroundProvider(); cOMN_EducatinalBackground = sqlCOMN_EducatinalBackgroundProvider.GetCOMN_EducatinalBackgroundByEducationalBacgroundID(EducationalBacgroundID); return cOMN_EducatinalBackground; }
protected void btnUpdate_Click(object sender, EventArgs e) { COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground (); cOMN_EducatinalBackground.EducationalBacgroundID= int.Parse(Request.QueryString["ID"].ToString()); cOMN_EducatinalBackground.UserID= ddlUserID.SelectedValue; cOMN_EducatinalBackground.Year= txtYear.Text; cOMN_EducatinalBackground.BoardUniversity= txtBoardUniversity.Text; cOMN_EducatinalBackground.EducationGroup= txtEducationGroup.Text; cOMN_EducatinalBackground.Major= txtMajor.Text; cOMN_EducatinalBackground.ReaultSystemID= int.Parse(ddlReaultSystemID.SelectedValue); cOMN_EducatinalBackground.Degree= txtDegree.Text; cOMN_EducatinalBackground.Result= txtResult.Text; cOMN_EducatinalBackground.Score= decimal.Parse(txtScore.Text); cOMN_EducatinalBackground.OutOf= int.Parse(txtOutOf.Text); cOMN_EducatinalBackground.AddedBy= Profile.card_id; cOMN_EducatinalBackground.AddedDate= DateTime.Now; cOMN_EducatinalBackground.ModifiedBy= Profile.card_id; cOMN_EducatinalBackground.ModifiedDate= DateTime.Now; bool resutl =COMN_EducatinalBackgroundManager.UpdateCOMN_EducatinalBackground(cOMN_EducatinalBackground); Response.Redirect("AdminDisplayCOMN_EducatinalBackground.aspx"); }
protected void btnEducationalBackgroundUpdate_Click(object sender, EventArgs e) { try { if (Session["educationalBackground"] != null) { List<COMN_EducatinalBackground> educationalBackground = new List<COMN_EducatinalBackground>(); educationalBackground = (List<COMN_EducatinalBackground>)Session["educationalBackground"]; COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground(); cOMN_EducatinalBackground.EducationalBacgroundID = int.Parse(hfEducationalBackgroundID.Value); cOMN_EducatinalBackground.UserID = hfUserID.Value; cOMN_EducatinalBackground.Year = txtYear.Text; cOMN_EducatinalBackground.BoardUniversity = txtBoardUniversity.Text; cOMN_EducatinalBackground.EducationGroup = txtEducationGroup.Text; cOMN_EducatinalBackground.Major = txtMajor.Text; cOMN_EducatinalBackground.ReaultSystemID = int.Parse(ddlReaultSystemID.SelectedValue); cOMN_EducatinalBackground.Degree = txtDegree.Text; cOMN_EducatinalBackground.Result = txtResult.Text; cOMN_EducatinalBackground.Score = decimal.Parse(txtScore.Text); cOMN_EducatinalBackground.OutOf = int.Parse(txtOutOf.Text); cOMN_EducatinalBackground.AddedBy = Profile.card_id; cOMN_EducatinalBackground.AddedDate = DateTime.Now; cOMN_EducatinalBackground.ModifiedBy = Profile.card_id; cOMN_EducatinalBackground.ModifiedDate = DateTime.Now; educationalBackground[int.Parse(hfEducationalBackgroundID.Value)] = cOMN_EducatinalBackground; Session["educationalBackground"] = educationalBackground; gvCOMN_EducatinalBackground.DataSource = educationalBackground; gvCOMN_EducatinalBackground.DataBind(); btnEducationalBackgroundAdd.Visible = true; btnEducationalBackgroundUpdate.Visible = false; } } catch (Exception ex) { } }
protected void btnEducationalBackgroundAdd_Click(object sender, EventArgs e) { if (Session["educationalBackground"] == null) { List<COMN_EducatinalBackground> educationalBackground = new List<COMN_EducatinalBackground>(); COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground(); cOMN_EducatinalBackground.UserID = Profile.card_id; cOMN_EducatinalBackground.Year = txtYear.Text; cOMN_EducatinalBackground.BoardUniversity = txtBoardUniversity.Text; cOMN_EducatinalBackground.EducationGroup = txtEducationGroup.Text; cOMN_EducatinalBackground.Major = txtMajor.Text; cOMN_EducatinalBackground.ReaultSystemID = int.Parse(ddlReaultSystemID.SelectedValue); cOMN_EducatinalBackground.ReaultSystemName = ddlReaultSystemID.SelectedItem.Text; cOMN_EducatinalBackground.Degree = txtDegree.Text; cOMN_EducatinalBackground.Result = txtResult.Text; cOMN_EducatinalBackground.Score = decimal.Parse(txtScore.Text); cOMN_EducatinalBackground.OutOf = int.Parse(txtOutOf.Text); cOMN_EducatinalBackground.AddedBy = Profile.card_id; cOMN_EducatinalBackground.AddedDate = DateTime.Now; cOMN_EducatinalBackground.ModifiedBy = Profile.card_id; cOMN_EducatinalBackground.ModifiedDate = DateTime.Now; //int resutl = COMN_EducatinalBackgroundManager.InsertCOMN_EducatinalBackground(cOMN_EducatinalBackground); //add educational background cOMN_EducatinalBackground.EducationalBacgroundID = educationalBackground.Count; educationalBackground.Add(cOMN_EducatinalBackground); Session["educationalBackground"] = educationalBackground; gvCOMN_EducatinalBackground.DataSource = Session["educationalBackground"]; gvCOMN_EducatinalBackground.DataBind(); } else { COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground(); cOMN_EducatinalBackground.UserID = Profile.card_id; cOMN_EducatinalBackground.Year = txtYear.Text; cOMN_EducatinalBackground.BoardUniversity = txtBoardUniversity.Text; cOMN_EducatinalBackground.EducationGroup = txtEducationGroup.Text; cOMN_EducatinalBackground.Major = txtMajor.Text; cOMN_EducatinalBackground.ReaultSystemID = int.Parse(ddlReaultSystemID.SelectedValue); cOMN_EducatinalBackground.Degree = txtDegree.Text; cOMN_EducatinalBackground.Result = txtResult.Text; cOMN_EducatinalBackground.Score = decimal.Parse(txtScore.Text); cOMN_EducatinalBackground.OutOf = int.Parse(txtOutOf.Text); cOMN_EducatinalBackground.AddedBy = Profile.card_id; cOMN_EducatinalBackground.AddedDate = DateTime.Now; cOMN_EducatinalBackground.ModifiedBy = Profile.card_id; cOMN_EducatinalBackground.ModifiedDate = DateTime.Now; //int resutl = COMN_EducatinalBackgroundManager.InsertCOMN_EducatinalBackground(cOMN_EducatinalBackground); //add educational background cOMN_EducatinalBackground.EducationalBacgroundID = ((List<COMN_EducatinalBackground>)Session["educationalBackground"]).Count; ((List<COMN_EducatinalBackground>)Session["educationalBackground"]).Add(cOMN_EducatinalBackground); gvCOMN_EducatinalBackground.DataSource = Session["educationalBackground"]; gvCOMN_EducatinalBackground.DataBind(); } }
private void showCOMN_EducatinalBackgroundData(int educationalBackgroundID) { try { if (Session["educationalBackground"] != null) { List<COMN_EducatinalBackground> educationalBackground = new List<COMN_EducatinalBackground>(); educationalBackground = (List<COMN_EducatinalBackground>)Session["educationalBackground"]; COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground(); cOMN_EducatinalBackground = educationalBackground[educationalBackgroundID]; //cOMN_EducatinalBackground = COMN_EducatinalBackgroundManager.GetCOMN_EducatinalBackgroundByEducationalBacgroundID(educationalBackgroundID); hfEducationalBackgroundID.Value = educationalBackgroundID.ToString(); hfUserID.Value = cOMN_EducatinalBackground.UserID == null ? Profile.card_id : cOMN_EducatinalBackground.UserID; txtYear.Text = cOMN_EducatinalBackground.Year.ToString(); txtBoardUniversity.Text = cOMN_EducatinalBackground.BoardUniversity.ToString(); txtEducationGroup.Text = cOMN_EducatinalBackground.EducationGroup.ToString(); txtMajor.Text = cOMN_EducatinalBackground.Major.ToString(); ddlReaultSystemID.SelectedValue = cOMN_EducatinalBackground.ReaultSystemID.ToString(); txtDegree.Text = cOMN_EducatinalBackground.Degree.ToString(); txtResult.Text = cOMN_EducatinalBackground.Result.ToString(); txtScore.Text = cOMN_EducatinalBackground.Score.ToString(); txtOutOf.Text = cOMN_EducatinalBackground.OutOf.ToString(); } } catch (Exception ex) { } }
private void loadEducationalBackground(string studentID) { List<COMN_EducatinalBackground> educationalBackground = new List<COMN_EducatinalBackground>(); DataSet dsEducationalBackground = COMN_EducatinalBackgroundManager.GetCOMN_UserByUserID(studentID, true); int i = 0; foreach (DataRow drEducationalBackground in dsEducationalBackground.Tables[0].Rows) { COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground(); cOMN_EducatinalBackground.EducationalBacgroundID = i++; cOMN_EducatinalBackground.UserID = drEducationalBackground["UserID"].ToString(); cOMN_EducatinalBackground.Year = drEducationalBackground["Year"].ToString(); cOMN_EducatinalBackground.BoardUniversity = drEducationalBackground["BoardUniversity"].ToString(); cOMN_EducatinalBackground.EducationGroup = drEducationalBackground["EducationGroup"].ToString(); cOMN_EducatinalBackground.Major = drEducationalBackground["Major"].ToString(); cOMN_EducatinalBackground.ReaultSystemID = int.Parse(drEducationalBackground["ReaultSystemID"].ToString()); cOMN_EducatinalBackground.ReaultSystemName = drEducationalBackground["ReaultSystemName"].ToString(); cOMN_EducatinalBackground.Degree = drEducationalBackground["Degree"].ToString(); cOMN_EducatinalBackground.Result = drEducationalBackground["Result"].ToString(); cOMN_EducatinalBackground.Score = decimal.Parse(drEducationalBackground["Score"].ToString()); cOMN_EducatinalBackground.OutOf = int.Parse(drEducationalBackground["OutOf"].ToString()); cOMN_EducatinalBackground.AddedBy = drEducationalBackground["AddedBy"].ToString(); cOMN_EducatinalBackground.AddedDate = DateTime.Parse(drEducationalBackground["AddedDate"].ToString()); cOMN_EducatinalBackground.ModifiedBy = drEducationalBackground["ModifiedBy"].ToString(); cOMN_EducatinalBackground.ModifiedDate = DateTime.Parse(drEducationalBackground["ModifiedDate"].ToString()); educationalBackground.Add(cOMN_EducatinalBackground); } Session["educationalBackground"] = educationalBackground; gvCOMN_EducatinalBackground.DataSource = educationalBackground; gvCOMN_EducatinalBackground.DataBind(); }
public static COMN_EducatinalBackground GetCOMN_UserByUserID(string UserID) { COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground(); SqlCOMN_EducatinalBackgroundProvider sqlCOMN_EducatinalBackgroundProvider = new SqlCOMN_EducatinalBackgroundProvider(); cOMN_EducatinalBackground = sqlCOMN_EducatinalBackgroundProvider.GetCOMN_EducatinalBackgroundByUserID(UserID); return cOMN_EducatinalBackground; }
public static COMN_EducatinalBackground GetCOMN_ReaultSystemByReaultSystemID(int ReaultSystemID) { COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground(); SqlCOMN_EducatinalBackgroundProvider sqlCOMN_EducatinalBackgroundProvider = new SqlCOMN_EducatinalBackgroundProvider(); cOMN_EducatinalBackground = sqlCOMN_EducatinalBackgroundProvider.GetCOMN_EducatinalBackgroundByReaultSystemID(ReaultSystemID); return cOMN_EducatinalBackground; }
public static bool UpdateCOMN_EducatinalBackground(COMN_EducatinalBackground cOMN_EducatinalBackground) { SqlCOMN_EducatinalBackgroundProvider sqlCOMN_EducatinalBackgroundProvider = new SqlCOMN_EducatinalBackgroundProvider(); return sqlCOMN_EducatinalBackgroundProvider.UpdateCOMN_EducatinalBackground(cOMN_EducatinalBackground); }
public static int InsertCOMN_EducatinalBackground(COMN_EducatinalBackground cOMN_EducatinalBackground) { SqlCOMN_EducatinalBackgroundProvider sqlCOMN_EducatinalBackgroundProvider = new SqlCOMN_EducatinalBackgroundProvider(); return sqlCOMN_EducatinalBackgroundProvider.InsertCOMN_EducatinalBackground(cOMN_EducatinalBackground); }
protected void btnAddEducationalBackground_Click(object sender, EventArgs e) { List<COMN_EducatinalBackground> educationalBackgroundColl = (List<COMN_EducatinalBackground>)Session["_educationalBackgroundColl"]; if (hfEmployeeID.Value != null) { COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground(); cOMN_EducatinalBackground.UserID = hfEmployeeID.Value.ToString(); cOMN_EducatinalBackground.Year = txtYear.Text; cOMN_EducatinalBackground.BoardUniversity = txtBoardUniversity.Text; cOMN_EducatinalBackground.EducationGroup = txtEducationGroup.Text; cOMN_EducatinalBackground.Major = txtMajor.Text; cOMN_EducatinalBackground.ReaultSystemID = int.Parse(ddlReaultSystemID.SelectedValue); cOMN_EducatinalBackground.Degree = txtDegree.Text; cOMN_EducatinalBackground.Result = txtResult.Text; if (txtScore.Text.Trim() != string.Empty) { cOMN_EducatinalBackground.Score = decimal.Parse(txtScore.Text); } else { cOMN_EducatinalBackground.Score = 0; } if (txtOutOf.Text.Trim() != string.Empty) { cOMN_EducatinalBackground.OutOf = int.Parse(txtOutOf.Text); } else { cOMN_EducatinalBackground.OutOf = 0; } string userID = Profile.card_id; cOMN_EducatinalBackground.AddedBy = userID; cOMN_EducatinalBackground.AddedDate = DateTime.Now; cOMN_EducatinalBackground.ModifiedBy = userID; cOMN_EducatinalBackground.ModifiedDate = DateTime.Now; if (hdnEducationBackground.Value == string.Empty || hdnEducationBackground.Value == "0") { int resutl = COMN_EducatinalBackgroundManager.InsertCOMN_EducatinalBackground(cOMN_EducatinalBackground); hdnEducationBackground.Value = resutl.ToString(); cOMN_EducatinalBackground.EducationalBacgroundID = resutl; lblEducationalMsg.Text = "Educational Information is saved"; lblEducationalMsg.ForeColor = System.Drawing.Color.Green; } else { cOMN_EducatinalBackground.EducationalBacgroundID = Convert.ToInt32(hdnEducationBackground.Value); COMN_EducatinalBackgroundManager.UpdateCOMN_EducatinalBackground(cOMN_EducatinalBackground); lblEducationalMsg.Text = "Educational Information is updated"; lblEducationalMsg.ForeColor = System.Drawing.Color.Green; } txtYear.Text = string.Empty; txtBoardUniversity.Text = string.Empty; txtEducationGroup.Text = string.Empty; txtMajor.Text = string.Empty; txtDegree.Text = string.Empty; txtResult.Text = string.Empty; txtScore.Text = string.Empty; txtOutOf.Text = string.Empty; hdnEducationBackground.Value = string.Empty; educationalBackgroundColl.Add(cOMN_EducatinalBackground); } else { lblEducationalMsg.Text = "Employee is not specified."; lblEducationalMsg.ForeColor = System.Drawing.Color.Red; } Session["_educationalBackgroundColl"] = educationalBackgroundColl; gv_educationalBackground.DataSource = educationalBackgroundColl; gv_educationalBackground.DataBind(); }
protected void lblSelectEducational_Click(object sender, EventArgs e) { ImageButton linkButton = new ImageButton(); linkButton = (ImageButton)sender; int index = Convert.ToInt32(linkButton.CommandArgument); COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground(); //List<COMN_EducatinalBackground> List<COMN_EducatinalBackground> educationalBackgroundColl = (List<COMN_EducatinalBackground>)Session["_educationalBackgroundColl"]; cOMN_EducatinalBackground = educationalBackgroundColl.ElementAt(index); educationalBackgroundColl.RemoveAt(index); Session["_educationalBackgroundColl"] = educationalBackgroundColl; hdnEducationBackground.Value = cOMN_EducatinalBackground.EducationalBacgroundID.ToString(); txtYear.Text = cOMN_EducatinalBackground.Year.ToString(); txtBoardUniversity.Text = cOMN_EducatinalBackground.BoardUniversity.ToString(); txtEducationGroup.Text = cOMN_EducatinalBackground.EducationGroup.ToString(); txtMajor.Text = cOMN_EducatinalBackground.Major; ddlReaultSystemID.SelectedValue = cOMN_EducatinalBackground.ReaultSystemID.ToString(); txtDegree.Text = cOMN_EducatinalBackground.Degree; txtResult.Text = cOMN_EducatinalBackground.Result; txtScore.Text = cOMN_EducatinalBackground.Score.ToString(); txtOutOf.Text = cOMN_EducatinalBackground.OutOf.ToString(); gv_educationalBackground.DataSource = educationalBackgroundColl; gv_educationalBackground.DataBind(); UpdatePanel1.Update(); }
protected void lblDeleteEducational_Click(object sender, EventArgs e) { ImageButton linkButton = new ImageButton(); linkButton = (ImageButton)sender; int index = Convert.ToInt32(linkButton.CommandArgument); COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground(); List<COMN_EducatinalBackground> educationalBackgroundColl = (List<COMN_EducatinalBackground>)Session["_educationalBackgroundColl"]; cOMN_EducatinalBackground = educationalBackgroundColl.ElementAt(index); bool result = COMN_EducatinalBackgroundManager.DeleteCOMN_EducatinalBackground(cOMN_EducatinalBackground.EducationalBacgroundID); educationalBackgroundColl.RemoveAt(index); Session["_educationalBackgroundColl"] = educationalBackgroundColl; gv_educationalBackground.DataSource = educationalBackgroundColl; gv_educationalBackground.DataBind(); UpdatePanel1.Update(); }
private void showCOMN_EducatinalBackgroundData() { COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground (); cOMN_EducatinalBackground = COMN_EducatinalBackgroundManager.GetCOMN_EducatinalBackgroundByEducationalBacgroundID(Int32.Parse(Request.QueryString["ID"])); ddlUserID.SelectedValue =cOMN_EducatinalBackground.UserID.ToString(); txtYear.Text =cOMN_EducatinalBackground.Year.ToString(); txtBoardUniversity.Text =cOMN_EducatinalBackground.BoardUniversity.ToString(); txtEducationGroup.Text =cOMN_EducatinalBackground.EducationGroup.ToString(); txtMajor.Text =cOMN_EducatinalBackground.Major.ToString(); ddlReaultSystemID.SelectedValue =cOMN_EducatinalBackground.ReaultSystemID.ToString(); txtDegree.Text =cOMN_EducatinalBackground.Degree.ToString(); txtResult.Text =cOMN_EducatinalBackground.Result.ToString(); txtScore.Text =cOMN_EducatinalBackground.Score.ToString(); txtOutOf.Text =cOMN_EducatinalBackground.OutOf.ToString(); }
public bool UpdateCOMN_EducatinalBackground(COMN_EducatinalBackground cOMN_EducatinalBackground) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateCOMN_EducatinalBackground", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@EducationalBacgroundID", SqlDbType.Int).Value = cOMN_EducatinalBackground.EducationalBacgroundID; cmd.Parameters.Add("@UserID", SqlDbType.NVarChar).Value = cOMN_EducatinalBackground.UserID; cmd.Parameters.Add("@Year", SqlDbType.NVarChar).Value = cOMN_EducatinalBackground.Year; cmd.Parameters.Add("@BoardUniversity", SqlDbType.NVarChar).Value = cOMN_EducatinalBackground.BoardUniversity; cmd.Parameters.Add("@EducationGroup", SqlDbType.NVarChar).Value = cOMN_EducatinalBackground.EducationGroup; cmd.Parameters.Add("@Major", SqlDbType.NVarChar).Value = cOMN_EducatinalBackground.Major; cmd.Parameters.Add("@ReaultSystemID", SqlDbType.Int).Value = cOMN_EducatinalBackground.ReaultSystemID; cmd.Parameters.Add("@Degree", SqlDbType.NVarChar).Value = cOMN_EducatinalBackground.Degree; cmd.Parameters.Add("@Result", SqlDbType.NVarChar).Value = cOMN_EducatinalBackground.Result; cmd.Parameters.Add("@Score", SqlDbType.Decimal).Value = cOMN_EducatinalBackground.Score; cmd.Parameters.Add("@OutOf", SqlDbType.Int).Value = cOMN_EducatinalBackground.OutOf; cmd.Parameters.Add("@ModifiedBy", SqlDbType.NVarChar).Value = cOMN_EducatinalBackground.ModifiedBy; cmd.Parameters.Add("@ModifiedDate", SqlDbType.DateTime).Value = cOMN_EducatinalBackground.ModifiedDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public COMN_EducatinalBackground GetCOMN_EducatinalBackgroundFromReader(IDataReader reader) { try { COMN_EducatinalBackground cOMN_EducatinalBackground = new COMN_EducatinalBackground ( DataAccessObject.IsNULL<int>(reader["EducationalBacgroundID"]), DataAccessObject.IsNULL<string>(reader["UserID"].ToString()), DataAccessObject.IsNULL<string>(reader["Year"]), DataAccessObject.IsNULL<string>(reader["BoardUniversity"]), DataAccessObject.IsNULL<string>(reader["EducationGroup"]), DataAccessObject.IsNULL<string>(reader["Major"]), DataAccessObject.IsNULL<int>(reader["ReaultSystemID"]), DataAccessObject.IsNULL<string>(reader["Degree"]), DataAccessObject.IsNULL<string>(reader["Result"]), DataAccessObject.IsNULL<decimal>(reader["Score"]), DataAccessObject.IsNULL<int>(reader["OutOf"]), DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]), DataAccessObject.IsNULL<string>(reader["ModifiedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["ModifiedDate"]) ); try { cOMN_EducatinalBackground.ReaultSystemName = DataAccessObject.IsNULL<string>(reader["ReaultSystemName"].ToString()); cOMN_EducatinalBackground.StudentName = DataAccessObject.IsNULL<string>(reader["StudentName"].ToString()); } catch (Exception ex) { } return cOMN_EducatinalBackground; } catch(Exception ex) { return null; } }