Ejemplo n.º 1
0
        public async Task <IActionResult> PutFeesDetail(int id, FeesDetail feesDetail)
        {
            if (id != feesDetail.FeesId)
            {
                return(BadRequest());
            }

            _context.Entry(feesDetail).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FeesDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <FeesDetail> > PostFeesDetail(FeesDetail feesDetail)
        {
            _context.FeesDetails.Add(feesDetail);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetFeesDetail", new { id = feesDetail.FeesId }, feesDetail));
        }
Ejemplo n.º 3
0
 public int Insert(FeesDetail fees)
 {
     using (SmartSchoolDataModel dataModel = new SmartSchoolDataModel())
     {
         try
         {
             dataModel.FeesDetails.Add(fees);
             dataModel.SaveChanges();
             return(fees.Id);
         }
         catch (Exception ex)
         {
             return(0);
         }
     }
 }
Ejemplo n.º 4
0
 public IResponse <ApiResponse> ManageFees(FeesDetail feesDetail)
 {
     return(BuildResponse(null, System.Net.HttpStatusCode.OK));
 }
Ejemplo n.º 5
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);
            }
        }