public ActionResult AddEditFeeReceipt(FeeListViewModel model, string[] ids, string[] duesIDs)
        {
            int i = 0;

            string strSuccessMsg = string.Empty;
            string strErrorMsg = string.Empty;

            if (model != null && model.FeeReceipt != null)
            {
                if (string.IsNullOrEmpty(model.FeeReceipt.FeeReceiptID))
                {
                    strSuccessMsg = FeeRes.MsgAddSuccess;
                    strErrorMsg = FeeRes.MsgAddError;
                }
                else
                {
                    strSuccessMsg = FeeRes.MsgEditSuccess;
                    strErrorMsg = FeeRes.MsgEditError;
                }

                if (ids != null && ids.Count() > 0)
                {
                    i = _FeeReceiptService.AddEdit(model.FeeReceipt);

                    foreach (string id in ids)
                    {
                        FeeReceipt obj = new FeeReceipt();
                        obj.FeeReceiptID = model.FeeReceipt.FeeReceiptID;
                        obj.FeeStructureHeadDetailID = id;
                        i = _FeeReceiptService.AddEditFeeReceiptHead(obj);
                    }

                    foreach (string id in duesIDs)
                    {
                        FeeReceipt obj = new FeeReceipt();
                        obj.FeeReceiptID = model.FeeReceipt.FeeReceiptID;
                        obj.FeeHeadOptionalEntryID = id;
                        i = _FeeReceiptService.AddEditFeeReceiptHeadDue(obj);

                        FeeHeadOptionalEntry objFHOE = new FeeHeadOptionalEntry();
                        objFHOE = _FeeHeadOptionalEntryService.Get(objFHOE);
                        objFHOE.FeeHeadOptionalEntryID = id;
                        if (objFHOE != null && !string.IsNullOrEmpty(objFHOE.FeeHeadID))
                        {
                            objFHOE.Status = "Paid";
                            _FeeHeadOptionalEntryService.AddEdit(objFHOE);
                        }
                    }
                }
                else
                {
                    i = _FeeReceiptService.AddEdit(model.FeeReceipt);
                }

                if (i <= 0)
                {
                    TempData["err"] = strErrorMsg;
                }
                else
                {
                    TempData["msg"] = strSuccessMsg;
                }
            }

            return RedirectToAction("ManageFeeReceipt", "FeeReceipt");
        }
 public object GetScalar(FeeReceipt entity)
 {
     throw new NotImplementedException();
 }
        public int AddEdit(FeeReceipt entity)
        {
            int i = 0;

            User objUser = null;
            if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
                objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);

            if (entity != null && string.IsNullOrEmpty(entity.SchoolID))
            {
                if (objUser != null && !string.IsNullOrEmpty(objUser.SchoolID))
                    entity.SchoolID = objUser.SchoolID;
            }

            if (string.IsNullOrEmpty(entity.FeeReceiptID))
            {
                entity.FeeReceiptID = Utility.GeneratorUniqueId(ID_PREFIX_CONSTANTS.FEE_RECEIPT_ID_PREFIX);

                if (objUser != null && !string.IsNullOrEmpty(objUser.UserID))
                {
                    entity.CreatedByID = objUser.UserID;
                    entity.ModifiedByID = objUser.UserID;
                }
                else
                {
                    entity.CreatedByID = "1";
                    entity.ModifiedByID = "1";
                }
            }
            else
            {
                if (objUser != null && !string.IsNullOrEmpty(objUser.UserID))
                    entity.ModifiedByID = objUser.UserID;
                else
                    entity.ModifiedByID = "1";
            }

            string[] addParams = { FeeReceipt_Constant.FEE_RECEIPT_ID,
                                    FeeReceipt_Constant.SCHOOL_ID,
                                    FeeReceipt_Constant.AY_ID,
                                    FeeReceipt_Constant.CLASS_ID,
                                    FeeReceipt_Constant.SECTION_ID,
                                    FeeReceipt_Constant.BATCH_ID,
                                    FeeReceipt_Constant.STUDENT_ID,
                                    FeeReceipt_Constant.RECEIPT_NO,
                                    FeeReceipt_Constant.RECEIPT_DATE,
                                    FeeReceipt_Constant.FEE_UP_TO,
                                    FeeReceipt_Constant.MODE_OF_PAYMENT,
                                    FeeReceipt_Constant.CASH_ACCOUNT,
                                    FeeReceipt_Constant.BANK_ACCOUNT,
                                    FeeReceipt_Constant.CHECK_DD_NO,
                                    FeeReceipt_Constant.CHECK_DD_DATE,
                                    FeeReceipt_Constant.FINE_AMOUNT,
                                    FeeReceipt_Constant.CONCESSION_AMOUNT,
                                    FeeReceipt_Constant.SERVICE_TAX_AMOUNT,
                                    FeeReceipt_Constant.PAID_AMOUNT,
                                    FeeReceipt_Constant.REMARKS,
                                    FeeReceipt_Constant.CREATED_BY_ID,
                                    FeeReceipt_Constant.MODIFIED_BY_ID
                                    };

            i = _FeeReceiptRepository.ExecuteNonQuery(entity, addParams, FeeReceipt_Constant.SPROC_FEE_RECEIPTS_UPS);

            return i;
        }
 public FeeReceipt GetFeeReceiptHeadDue(FeeReceipt entity)
 {
     string[] addParams = { FeeReceipt_Constant.FEE_RECEIPT_HEAD_DUE_ID };
     return _FeeReceiptRepository.Get(entity, addParams, FeeReceipt_Constant.SPROC_FEE_RECEIPTS_HEADS_DUES_SEL);
 }
 public IEnumerable<FeeReceipt> GetAllFeeReceiptHeadDue(FeeReceipt entity)
 {
     string[] addParams = { Constants.PAGEINDEX, Constants.PAGESIZE, Constants.SORTEXP, FeeReceipt_Constant.FEE_RECEIPT_ID };
     return _FeeReceiptRepository.GetAll(entity, addParams, FeeReceipt_Constant.SPROC_FEE_RECEIPTS_HEADS_DUES_LSTALL);
 }
        public IEnumerable<FeeReceipt> GetAll(FeeReceipt entity)
        {
            User objUser = null;
            if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
                objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);

            if (objUser != null && !string.IsNullOrEmpty(objUser.SchoolID))
                entity.SchoolID = objUser.SchoolID;

            string[] addParams = { Constants.PAGEINDEX, Constants.PAGESIZE, Constants.SORTEXP, FeeReceipt_Constant.SCHOOL_ID };
            return _FeeReceiptRepository.GetAll(entity, addParams, FeeReceipt_Constant.SPROC_FEE_RECEIPTS_LSTALL);
        }
        public int DeleteFeeReceiptHeadDue(FeeReceipt entity)
        {
            int i = 0;

            string[] addParams = { FeeReceipt_Constant.FEE_RECEIPT_HEAD_DUE_ID };
            i = _FeeReceiptRepository.ExecuteNonQuery(entity, addParams, FeeReceipt_Constant.SPROC_FEE_RECEIPTS_HEADS_DUES_DEL);

            return i;
        }
        public int AddEditFeeReceiptHeadDue(FeeReceipt entity)
        {
            int i = 0;

            User objUser = null;
            if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
                objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);

            if (entity != null && string.IsNullOrEmpty(entity.SchoolID))
            {
                if (objUser != null && !string.IsNullOrEmpty(objUser.SchoolID))
                    entity.SchoolID = objUser.SchoolID;
            }

            if (string.IsNullOrEmpty(entity.FeeReceiptHeadDueID))
            {
                entity.FeeReceiptHeadDueID = Utility.GeneratorUniqueId(ID_PREFIX_CONSTANTS.FEE_RECEIPT_HEAD_DUE_ID_PREFIX);

                if (objUser != null && !string.IsNullOrEmpty(objUser.UserID))
                {
                    entity.CreatedByID = objUser.UserID;
                    entity.ModifiedByID = objUser.UserID;
                }
                else
                {
                    entity.CreatedByID = "1";
                    entity.ModifiedByID = "1";
                }
            }
            else
            {
                if (objUser != null && !string.IsNullOrEmpty(objUser.UserID))
                    entity.ModifiedByID = objUser.UserID;
                else
                    entity.ModifiedByID = "1";
            }

            string[] addParams = { FeeReceipt_Constant.FEE_RECEIPT_HEAD_DUE_ID,
                                    FeeReceipt_Constant.FEE_RECEIPT_ID,
                                    FeeReceipt_Constant.FEE_HEAD_OPTIONAL_ENTRY_ID,
                                    FeeReceipt_Constant.CREATED_BY_ID,
                                    FeeReceipt_Constant.MODIFIED_BY_ID
                                    };

            i = _FeeReceiptRepository.ExecuteNonQuery(entity, addParams, FeeReceipt_Constant.SPROC_FEE_RECEIPTS_HEADS_DUES_UPS);

            return i;
        }