protected void GrdUploadDocument_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { string[] confirmValue = Request.Form["confirm_value"].Split(','); if (confirmValue[confirmValue.Length - 1] == "Yes") { EWA_UploadDocument ObjEWA = new EWA_UploadDocument(); BL_UploadDocument ObjBL = new BL_UploadDocument(); ObjEWA.Action = "DeleteUploadDocument"; ObjEWA.UploadDocReceiptId = GrdUploadDocument.DataKeys[e.RowIndex].Values["UploadDocReceiptId"].ToString(); ObjBL.DeleteUploadDocument_BL(ObjEWA); BindGridView(); } } catch (Exception ex) { } }
//Send protected void btnSend_Click(object sender, EventArgs e) { try { EWA_UploadDocument ObjEWA = new EWA_UploadDocument(); BL_UploadDocument ObjBL = new BL_UploadDocument(); ObjEWA.Action = "FetchStudent"; ObjEWA.OrgId = Session["OrgId"].ToString(); ObjEWA.CourseId = ddlCourse.SelectedValue.ToString(); ObjEWA.BranchId = ddlBranch.SelectedValue.ToString(); ObjEWA.ClassId = ddlClass.SelectedValue.ToString(); //ObjEWA.DivisionId = ddlDivision.SelectedValue.ToString(); SqlCommand cmd1 = new SqlCommand(" SELECT s.UserCode as 'StudentId' FROM tblStudent s where s.CourseId='"+ ddlCourse.SelectedValue.ToString() + "' and s.ClassId='" + ddlClass.SelectedValue.ToString() + "' and s.BranchId='" + ddlBranch.SelectedValue.ToString() + "' and OrgId='" + Session["OrgId"].ToString() + "'", cn); SqlDataAdapter adp1 = new SqlDataAdapter(); DataSet ds1 = new DataSet(); adp1.SelectCommand = cmd1; adp1.Fill(ds1); // DataSet ds = ObjBL.StudentBind_BL(ObjEWA); if (ds1 == null) { return; } ObjEWA.StudentDataTable = ds1.Tables[0]; ObjEWA.Action = "SaveUploadDocument"; ObjEWA.FacultyId = Session["UserCode"].ToString(); ObjEWA.MessageContent = txtMessage.Text; ObjEWA.UploadPurpose = Convert.ToInt32(rbtnPurpose.SelectedValue); if (rbtnPurpose.SelectedItem.Text.Equals("Home Work/Assignment")) { ObjEWA.Subject = DDSubject.SelectedValue.ToString(); } else { ObjEWA.Subject = txtSubject.Text; } int fileLengthInKB = 0; if (flpUploadFile.HasFile) { int length = flpUploadFile.PostedFile.ContentLength; ObjEWA.Data = new byte[length]; ObjEWA.FileName = flpUploadFile.PostedFile.FileName.ToString(); ObjEWA.ContentType = flpUploadFile.PostedFile.ContentType; fileLengthInKB = flpUploadFile.PostedFile.ContentLength / 1024; HttpPostedFile file = flpUploadFile.PostedFile; file.InputStream.Read(ObjEWA.Data, 0, length); } else { ObjEWA.Data = null; ObjEWA.FileName = ""; ObjEWA.ContentType = ""; } if (fileLengthInKB > 1024) { msgBox.ShowMessage("Document should be less than or equal to 1MB !!!", "Information", UserControls.MessageBox.MessageStyle.Successfull); } else { int flag = ObjBL.UploadDocument_BL(ObjEWA); msgBox.ShowMessage("Document Upload Successfully !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull); clear(); } } catch (Exception ex) { msgBox.ShowMessage("Unable to Save !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull); } }