Example #1
0
 public LP_Voucher_BLL(LP_Voucher_Property _objvoucherproperty)
 {
     objvoucherproperty = _objvoucherproperty;
 }
        public JsonResult AddUpdate(LP_Voucher_ViewModel objVoucher)
        {
            try
            {
                bool flag = false;
                objvouchermaster              = new LP_Voucher_Property();
                objvouchermaster.idx          = objVoucher.idx;
                objvouchermaster.voucher_no   = objVoucher.voucher_no;
                objvouchermaster.vendor_id    = objVoucher.vendor_id;
                objvouchermaster.voucher_type = objVoucher.voucher_type;
                objvouchermaster.date_created = objVoucher.date_created;
                if (objVoucher.description != null)
                {
                    objvouchermaster.description = objVoucher.description;
                }
                else
                {
                    objvouchermaster.description = "";
                }
                // objMRNProperty.description = objMRN.description.Length>0? objMRN.description : "";

                //  objMRNProperty.paidDate = ;// objMRN.paidDate;

                objvouchermaster.DetailData = Helper.ToDataTable <LP_Voucher_Details>(objVoucher.VoucherDetails);
                if (objVoucher.idx > 0)
                {
                    ////objMRNProperty.creationDate = DateTime.Now;
                    ////objMRNProperty.visible = 1;
                    ////// objMRNProperty.status = "0";
                    ////objMRNProperty.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    //objvouchermaster.creationDate = DateTime.Now;
                    //objvouchermaster.lastModificationDate = DateTime.Now;
                    //objvouchermaster.lastModifiedByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    ////  objMRNVM_Property.createdByUserIdx = DateTime.Now; ;
                    //objvouchermaster.TableName = "MRNDetails";
                    //objMRNBll = new LP_MRN_BLL(objvouchermaster);
                    //flag = objMRNBll.Insert();
                    //update
                }
                else
                {
                    //add

                    objvouchermaster.status            = 0;
                    objvouchermaster.account_cheque_no = objVoucher.account_cheque_no;
                    objvouchermaster.bank_id           = objVoucher.bank_id;
                    objvouchermaster.payment_type      = objVoucher.payment_type;
                    objvouchermaster.voucher_amount    = objVoucher.voucher_amount;

                    objvouchermaster.u_id = Convert.ToInt16(Session["UID"].ToString());

                    objvouchermaster.TableName = "VoucherDetails";
                    objVoucherBll = new LP_Voucher_BLL(objvouchermaster);
                    flag          = objVoucherBll.Insert();
                }
                return(Json(new { data = "", success = flag, msg = flag == true ? "Successfull" : "Failed", statuscode = flag == true ? 200 : 401 }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
            }
        }
Example #3
0
 public LP_Voucher_DAL(LP_Voucher_Property _objvchrproperty)
 {
     objVoucherProperty = _objvchrproperty;
 }