private void CreateBatch(VmStudentRegistration objbatch) { try { long result = 1; objbatch.batchname = txtbatchname.Text.Trim(); objbatch.batchyearf = Convert.ToInt32(ddlyearf.SelectedValue); objbatch.batchyeart = Convert.ToInt32(ddlyeart.SelectedValue); objbatch.batchyearName = ddlyearf.Text.Trim() + "-" + ddlyeart.Text.Trim(); objbatch.classname = ddlclass.SelectedValue.Trim(); objbatch.batchremarks = txtbatchremarks.Text.Trim(); if (objbatch.batchyearf > objbatch.batchyeart) { string label = "Invalid Year Selection"; lblyearcheck.Visible = true; lblyearcheck.Text = label.ToString(); } else { result = CreateBatchBLL.SaveYearBatch(objbatch); alertbatch1.Visible = false; alertbatch2.Visible = true; clearfieldsBatch(); } } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } }
private void checkbatch(VmStudentRegistration objbatch) { try { Hashtable ht = new Hashtable(); ht.Add("SectionName", objbatch.batchname); ht.Add("BatchYearName", objbatch.batchyearName); ht.Add("ClassName", objbatch.classname); DataTable dtTable = CreateBatchBLL.checkbatchnames(ht); if (dtTable.Rows.Count > 0) { //string result = "This record already exists!"; // lblbatchcheck.Visible = true; // lblbatchcheck.Text = result.ToString(); alertbatch1.Visible = true; alertbatch2.Visible = false; } else { CreateBatch(objbatch); } } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } }