public Import_DutyFreeRecommendationViewModel GeById(int id)
        {
            Import_DutyFreeRecommendationViewModel model = ent.Import_DutyFreeRecommendation.Select(x => new Import_DutyFreeRecommendationViewModel()
            {
                ImportId                    = x.ImportId,
                DeletedDate                 = x.DeletedDate,
                DeletedBy                   = x.DeletedBy,
                UpDatedBy                   = x.UpDatedBy,
                UpdateDate                  = x.UpdateDate,
                GA_Id                       = x.GA_Id,
                PA_Id                       = x.PA_Id,
                DonnerName                  = x.DonnerName,
                DonnerAddress               = x.DonnerAddress,
                Council_RegistrtionNumber   = x.Council_RegistrtionNumber,
                CouncilRegistrationDate     = x.CouncilRegistrationDate,
                CouncilRegistrationDateNp   = x.CouncilRegistrationDateNp,
                DiscriptionOfGoods          = x.DiscriptionOfGoods,
                InvoiceNumber               = x.InvoiceNumber,
                InvoiceDate                 = x.InvoiceDate,
                InvoiceDateNp               = x.InvoiceDateNp,
                DecisionDate                = x.DecisionDate,
                DecisionDateNp              = x.DecisionDateNp,
                TotalAmountForieignCurrency = x.TotalAmountForieignCurrency,
                TotalAmountNepaliCurrency   = x.TotalAmountNepaliCurrency,
                Remarks                     = x.Remarks,
                CreatedDate                 = DateTime.Now,
                CreatedBy                   = x.CreatedBy
            }).Where(x => x.ImportId == id).FirstOrDefault();

            return(model);
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            Import_DutyFreeRecommendationViewModel model = new Import_DutyFreeRecommendationViewModel();

            model.Import_DutyFreeRecommendationViewModelList = pro.GetList();
            return(View(model));
        }
Esempio n. 3
0
        public ActionResult InsertUpdate(int?id)
        {
            Import_DutyFreeRecommendationViewModel model = new Import_DutyFreeRecommendationViewModel();

            if (id > 0)
            {
                model = pro.GeById(id ?? 0);
            }


            return(View(model));
        }
Esempio n. 4
0
 public ActionResult InsertUpdate(Import_DutyFreeRecommendationViewModel model)
 {
     try
     {
         var result = pro.InsertImport_DutyFreeRecommendation(model);
         if (result == true)
         {
             TempData["SuccessMsg"] = "सफल भयो";
             return(RedirectToAction("Index"));
         }
     }
     catch
     {
         TempData["Msg"] = "असफल भयो ";
         return(View());
     }
     return(View());
 }
        public bool InsertImport_DutyFreeRecommendation(Import_DutyFreeRecommendationViewModel model)
        {
            using (SamajkalyanEntities ent = new SamajkalyanEntities())
            {
                try
                {
                    var workPermitRow = ent.Import_DutyFreeRecommendation.Where(x => x.ImportId == model.ImportId).FirstOrDefault();
                    //_context.Database.Connection.Open();
                    //_context.Database.Connection.BeginTransaction();
                    if (workPermitRow == null)
                    {
                        workPermitRow = new Import_DutyFreeRecommendation();
                    }
                    ;
                    // workPermitRow.WorkPermitId = model.WorkPermitId;
                    workPermitRow.GA_Id = model.GA_Id;
                    workPermitRow.PA_Id = model.PA_Id;
                    workPermitRow.Council_RegistrtionNumber = model.Council_RegistrtionNumber;

                    workPermitRow.CouncilRegistrationDate   = model.CouncilRegistrationDate;
                    workPermitRow.CouncilRegistrationDateNp = model.CouncilRegistrationDateNp;
                    workPermitRow.DonnerName                  = model.DonnerName;
                    workPermitRow.DonnerAddress               = model.DonnerAddress;
                    workPermitRow.DiscriptionOfGoods          = model.DiscriptionOfGoods;
                    workPermitRow.InvoiceDateNp               = model.InvoiceDateNp;
                    workPermitRow.DecisionDate                = model.DecisionDate;
                    workPermitRow.InvoiceNumber               = model.InvoiceNumber;
                    workPermitRow.TotalAmountForieignCurrency = model.TotalAmountForieignCurrency;
                    workPermitRow.TotalAmountNepaliCurrency   = model.TotalAmountNepaliCurrency;

                    workPermitRow.Remarks = model.Remarks;

                    workPermitRow.CreatedBy   = model.CreatedBy;
                    workPermitRow.CreatedDate = model.CreatedDate;
                    //deploymentRow.Status = true;
                    if (model.ImportId == 0)
                    {
                        // generalAgreementRow.Status = false;
                        ent.Import_DutyFreeRecommendation.Add(workPermitRow);
                        ent.SaveChanges();
                    }
                    else
                    {
                        // deploymentRow.Status = dmodel.Status ?? false;
                        workPermitRow.UpDatedBy  = model.UpDatedBy;
                        workPermitRow.UpdateDate = model.UpdateDate;
                        ent.Import_DutyFreeRecommendation.Attach(workPermitRow);
                        ent.Entry(workPermitRow).State = EntityState.Modified;
                        ent.SaveChanges();
                    }
                    //if (model.ImportId <= 0)
                    //{
                    //    model.ImportId = ent.Database.SqlQuery<WorkPermitViewModel>("select * from WorkPermit where WorkPermitId=(select max (WorkPermitId) from WorkPermit )").ToList().FirstOrDefault().WorkPermitId;
                    //    //employeeRow.EmpId=employeeRow.EmpId != 0 ? employeeRow.EmpId : empModel.EmpId;

                    //}
                }



                catch (Exception ex)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 6
0
        public ActionResult Details(int id)
        {
            Import_DutyFreeRecommendationViewModel abc = pro.GeById(id);

            return(PartialView(abc));
        }