public string GetSupplierCreditNoteDetails(string ID)
 {
     try
     {
         SupplierCreditNoteViewModel supplierCreditNoteObj = Mapper.Map <SupplierCreditNote, SupplierCreditNoteViewModel>(_supplierCreditBusines.GetSupplierCreditNoteDetails(ID != null && ID != "" ? Guid.Parse(ID) : Guid.Empty));
         return(JsonConvert.SerializeObject(new { Result = "OK", Records = supplierCreditNoteObj }));
     }
     catch (Exception ex)
     {
         AppConstMessage cm = c.GetMessage(ex.Message);
         return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message }));
     }
 }
        public ActionResult Index(string id)
        {
            SupplierCreditNoteViewModel scn = null;

            try
            {
                AppUA _appUA = Session["AppUA"] as AppUA;
                ViewBag.Currentdate = _appUA.DateTime.ToString("dd-MMM-yyyy");
                ViewBag.value       = id;

                scn = new SupplierCreditNoteViewModel();
                List <SelectListItem>     selectListItem = new List <SelectListItem>();
                List <SuppliersViewModel> suppList       = Mapper.Map <List <Supplier>, List <SuppliersViewModel> >(_supplierBusiness.GetAllSuppliers());
                foreach (SuppliersViewModel supp in suppList)
                {
                    selectListItem.Add(new SelectListItem
                    {
                        Text     = supp.CompanyName,
                        Value    = supp.ID.ToString(),
                        Selected = false
                    });
                }
                scn.SupplierList = selectListItem;

                scn.CompaniesList = new List <SelectListItem>();
                selectListItem    = new List <SelectListItem>();
                List <CompaniesViewModel> companiesList = Mapper.Map <List <Companies>, List <CompaniesViewModel> >(_companiesBusiness.GetAllCompanies());
                foreach (CompaniesViewModel cvm in companiesList)
                {
                    selectListItem.Add(new SelectListItem
                    {
                        Text     = cvm.Name,
                        Value    = cvm.Code.ToString(),
                        Selected = false
                    });
                }
                scn.CompaniesList = selectListItem;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(View(scn));
        }
        public string InsertUpdateSupplierCreditNote(SupplierCreditNoteViewModel _supplierCreditNoteObj)
        {
            try
            {
                object result = null;
                AppUA  _appUA = Session["AppUA"] as AppUA;
                _supplierCreditNoteObj.commonObj             = new CommonViewModel();
                _supplierCreditNoteObj.commonObj.CreatedBy   = _appUA.UserName;
                _supplierCreditNoteObj.commonObj.CreatedDate = _appUA.DateTime;
                _supplierCreditNoteObj.commonObj.UpdatedBy   = _appUA.UserName;
                _supplierCreditNoteObj.commonObj.UpdatedDate = _appUA.DateTime;

                result = _supplierCreditBusines.InsertUpdateSupplierCreditNote(Mapper.Map <SupplierCreditNoteViewModel, SupplierCreditNote>(_supplierCreditNoteObj));
                return(JsonConvert.SerializeObject(new { Result = "OK", Records = result }));
            }
            catch (Exception ex)
            {
                AppConstMessage cm = c.GetMessage(ex.Message);
                return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message }));
            }
        }
        public string GetCreditNoteAmount(string CreditID, string SupplierID)
        {
            SupplierCreditNoteViewModel CreditNote = Mapper.Map <SupplierCreditNote, SupplierCreditNoteViewModel>(_supplierCreditNotesBusiness.GetCreditNoteAmount(Guid.Parse(CreditID), Guid.Parse(SupplierID)));

            return(JsonConvert.SerializeObject(new { Result = "OK", Records = CreditNote }));
        }