public List<BOFee> LoadClassFee(int userid, string hostCode) { DAGradeSystem pDAL = new DAGradeSystem(); try { var dtCategories = pDAL.LoadGradeSystem(userid, hostCode); var grades = new List<BOFee>(); BOFee grade = null; foreach (DataRow item in dtCategories.Rows) { grade = new BOFee(); int classId; int.TryParse(item["ClassId"].ToString(), out classId); grade.ClassId = classId; grade.TermFees = item["TermFees"].ToString(); grade.TotalFee = item["TotalFee"].ToString(); grade.Id = Convert.ToInt32(item["Id"]); grades.Add(grade); } return grades; } catch { throw; } finally { pDAL = null; } }
protected void btnsubmit_Click(object sender, EventArgs e) { try { var classFee = new BOFee(); int catid = 0; if (ViewState["classfeeid"] != null) catid = Convert.ToInt16(ViewState["classfeeid"]); classFee.Id = catid; classFee.HostCode = "DEMO"; classFee.UserId = 1; classFee.ClassId = Convert.ToInt16(drpclass.SelectedValue); string termFees = ""; foreach (Control divCtrl in divterms.Controls) { var txtControls = divCtrl.Controls.OfType<TextBox>(); if (txtControls == null) continue; foreach (TextBox textBox in divCtrl.Controls.OfType<TextBox>()) { termFees += textBox.Text + ","; } } classFee.Status = "A"; var isInserted = (new BLGradeSystem()).InsertClassFee(classFee); if (isInserted == 1) { LoadClassFee(); GradeUpdatePanel.Update(); ResetControls(); lblErrorMsg.ForeColor = System.Drawing.Color.Red; lblErrorMsg.Text = "Class fee inserted successfully."; } else { lblErrorMsg.ForeColor = System.Drawing.Color.Red; lblErrorMsg.Text = "Process failed. Please try again."; } } catch (Exception ex) { lblErrorMsg.ForeColor = System.Drawing.Color.Red; lblErrorMsg.Text = "Unable to save data."; } }
public int InsertClassFee(BOFee fee) { SqlParameter[] sqlParams = new SqlParameter[12]; sqlParams[0] = new SqlParameter("@ClassId", fee.ClassId); sqlParams[1] = new SqlParameter("@TermFees", fee.TermFees); sqlParams[5] = new SqlParameter("@Status", fee.Status); sqlParams[6] = new SqlParameter("@HostCode", fee.HostCode); sqlParams[7] = new SqlParameter("@RecordId", fee.Id); sqlParams[8] = new SqlParameter("@CreatedDate", DateTime.Now); sqlParams[9] = new SqlParameter("@ModifiedDate", DateTime.Now); sqlParams[10] = new SqlParameter("@CreatedBy", fee.UserId); sqlParams[11] = new SqlParameter("@ModifiedBy", fee.UserId); return cmnDA.ExecuteNonQuery("pr_ClassFee_AddOrUpdate", sqlParams); }
public int InsertClassFee(BOFee termFee) { DAGradeSystem pDAL = new DAGradeSystem(); try { return pDAL.InsertClassFee(termFee); } catch { throw; } finally { pDAL = null; } }