public static List <ATTDegreeLevel> GetDegreeLevel(int?degreeLevelId, string active) { List <ATTDegreeLevel> LstDegreeLevel = new List <ATTDegreeLevel>(); try { foreach (DataRow row in DLLDegreeLevel.GetDegreeLevel(degreeLevelId, active).Rows) { ATTDegreeLevel ObjAtt = new ATTDegreeLevel ( int.Parse(row["DEGREE_LEVEL_ID"].ToString()), row["DEGREE_LEVEL_NAME"].ToString(), (row["ACTIVE"] == System.DBNull.Value) ? "" : (string)row["ACTIVE"] ); List <ATTDegree> DegreeList = BLLDegree.GetDegree(null, ""); ObjAtt.LstDegree = DegreeList.FindAll( delegate(ATTDegree Degree) { return(ObjAtt.DegreeLevelID == Degree.DegreeLevelID); } ); LstDegreeLevel.Add(ObjAtt); } return(LstDegreeLevel); } catch (Exception ex) { throw ex; } }
public static bool SaveDegreeLevel(ATTDegreeLevel ObjAtt) { try { return(DLLDegreeLevel.SaveDegreeLevel(ObjAtt)); } catch (Exception ex) { throw ex; } }
public static bool SaveDegreeLevel(ATTDegreeLevel ObjAtt) { GetConnection Conn = new GetConnection(); OracleConnection DBConn; OracleTransaction Tran; string InsertUpdateDegreeLevel = ""; try { DBConn = Conn.GetDbConn(); Tran = DBConn.BeginTransaction(); if (ObjAtt.DegreeLevelID == 0) { InsertUpdateDegreeLevel = "SP_ADD_DEGREE_LEVEL"; } else { InsertUpdateDegreeLevel = "SP_EDIT_DEGREE_LEVEL"; } OracleParameter[] ParamArray = new OracleParameter[4]; ParamArray[0] = Utilities.GetOraParam(":p_DEGREE_LEVEL_ID", ObjAtt.DegreeLevelID, OracleDbType.Int64, ParameterDirection.InputOutput); ParamArray[1] = Utilities.GetOraParam(":p_DEGREE_LEVEL_NAME", ObjAtt.DegreeLevelName, OracleDbType.Varchar2, ParameterDirection.Input); ParamArray[2] = Utilities.GetOraParam(":p_ACTIVE", ObjAtt.Active, OracleDbType.Varchar2, ParameterDirection.Input); ParamArray[3] = Utilities.GetOraParam(":p_ENTRY_BY", ObjAtt.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(Tran, CommandType.StoredProcedure, InsertUpdateDegreeLevel, ParamArray); int DegreeLevelID = int.Parse(ParamArray[0].Value.ToString()); //if (ObjAtt.DegreeLevelID == 0) ObjAtt.DegreeLevelID = DegreeLevelID; DLLDegree.SaveDegree(ObjAtt.LstDegree, DegreeLevelID, Tran); Tran.Commit(); return(true); } catch (Exception ex) { throw ex; } finally { Conn.CloseDbConn(); } }
public static ObjectValidation Validate(ATTDegreeLevel ObjAttDL) { ObjectValidation OV = new ObjectValidation(); if (ObjAttDL.DegreeLevelName == "") { OV.IsValid = false; OV.ErrorMessage = "Degree Level Name cannot be Blank."; return(OV); } return(OV); }
protected void btnSubmit_Click(object sender, EventArgs e) { ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); List <ATTDegreeLevel> LstDL = (List <ATTDegreeLevel>)Session["LstDegreeLevel"]; int DegreeLevelID; try { if (lstDegreeLevel.SelectedIndex == -1) { DegreeLevelID = 0; } else { DegreeLevelID = LstDL[lstDegreeLevel.SelectedIndex].DegreeLevelID; } ATTDegreeLevel ObjAtt = new ATTDegreeLevel(DegreeLevelID, txtDegreeLevelName_Rqd.Text.Trim(), this.chkActiveDL.Checked == true ? "Y" : "N", user.UserName); foreach (GridViewRow row in grdDegree.Rows) { if (row.Cells[4].Text != " ") { ATTDegree LstAtt = new ATTDegree(int.Parse(row.Cells[0].Text.ToString()), int.Parse(row.Cells[1].Text.ToString()), row.Cells[2].Text, row.Cells[3].Text, row.Cells[4].Text); LstAtt.EntryBy = user.UserName; ObjAtt.LstDegree.Add(LstAtt); } } ObjectValidation OV = BLLDegreeLevel.Validate(ObjAtt); if (OV.IsValid == false) { lblStatusMessage.Text = OV.ErrorMessage; this.programmaticModalPopup.Show(); return; } for (int i = 0; i < lstDegreeLevel.Items.Count; i++) { if (lstDegreeLevel.SelectedIndex != i) { if (LstDL[i].DegreeLevelName.ToLower() == txtDegreeLevelName_Rqd.Text.Trim().ToLower()) { this.lblStatusMessage.Text = "Degree Level Name Already Exists"; this.programmaticModalPopup.Show(); return; } } } if (BLLDegreeLevel.SaveDegreeLevel(ObjAtt)) { this.lblStatusMessage.Text = "Degree Information Saved"; this.programmaticModalPopup.Show(); } if (lstDegreeLevel.SelectedIndex > -1) { LstDL[lstDegreeLevel.SelectedIndex].DegreeLevelID = ObjAtt.DegreeLevelID; LstDL[lstDegreeLevel.SelectedIndex].DegreeLevelName = txtDegreeLevelName_Rqd.Text.Trim(); LstDL[this.lstDegreeLevel.SelectedIndex].Active = (this.chkActiveDL.Checked == true ? "Y" : "N"); LstDL[lstDegreeLevel.SelectedIndex].LstDegree.Clear(); foreach (GridViewRow row in grdDegree.Rows) { if (row.Cells[4].Text.Trim() != "D") { ATTDegree att = new ATTDegree(int.Parse(row.Cells[0].Text), int.Parse(row.Cells[1].Text), row.Cells[2].Text, row.Cells[3].Text); LstDL[lstDegreeLevel.SelectedIndex].LstDegree.Add(att); } } } else { LstDL.Add(ObjAtt); } lstDegreeLevel.DataSource = LstDL; Session["LstDegreeLevel"] = LstDL; lstDegreeLevel.DataTextField = "DegreeLevelName"; lstDegreeLevel.DataValueField = "DegreeLevelID"; lstDegreeLevel.DataBind(); ClearControls(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); return; } }