protected void btnSend_Click(object sender, EventArgs e) { try { string[] to = txtTo.Text.Split(';'); foreach (string emailAdd in to) { if (!string.IsNullOrEmpty(emailAdd)) { SendEmail(emailAdd); } } txtTo.Text = ""; txtSubject.Text = ""; txtMessage.Text = ""; lblSent.Text = "Message sent."; MessagePopUp.Show(); } catch { lblSent.Text = "Message failed."; MessagePopUp.Show(); } }
//Link Button #region [Link Button] protected void linkbtnView_Click(object sender, EventArgs e) { try { lock (this) { EWA_Messages ObjEWA = new EWA_Messages(); DL_Messages ObjDL = new DL_Messages(); LinkButton lnkBtnId = (LinkButton)sender; GridViewRow grdrow = lnkBtnId.NamingContainer as GridViewRow; string MessageId = GrdViewAnnouncement.DataKeys[grdrow.RowIndex].Values["MessageId"].ToString(); ObjEWA.MessageId = MessageId; ObjEWA.Action = "FetchAttachment"; dsAttachment = ObjDL.FetchAttachment(ObjEWA); //GrdAttachement.DataSource = dsAttachment; //GrdAttachement.DataBind(); lblFrom.Text = GrdViewAnnouncement.DataKeys[grdrow.RowIndex].Values["Sender"].ToString(); lblSubject.Text = GrdViewAnnouncement.DataKeys[grdrow.RowIndex].Values["Subject"].ToString(); txtMessage.Text = GrdViewAnnouncement.DataKeys[grdrow.RowIndex].Values["MessageContent"].ToString(); txtMessage.Enabled = false; MessagePopUp.Show(); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Link Button #region [Link Button] protected void linkbtnView_Click(object sender, EventArgs e) { try { lock (this) { EWA_Messages ObjEWA = new EWA_Messages(); DL_Messages ObjDL = new DL_Messages(); LinkButton lnkBtnId = (LinkButton)sender; GridViewRow grdrow = lnkBtnId.NamingContainer as GridViewRow; string MessageId = GrdViewAnnouncement.DataKeys[grdrow.RowIndex].Values["MessageId"].ToString(); ObjEWA.MessageId = MessageId; ObjEWA.Action = "FetchAttachment"; dsAttachment = ObjDL.FetchAttachment(ObjEWA); //GrdAttachement.DataSource = dsAttachment; //GrdAttachement.DataBind(); lblFrom.Text = GrdViewAnnouncement.DataKeys[grdrow.RowIndex].Values["Sender"].ToString(); // lblSubject.Text = GrdViewAnnouncement.DataKeys[grdrow.RowIndex].Values["Subject"].ToString(); string URL1 = GrdViewAnnouncement.DataKeys[grdrow.RowIndex].Values["Subject"].ToString(); if (URL1.StartsWith("https://www") || URL1.StartsWith("http://www")) { lnkbtnViewSubjectClick.Text = URL1; lnkbtnViewSubjectClick.Visible = true; lnkbtnViewSubjectClick.ForeColor = System.Drawing.Color.Blue; } else { lblSubject.Text = URL1; lblSubject.Visible = true; } txtMessage.Text = GrdViewAnnouncement.DataKeys[grdrow.RowIndex].Values["MessageContent"].ToString(); txtMessage.Enabled = false; MessagePopUp.Show(); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
protected void lnkBtnStudentName_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; //Get the row that contains this button GridViewRow gvr = (GridViewRow)btn.NamingContainer; string ReceiptNO = grdFees.DataKeys[gvr.RowIndex].Values[0].ToString(); string FeesID = grdFees.DataKeys[gvr.RowIndex].Values[1].ToString(); string TransDate = grdFees.DataKeys[gvr.RowIndex].Values[2].ToString(); lblReceiptNo.Text = ReceiptNO; lblReceiptNo1.Text = ReceiptNO; Label1.Text = txtName.Text; lblDate.Text = TransDate; //todaysdate; lblDate1.Text = TransDate; //todaysdate; float _tamount = db.getDb_Value("select sum(Amount) from tblFeesDetails where FeesId =" + FeesID + " "); float _pamount = db.getDb_Value("select isnull(sum(paidamount),0) from tblstudentfeespaid " + " where studentid =" + txtStudentId.Text + ""); lblReceiptNo.Text = ReceiptNO; lblReceiptNo1.Text = ReceiptNO; Label1.Text = txtName.Text; string RouteId = db.getDbstatus_Value("select isnull((select routeid from tblStudentRouteAssign where UserCode = " + txtStudentId.Text + "),0)"); float _pamount_bus = db.getDb_Value("select isnull((select sum(paidamount) from tblStudentBusFeesPaid where StudentId=" + txtStudentId.Text + "" + " and Studentrouteid=" + RouteId + "),0)"); float _tamount_bus = db.getDb_Value("select isnull((select amount from tblroute where RouteId=" + RouteId + "),0)"); _tamount = _tamount + _tamount_bus; lblTotalFees_Footer.Text = lblTotalFees_Footer1.Text = _tamount.ToString(); _pamount = _pamount + _pamount_bus; lblPendingFees_Footer.Text = lblPendingFees_Footer1.Text = (_tamount - _pamount).ToString(); string query = "select remark Particular,'First/Second Term' Term,(select amount from tblfeesdetails where feesdetailsid=tblStudentFeesPaid.feesdetailsid) 'Total Fees',PaidAmount'Received Fees',PendingAmount 'Due Fees'" + " from tblStudentFeesPaid where studentid='" + txtStudentId.Text + "' and GroupReceiptNo=" + ReceiptNO + "" + " union all " + "select remark Particular,'First/Second Term' Term,TotalAmount 'Total Fees',PaidAmount'Received Fees',PendingAmount 'Due Fees'" + " from tblStudentBusFeesPaid where studentid='" + txtStudentId.Text + "' and ReceiptNo=" + ReceiptNO + ""; DataTable gridDT = db.Displaygrid(query); DataTable gridDT1 = new DataTable(); gridDT1.Columns.Add("Particular"); gridDT1.Columns.Add("Term"); gridDT1.Columns.Add("Total Fees"); gridDT1.Columns.Add("Received Fees"); gridDT1.Columns.Add("Due Fees"); double TF = 0.00, RF = 0.00, DF = 0.00; DataRow dr; for (int i = 0; i < gridDT.Rows.Count; i++) { dr = gridDT1.NewRow(); dr[0] = gridDT.Rows[i]["Particular"].ToString(); dr[1] = gridDT.Rows[i]["Term"].ToString(); dr[2] = gridDT.Rows[i]["Total Fees"].ToString(); dr[3] = gridDT.Rows[i]["Received Fees"].ToString(); dr[4] = gridDT.Rows[i]["Due Fees"].ToString(); TF = TF + Convert.ToDouble(gridDT.Rows[i]["Total Fees"].ToString()); RF = RF + Convert.ToDouble(gridDT.Rows[i]["Received Fees"].ToString()); DF = DF + Convert.ToDouble(gridDT.Rows[i]["Due Fees"].ToString()); gridDT1.Rows.Add(dr); } dr = gridDT1.NewRow(); dr[0] = "Total"; dr[1] = ""; dr[2] = TF; dr[3] = RF; dr[4] = DF; gridDT1.Rows.Add(dr); gridHistory.DataSource = gridDT1; gridHistory.DataBind(); gridHistory1.DataSource = gridDT1; gridHistory1.DataBind(); gridHistory.Rows[gridDT1.Rows.Count - 1].Cells[0].Font.Bold = true; gridHistory.Rows[gridDT1.Rows.Count - 1].Cells[2].Font.Bold = true; gridHistory.Rows[gridDT1.Rows.Count - 1].Cells[3].Font.Bold = true; gridHistory.Rows[gridDT1.Rows.Count - 1].Cells[4].Font.Bold = true; gridHistory1.Rows[gridDT1.Rows.Count - 1].Cells[0].Font.Bold = true; gridHistory1.Rows[gridDT1.Rows.Count - 1].Cells[2].Font.Bold = true; gridHistory1.Rows[gridDT1.Rows.Count - 1].Cells[3].Font.Bold = true; gridHistory1.Rows[gridDT1.Rows.Count - 1].Cells[4].Font.Bold = true; DataTable co_br_cl = db.Displaygrid("SELECT (FirstName + ' ' + MiddleName + ' ' + LastName) AS Name,co.CourseName," + " br.BranchName,cl.ClassName,GRNo,ay.AcademicYear FROM tblStudent st inner join tblCourse co ON co.CourseId=st.CourseId " + " inner join tblBranch br ON br.BranchId=st.BranchId inner join tblClass cl ON cl.ClassId=st.ClassId" + " inner join tblAcademicYear ay ON ay.AcademicYearId=st.AcademicYearId where UserCode='" + txtStudentId.Text + "'"); //Added by Ashwini 23-sep-2020 DataTable dtClassdtls = db.Displaygrid("select tblcourse.Coursename as CourseName,tblclass.ClassName as ClassName,tblBranch.Branchname as BranchName,tblAcademicYear.AcademicYear as AcademicYear from tblFees left join tblcourse on tblcourse.CourseId=tblFees.CourseId left join tblclass on tblclass.ClassId=tblFees.classId left join tblBranch on tblBranch.BranchId = tblFees.BranchId left join tblAcademicYear on tblAcademicYear.AcademicYearId = tblFees.AcademicYearId where FeesId ='" + FeesID + "'"); lblCourse.Text = co_br_cl.Rows[0]["CourseName"].ToString(); lblCourse1.Text = lblCourse.Text; lblStd.Text = co_br_cl.Rows[0]["BranchName"].ToString(); lblStd1.Text = lblStd.Text; lblDiv.Text = co_br_cl.Rows[0]["ClassName"].ToString(); lblDiv1.Text = lblDiv.Text; lblAcademicYear.Text = co_br_cl.Rows[0]["AcademicYear"].ToString(); lblAcademicYear1.Text = lblAcademicYear.Text; // lblName.Text = co_br_cl.Rows[0]["Name"].ToString(); lblName1.Text = lblName.Text; // lblCourse.Text = co_br_cl.Rows[0]["CourseName"].ToString(); // lblCourse1.Text = lblCourse.Text; //lblAcademicYear.Text = co_br_cl.Rows[0]["AcademicYear"].ToString(); //lblAcademicYear1.Text = lblAcademicYear.Text; // lblStd.Text = co_br_cl.Rows[0]["BranchName"].ToString(); // lblStd1.Text = lblStd.Text; // lblDiv.Text = co_br_cl.Rows[0]["ClassName"].ToString(); // lblDiv1.Text = lblDiv.Text; lblGRNo.Text = co_br_cl.Rows[0]["GRNo"].ToString(); lblGRNo1.Text = lblGRNo.Text; MessagePopUp.Show(); }
//General message #region [General Message] private void Action(string strAction) { try { BL_TimeTableCreation objBl1 = new BL_TimeTableCreation(); EWA_TimeTableCreation objEWA1 = new EWA_TimeTableCreation(); objEWA1.Action = strAction; Session["strAction"] = strAction; objEWA1.ClassId = Convert.ToInt32(ddlClass.SelectedValue.ToString()); objEWA1.DayId = Convert.ToInt32(ddlDay.SelectedValue.ToString()); objEWA1.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString()); objEWA1.SubEmpId = Convert.ToInt32(ddlEmployee.SelectedValue.ToString()); objEWA1.LecNo = Convert.ToInt32(txtlectureno.Text); if (strAction == "Update" || strAction == "Delete") { objEWA1.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString()); } else { objEWA1.TimeTableId = 0; } DataSet ds = objBl1.CheckTimeTable(objEWA1); if ((ds.Tables[0].Rows.Count <= 0 && strAction == "Save") || (strAction == "Update" && ds.Tables[0].Rows.Count <= 0) || (strAction == "Update" && ds.Tables[0].Rows[0][0].ToString() == objEWA1.TimeTableId.ToString()) || strAction == "Delete") { BL_TimeTableCreation objBl2 = new BL_TimeTableCreation(); EWA_TimeTableCreation objEWA2 = new EWA_TimeTableCreation(); BL_TimeTableCreation objBl22 = new BL_TimeTableCreation(); EWA_TimeTableCreation objEWA22 = new EWA_TimeTableCreation(); objEWA22.ClassId = Convert.ToInt32(ddlClass.SelectedValue.ToString()); objEWA22.DayId = Convert.ToInt32(ddlDay.SelectedValue.ToString()); objEWA22.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString()); objEWA22.SubEmpId = Convert.ToInt32(ddlEmployee.SelectedValue.ToString()); objEWA2.LecNo = Convert.ToInt32(txtlectureno.Text); DataSet dss = objBl22.Employeetest(objEWA22); if (dss.Tables[0].Rows.Count > 0) { msgBox.ShowMessage("Already lecture assigned to teacher for that day", "Saved", UserControls.MessageBox.MessageStyle.Critical); } objEWA2.ClassId = Convert.ToInt32(ddlClass.SelectedValue.ToString()); objEWA2.DayId = Convert.ToInt32(ddlDay.SelectedValue.ToString()); objEWA2.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString()); objEWA2.SubEmpId = Convert.ToInt32(ddlEmployee.SelectedValue.ToString()); objEWA2.LecNo = Convert.ToInt32(txtlectureno.Text); if (strAction == "Update" || strAction == "Delete") { objEWA2.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString()); } else { objEWA2.TimeTableId = 0; } DataSet ds1 = objBl2.CheckTimeTable1(objEWA2); if ((ds1.Tables[0].Rows.Count <= 0 && strAction == "Save") || (strAction == "Update" && ds1.Tables[0].Rows.Count <= 0) || (strAction == "Update" && ds1.Tables[0].Rows[0][0].ToString() == objEWA1.TimeTableId.ToString()) || strAction == "Delete") { //To check Date According to Current Date DateTime CurrentDate = DateTime.Now.Date; int CurrentStartYear = CurrentDate.Year; DateTime CurrentEndYear = CurrentDate.AddYears(1); int CurrentMonth = CurrentDate.Month; BL_TimeTableCreation objBl = new BL_TimeTableCreation(); EWA_TimeTableCreation objEWA = new EWA_TimeTableCreation(); objEWA.Action = strAction; objEWA.ClassId = Convert.ToInt32(ddlClass.SelectedValue.ToString()); objEWA.DayId = Convert.ToInt32(ddlDay.SelectedValue.ToString()); objEWA.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString()); objEWA.LecNo = Convert.ToInt32(txtlectureno.Text); if (strAction == "Update" || strAction == "Delete") { objEWA.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString()); } else { objEWA.TimeTableId = 0; } objEWA.CourseId = Convert.ToInt32(ddlCourse.SelectedValue.ToString()); objEWA.BranchId = Convert.ToInt32(ddlBranch.SelectedValue.ToString()); objEWA.SubjectId = Convert.ToInt32(ddlSubject.SelectedValue.ToString()); objEWA.SubEmpId = Convert.ToInt32(ddlEmployee.SelectedValue.ToString()); objEWA.OrgId = orgId; objEWA.UserId = Session["UserCode"].ToString(); objEWA.IsActive = "True"; objEWA.LecNo = Convert.ToInt32(txtlectureno.Text); //int flag = objBL.(objEWA); int flag = objBl.TimeTableCreationAction_BL(objEWA); if (flag > 0 && flag != 2) { ClearCntrl(); DisableCntrl(); BindTimeTable(); if (strAction == "Save") { msgBox.ShowMessage("Record Saved Successfully !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull); } else if (strAction == "Update") { msgBox.ShowMessage("Record Updated Successfully !!!", "Updated", UserControls.MessageBox.MessageStyle.Successfull); } else if (strAction == "Delete") { msgBox.ShowMessage("Record Deleted Successfully !!!", "Deleted", UserControls.MessageBox.MessageStyle.Successfull); } } else if (flag > 0 && flag == 2) { if (strAction == "Save") { msgBox.ShowMessage("Sorry For that day Lecture NO Already Used!!!", "Saved", UserControls.MessageBox.MessageStyle.Critical); } else if (strAction == "Update") { msgBox.ShowMessage("Sorry For that day Lecture NO Already Used !!!", "Updated", UserControls.MessageBox.MessageStyle.Critical); } } else { if (strAction == "Save") { msgBox.ShowMessage("Unable to Save !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } else if (strAction == "Update") { msgBox.ShowMessage("Unable to Update !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } else if (strAction == "Delete") { msgBox.ShowMessage("Unable to Delete !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } } } else { MessagePopUp1.Show(); //msgBox.ShowMessage("Already Created !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); //DialogResult res = MessageBox.Show("Employee Overlap! Are You OK with Employee Overlap?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); //if (res == DialogResult.Yes) //{ // overlapEmployee(strAction); //} //if (res == DialogResult.No) //{ //} } } else { //string message = "Your request is being processed."; //System.Text.StringBuilder sb = new System.Text.StringBuilder(); //sb.Append("alert('"); //sb.Append(message); //sb.Append("');"); //ClientScript.RegisterOnSubmitStatement(this.GetType(), "alert", sb.ToString()); MessagePopUp.Show(); //DialogResult res = MessageBox.Show("Subject Overlap! Are You OK with Subject Overlap?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); //if (res == DialogResult.Yes) //{ // //MessageBox.Show("You have clicked Ok Button"); // overlapsubject(strAction); //} //if (res == DialogResult.No) //{ // //MessageBox.Show("You have clicked Cancel Button"); //} } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }