Esempio n. 1
0
        public ActionResult Fees()
        {
            FeesMaster fees = new FeesMaster();

            fees.LoggedInUser = long.Parse("0" + Request.Cookies["UserId"].Value);
            List <FeesMaster> feesList = feesBl.CRUDFees(fees, "L");

            return(View(feesList));
        }
Esempio n. 2
0
        public JsonResult GetFeesDetailsByCourseId(int id)
        {
            FeesMaster fees = new FeesMaster();

            try
            {
                fees.CourseId = id;
                fees          = feesBl.CRUDFees(fees, "L").FirstOrDefault();
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Json(fees, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
 public JsonResult Delete(int ID)
 {
     try
     {
         FeesMaster fees = new FeesMaster();
         fees.FeesId = ID;
         if (fees.FeesId > 0)
         {
             feesBl.CRUDFees(fees, "D");
             TempData["SuccessMessage"] = "You have removed one fees record successfully";
         }
     }
     catch (Exception ex)
     { }
     return(Json(new { Success = "Success" }, JsonRequestBehavior.AllowGet));
 }
Esempio n. 4
0
        public List <FeesMaster> CRUDFees(FeesMaster objCourse, string action)
        {
            List <FeesMaster> objCourseDetails = new List <FeesMaster>();

            try
            {
                DataTable dtResponse = objUserDA.CRUDFeess(objCourse, action);
                if (dtResponse != null && dtResponse.Rows.Count > 0)
                {
                    objCourseDetails = dtResponse.ConvertToListOf <FeesMaster>();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(objCourseDetails);
        }
Esempio n. 5
0
        public ActionResult AddFees(int?id)
        {
            FeesMaster objFees = new FeesMaster();

            try
            {
                FeesMaster          obj  = new FeesMaster();
                List <CourseMaster> list = new List <CourseMaster>();
                obj.LoggedInUser = long.Parse("0" + Request.Cookies["UserId"].Value);
                obj.FeesId       = id ?? 0;
                if (id != null && id > 0)
                {
                    objFees = feesBl.CRUDFees(obj, "S").FirstOrDefault();
                }
                objFees.ListCourse = new SelectList(GetDropdownList(objCourseBL.CRUDCourses(new CourseMaster(), "L"), "CourseName", "CourseId", "Select Course"), "Value", "Text");
            }
            catch (Exception ex)
            {
            }
            return(View(objFees));
        }
Esempio n. 6
0
 public ActionResult AddFees(FeesMaster fees)
 {
     try
     {
         fees.LoggedInUser = long.Parse("0" + Request.Cookies["UserId"].Value);
         FeesMaster objCourseDetails = feesBl.CRUDFees(fees, (fees.FeesId > 0 ? "U" : "I")).FirstOrDefault();
         if (objCourseDetails.CRUDStatus == "success" || objCourseDetails.CourseId > 0)
         {
             TempData["SuccessMessage"] = "You have " + (fees.FeesId > 0 ? "updated" : "added") + " one fees record successfully";
             return(RedirectToAction("Fees", "Fees"));
         }
         else
         {
             TempData["ErrorMessage"] = objCourseDetails.CRUDStatus;
             return(RedirectToAction("Fees", "Fees"));
         }
     }
     catch (Exception ex)
     {
         TempData["ErrorMessage"] = ex.Message;
         return(RedirectToAction("Fees", "Fees"));
     }
 }
Esempio n. 7
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(dtDate.Text))
                {
                    MessageBox.Show("Please Select the Date!");
                    dtDate.Focus();
                    return;
                }
                else
                {
                    DataTable dt = new DataTable();
                    dt = ((DataView)dgFeeDetails.ItemsSource).ToTable();
                    if (dt.Rows.Count > 0)
                    {
                        var FeeMst = (from x in db.FeesMasters where x.XLFileName == "Arrear Entry" && x.FeeDate == dtDate.SelectedDate select x).FirstOrDefault();

                        if (FeeMst != null)
                        {
                            if (MessageBox.Show("This Month Arrear Details are already in DB, Do You want to Save Once Again ?", "Save Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                            {
                                db.FeesMasters.Remove(FeeMst);
                                db.SaveChanges();

                                var fdtl = (from x in db.FeesDetails where x.FeeId == FeeMst.FeeId select x).ToList();
                                if (fdtl != null)
                                {
                                    db.FeesDetails.RemoveRange(db.FeesDetails.Where(x => x.FeeId == FeeMst.FeeId));
                                    db.SaveChanges();
                                }
                            }
                        }
                        FeesMaster FeesMst = new FeesMaster
                        {
                            BankId        = 0,
                            FeeDate       = Convert.ToDateTime(dtDate.SelectedDate).Date,
                            XLFileName    = "Arrear Entry",
                            XLPassword    = "",
                            UpdatedStatus = "Not Updated",
                        };
                        db.FeesMasters.Add(FeesMst);
                        db.SaveChanges();

                        var sFid = db.FeesMasters.Max(x => x.FeeId).ToString();

                        List <FeesDetail> lstFeesDetls = new List <FeesDetail>();
                        progressBar1.Minimum    = 0;
                        progressBar1.Maximum    = dt.Rows.Count;
                        progressBar1.Visibility = Visibility.Visible;
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            progressBar1.Value = i;
                            System.Windows.Forms.Application.DoEvents();
                            FeesDetail FeesDtl = new FeesDetail
                            {
                                FeeId           = Convert.ToInt32(sFid),
                                MemberCode      = Convert.ToDecimal(dt.Rows[i]["MEMBERCODE"]),
                                TotalAmount     = Convert.ToDecimal(dt.Rows[i]["TOTALAMOUNT"]),
                                AmountBF        = Convert.ToDecimal(dt.Rows[i]["AMOUNTBF"]),
                                AmountIns       = 0,
                                AmtSubs         = Convert.ToDecimal(dt.Rows[i]["SUBS"]),
                                Dept            = "",
                                UpdatedStatus   = "Not Updated",
                                FeeYear         = Convert.ToInt32(Convert.ToDateTime(dtDate.SelectedDate).Year),
                                FeeMonth        = Convert.ToInt32(Convert.ToDateTime(dtDate.SelectedDate).Month),
                                Reason          = "",
                                IsUnPaid        = false,
                                IsNotMatch      = false,
                                MemberId        = Convert.ToDecimal(dt.Rows[i]["MEMBERID"]),
                                Status          = "Arrear Entry",
                                TotalMonthsPaid = Convert.ToInt32(dt.Rows[i]["TOTALMONTHSPAID"])
                            };
                            lstFeesDetls.Add(FeesDtl);
                        }

                        if (lstFeesDetls != null)
                        {
                            db.FeesDetails.AddRange(lstFeesDetls);
                            db.SaveChanges();

                            MessageBox.Show("Details Saved Successfull!");
                            FormNew();
                            lstArrearEntry.Clear();
                            dgFeeDetails.ItemsSource = null;
                            dtDate.Text = "";
                        }
                    }
                    else
                    {
                        MessageBox.Show("No Record Found!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }