//ExpenseBudget Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var SalesPersonName = HttpContext.User.Identity.Name;
                var SalesPersonId   = _ExpenseBudgetService.BMSUnit.UserInfoNameRepository.GetAll().Where(c => c.UserName == SalesPersonName).FirstOrDefault().Id;
                var divisionList    = SelectListItemExtension.PopulateDropdownList(_ExpenseBudgetService.BMSUnit.DivisionRepository.GetAll().ToList <tblDivision>(), "Id", "DivisionName").ToList();
                var sbuList         = SelectListItemExtension.PopulateDropdownList(_ExpenseBudgetService.BMSUnit.SBURepository.GetAll().ToList <tblSBU>(), "Id", "SBUName").ToList();

                var model = new ExpenseBudgetModel()
                {
                    BudgetYear      = DateTime.Now.Year.ToString(),
                    SalesPersonId   = Convert.ToInt64(SalesPersonId),
                    SalesPersonName = SalesPersonName,
                    ddlDivision     = divisionList,
                    ddlSBU          = sbuList
                };

                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #2
0
        public ActionResult Create(ProductModel viewModel)
        {
            var strMessage = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    #region Current User

                    var userName = HttpContext.User.Identity.Name;
                    viewModel.IUser = userName;
                    viewModel.IDate = DateTime.Now;
                    viewModel.EDate = DateTime.Now;

                    #endregion

                    var entity = viewModel.ToEntity();
                    _ProductService.BMSUnit.ProductRepository.Add(entity);
                    _ProductService.BMSUnit.ProductRepository.SaveChanges();

                    return(Content(Boolean.TrueString));
                    //return Content("Information has been saved successfully");
                }

                strMessage = Common.GetModelStateErrorMessage(ModelState);
            }
            catch (Exception ex)
            {
                strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Save);
            }

            return(Content(strMessage));
        }
Beispiel #3
0
        public ActionResult DeleteConfirmed(long id)
        {
            var strMessage = string.Empty;

            try
            {
                var model = _ProductService.BMSUnit.ProductRepository.GetByID(id);

                if (model != null)
                {
                    //temporarily Blocked due
                    _ProductService.BMSUnit.ProductRepository.Delete_64Bit(model.Id);
                    _ProductService.BMSUnit.ProductRepository.SaveChanges();

                    return(Content(Boolean.TrueString));
                }

                strMessage = Common.GetModelStateErrorMessage(ModelState);
            }
            catch (Exception ex)
            {
                strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Delete);
            }

            return(Content(strMessage));
        }
        // GET: Division/Delete/By ID
        public ActionResult Delete(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _DivisionService.BMSUnit.DivisionRepository.GetByID(id);

                if (model != null)
                {
                    DivisionModel viewModel = new DivisionModel
                    {
                        Id           = model.Id,
                        DivisionName = model.DivisionName,
                        Descriptions = model.Descriptions
                    };

                    return(PartialView("_Delete", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #5
0
        // GET: SBU/Details/By ID
        public ActionResult Details(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _SBUService.BMSUnit.SBURepository.GetByID(id);
                if (model != null)
                {
                    SBUModel viewModel = new SBUModel
                    {
                        Id           = model.Id,
                        SBUName      = model.SBUName,
                        Descriptions = model.Descriptions
                                       //,
                                       //IsActive = Convert.ToBoolean(model.IsActive)
                    };

                    return(PartialView("_Details", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #6
0
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var customerList = SelectListItemExtension.PopulateDropdownList(_PriceRequestService.BMSUnit.CustomerRepository.GetAll().ToList <tblCustomer>(), "Id", "CustomerName").ToList();
                var supplierList = SelectListItemExtension.PopulateDropdownList(_PriceRequestService.BMSUnit.SupplierRepository.GetAll().ToList <tblSupplier>(), "Id", "SupplierName").ToList();

                var SalesCallId = 34;

                var model = new PriceRequestModel()
                {
                    SalesCallId      = Convert.ToInt64(SalesCallId),
                    PriceRequestDate = DateTime.Now,
                    ddlSupplier      = supplierList,
                    ddlCustomer      = customerList
                };

                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #7
0
        public JsonResult SaveQouteData(List <QuoteModel> lstSampleSubmissionMaster, List <QuoteDetailModel> lstSampleSubmissionDetails)
        {
            var strMessage = string.Empty;

            try
            {
                foreach (var item in lstSampleSubmissionMaster)
                {
                    QuoteModel masterEntityModel = new QuoteModel();

                    #region Current User
                    var userName = HttpContext.User.Identity.Name;
                    masterEntityModel.IUser = userName;
                    masterEntityModel.IDate = DateTime.Now;
                    masterEntityModel.EDate = DateTime.Now;
                    #endregion
                    masterEntityModel.QuoteNo     = "Test";
                    masterEntityModel.SalesCallId = Convert.ToInt64(item.SalesCallId);
                    masterEntityModel.QuoteDate   = item.QuoteDate;
                    masterEntityModel.CustomerId  = Convert.ToInt64(item.CustomerId);
                    //masterList.Add(masterEntityModel);

                    var entity = masterEntityModel.ToEntity();
                    _QuoteService.BMSUnit.QuoteRepository.Add(entity);
                    _QuoteService.BMSUnit.QuoteRepository.SaveChanges();

                    Session["QuoteMasterId"] = entity.Id;
                }


                // Add new detail information

                foreach (var item in lstSampleSubmissionDetails)
                {
                    QuoteDetailModel entityDetailModel = new QuoteDetailModel();

                    entityDetailModel.QuoteId           = Convert.ToInt64(Convert.ToInt64(Session["QuoteMasterId"]));
                    entityDetailModel.ArticleId         = item.ArticleId;
                    entityDetailModel.MOQ               = item.MOQ;
                    entityDetailModel.ValidityDate      = item.ValidityDate;
                    entityDetailModel.SupplierId        = item.SupplierId;
                    entityDetailModel.PriceTermId       = item.PriceTermId;
                    entityDetailModel.ShipmentCountryId = item.ShipmentCountryId;
                    entityDetailModel.ShipmentLeadTime  = item.ShipmentLeadTime;
                    entityDetailModel.DetailText        = item.DetailText;

                    var detailEntity = entityDetailModel.ToEntity();
                    _QuoteService.BMSUnit.QuoteDetailsRepository.Add(detailEntity);
                    _QuoteService.BMSUnit.QuoteDetailsRepository.SaveChanges();
                }
                strMessage = "Information has been saved successfully";
            }
            catch (Exception ex)
            {
                strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Save);
            }

            return(Json(new { strMessage = strMessage }));
        }
Beispiel #8
0
        // GET: Invoice/Edit/By ID
        public ActionResult Edit(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _QuoteService.BMSUnit.QuoteRepository.GetByID(id);

                Session["QuoteId"] = model.Id;

                var customerList     = SelectListItemExtension.PopulateDropdownList(_QuoteService.BMSUnit.CustomerRepository.GetAll().Where(c => c.IUser.ToUpper() != "SYSTEM").ToList <tblCustomer>(), "Id", "CustomerName", isEdit: true).ToList();
                var organizationList = SelectListItemExtension.PopulateDropdownList(_QuoteService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();
                //var cusContactsList = SelectListItemExtension.PopulateDropdownList(_QuoteService.BMSUnit.TransporterRepository.GetAll().ToList<tblTransporter>(), "Id", "TransporterName").ToList();
                //var deliveryStateList = Common.PopulateDeliveryStateDDList();


                var documentModels = _QuoteService.BMSUnit.SampleDocumentRequiredRepository.GetAll().ToList().Select(
                    md => new DocumentModel
                {
                    Id         = md.Id,
                    DocName    = md.DocName,
                    IsSelected = _QuoteService.BMSUnit.QuoteDocumentRepository.GetAll().ToList().Where(x => x.QuoteId == model.Id && x.DocumentId == md.Id).Count() > 0 ? true : false

                                 //md.IsSelected
                }).OrderBy(o => o.DocName).ThenBy(ot => ot.Id);



                if (model != null)
                {
                    QuoteModel viewModel = new QuoteModel
                    {
                        Id             = Convert.ToInt64(model.Id),
                        QuoteDate      = model.QuoteDate,
                        ddlCustomer    = customerList,
                        CustomerId     = model.CustomerId,
                        documentModels = documentModels.ToList()
                                         //Designation = _QuoteService.BMSUnit.SupplierRepository.GetByID(model.SupplierId).Address,
                                         //ddlContactPerson = cusContactsList,
                                         //CusContactId=Convert.ToInt32(model.CusContactId),
                                         //,IsActive = Convert.ToBoolean(model.IsActive)
                    };

                    return(PartialView("_Edit", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #9
0
        // GET: Sales Budget/Edit/By ID
        public ActionResult Edit(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _SalesBudgetService.BMSUnit.SalesBudgetRepository.GetByID(id);

                Session["SalesBudgetMasterId"] = model.Id;

                var sbuList     = SelectListItemExtension.PopulateDropdownList(_SalesBudgetService.BMSUnit.SBURepository.GetAll().ToList <tblSBU>(), "Id", "SBUName").ToList();
                var productList = SelectListItemExtension.PopulateDropdownList(_SalesBudgetService.BMSUnit.ProductRepository.GetAll().ToList <tblProduct>(), "Id", "ProductName").ToList();

                var SalesPersonName = HttpContext.User.Identity.Name;
                var SalesPersonId   = _SalesBudgetService.BMSUnit.UserInfoNameRepository.GetAll().Where(c => c.UserName == SalesPersonName).ToList().FirstOrDefault().Id;
                //var divisionName =
                var    divCount     = _SalesBudgetService.BMSUnit.SalesPersonRepository.GetAll().Where(c => c.SalesPersonId == SalesPersonName).ToList().Count();
                string divisionName = null;

                if (divCount > 0)
                {
                    var divisionId = _SalesBudgetService.BMSUnit.SalesPersonRepository.GetAll().Where(c => c.SalesPersonId == SalesPersonName).ToList().FirstOrDefault().DivisionId;
                    divisionName = _SalesBudgetService.BMSUnit.DivisionRepository.GetAll().Where(c => c.Id == divisionId).ToList().FirstOrDefault().DivisionName;
                }



                if (model != null)
                {
                    SalesBudgetModel viewModel = new SalesBudgetModel
                    {
                        Id              = Convert.ToInt64(model.Id),
                        SalesPersonId   = Convert.ToInt64(model.SalesPersonId),
                        SalesPersonName = SalesPersonName,
                        DivisionName    = divisionName,
                        BudgetYear      = model.BudgetYear,
                        SBUId           = Convert.ToInt64(model.SBUId),
                        ProductId       = Convert.ToInt64(model.ProductId),
                        ddlSBU          = sbuList,
                        ddlProduct      = productList
                    };

                    return(PartialView("_Edit", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #10
0
        // GET: DebitNote/Edit/By ID
        public ActionResult Edit(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _DebitNoteService.BMSUnit.DebitNoteRepository.GetByID(id);

                Session["DebitNoteId"] = model.Id;

                var supplieerList    = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.SupplierRepository.GetAll().ToList <tblSupplier>(), "Id", "SupplierName").ToList();
                var organizationList = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();
                var bankList         = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.BankRepository.GetAll().ToList <tblBank>(), "Id", "BankName").ToList();

                if (model != null)
                {
                    DebitNoteModel viewModel = new DebitNoteModel
                    {
                        Id            = model.Id,
                        DebitNoteNo   = model.DebitNoteNo,
                        DebitNoteDate = model.DebitNoteDate,

                        ddlSupplier = supplieerList,
                        SupplierId  = model.SupplierId,

                        ddlOrganization = organizationList,
                        OrganizationId  = Convert.ToInt64(model.OrganizationId),

                        ddlBank = bankList,
                        BankId  = model.BankId,

                        SupplierName    = _DebitNoteService.BMSUnit.SupplierRepository.GetByID(model.SupplierId).SupplierName,
                        SupplierAddress = _DebitNoteService.BMSUnit.SupplierRepository.GetByID(model.SupplierId).Address,
                        AttentionPerson = _DebitNoteService.BMSUnit.SupplierRepository.GetByID(model.SupplierId).Phone
                                          //LCNo=model.LCNo,
                                          //Total= model.tot`al

                                          //,IsActive = Convert.ToBoolean(model.IsActive)
                    };

                    return(PartialView("_Edit", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #11
0
        // GET: SampleRequest/SearchArticle

        /*
         *          public ActionResult SearchArticle()
         *          {
         *              var errorViewModel = new ErrorViewModel();
         *
         *              try
         *              {
         *
         *                  var articleList = SelectListItemExtension.PopulateDropdownList(_SampleRequestService.BMSUnit.ArticleRepository.GetAll().Where(x=> x.IsActive) .ToList<tblArticle>(), "Id", "ArticleName").ToList();
         *
         *                  var model = new InvoiceDetailModel()
         *                  {
         *                      ddlArticle = articleList
         *                  };
         *
         *                  return PartialView("_SearchArticle", model);
         *              }
         *              catch (Exception ex)
         *              {
         *                  errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
         *                  return PartialView("_ErrorPopUp", errorViewModel);
         *              }
         *          }
         *
         *          // POST: Invoice/SearchArticle
         *          [HttpPost]
         *          public ActionResult SearchArticle(InvoiceDetailModel viewModel)
         *          {
         *              var strMessage = string.Empty;
         *              try
         *              {
         *                  if (ModelState.IsValid)
         *                  {
         *
         *                      //var entity = viewModel.ToEntity();
         *                      //_invSampleRequestService.BMSUnit.SampleRequestRepository.Add(entity);
         *                      //_invSampleRequestService.BMSUnit.SampleRequestRepository.SaveChanges();
         *
         *                      return Content(Boolean.TrueString);
         *                      //return Content("Information has been saved successfully");
         *                  }
         *
         *                  strMessage = Common.GetModelStateErrorMessage(ModelState);
         *              }
         *              catch (Exception ex)
         *              {
         *                  strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Save);
         *              }
         *
         *              return Content(strMessage);
         *          }
         */

        // GET: SampleRequest/Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var supplierList      = SelectListItemExtension.PopulateDropdownList(_SampleRequestService.BMSUnit.SupplierRepository.GetAll().Where(c => c.IUser.ToUpper() != "SYSTEM").ToList <tblSupplier>(), "Id", "SupplierName", isEdit: true).ToList();
                var organizationList  = SelectListItemExtension.PopulateDropdownList(_SampleRequestService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();
                var transporterList   = SelectListItemExtension.PopulateDropdownList(_SampleRequestService.BMSUnit.TransporterRepository.GetAll().ToList <tblTransporter>(), "Id", "TransporterName").ToList();
                var deliveryStateList = Common.PopulateDeliveryStateDDList();


                var sampleDocumentModels = _SampleRequestService.BMSUnit.SampleDocumentRequiredRepository.GetAll().ToList().Select(
                    md => new SampleDocumentModel
                {
                    Id         = md.Id,
                    DocName    = md.DocName,
                    IsSelected = md.IsSelected
                }).OrderBy(o => o.DocName).ThenBy(ot => ot.Id);


                //List<SampleDocumentModel> fr = new List<SampleDocumentModel>();
                //fr.Add(new SampleDocumentModel() { Id = 1, DocName = "asdad", IsSelected = true });
                //fr.Add(new SampleDocumentModel() { Id = 2, DocName = "sfsfsfs", IsSelected = false });



                //DocumentList docList = new DocumentList();
                //docList.sampleDocumentModels = fr;

                var userOrganization     = 3; // Query and Set Defaul Organization Here
                var defaultDeliveryState = Common.DeliveryStateEnum.Undelivered;

                var model = new SampleRequestModel()
                {
                    ddlSupplier          = supplierList,
                    RequestDate          = DateTime.Now,
                    ddlOrganization      = organizationList,
                    OrganizationId       = Convert.ToInt64(userOrganization),
                    ddlTransporter       = transporterList,
                    ddlDeliveryState     = deliveryStateList,
                    DeliveryStateId      = Convert.ToInt32(defaultDeliveryState),
                    sampleDocumentModels = sampleDocumentModels.ToList()
                };


                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #12
0
        // GET: /Project/Edit/By ID
        public ActionResult EditProject(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _CallReportInfoService.BMSUnit.CallReportProjectRepository.GetByID(id);

                var currentStageList         = SelectListItemExtension.PopulateDropdownList(_CallReportInfoService.BMSUnit.CurrentStageRepository.GetAll().ToList <tblCurrentStage>(), "Id", "CurrentStage").ToList();
                var supplierList             = SelectListItemExtension.PopulateDropdownList(_CallReportInfoService.BMSUnit.SupplierRepository.GetAll().Where(c => c.IUser.ToUpper() != "SYSTEM").ToList <tblSupplier>(), "Id", "SupplierName", isEdit: true).ToList();
                var customerList             = SelectListItemExtension.PopulateDropdownList(_CallReportInfoService.BMSUnit.CustomerRepository.GetAll().Where(c => c.IUser.ToUpper() != "SYSTEM").ToList <tblCustomer>(), "Id", "CustomerName", isEdit: true).ToList();
                var communicationChannelList = SelectListItemExtension.PopulateDropdownList(_CallReportInfoService.BMSUnit.CommunicationChannelRepository.GetAll().ToList <tblCommunicationChannel>(), "Id", "CommunicationChannel").ToList();

                if (model != null)
                {
                    CallReportProjectInfoModel viewModel = new CallReportProjectInfoModel
                    {
                        ddlCurrentStage         = currentStageList,
                        ddlCustomer             = customerList,
                        ddlSupplier             = supplierList,
                        ddlCommunicationChannel = communicationChannelList,
                        Id                     = model.Id,
                        CreateDate             = model.CreateDate,
                        ProjectName            = model.ProjectName,
                        CurrentStageId         = model.CurrentStageId,
                        CustomerId             = model.CustomerId,
                        SupplierId             = model.SupplierId,
                        Description            = model.Description,
                        SellingOpportunity     = model.SellingOpportunity,
                        PotVolPerYear          = model.PotVolPerYear,
                        PotAmountPerYear       = model.PotAmountPerYear,
                        RemarkNextAction       = model.RemarkNextAction,
                        CommunicationChannelId = model.CommunicationChannelId,
                        SalesPerson            = model.SalesPerson
                    };

                    //CallReportProjectInfoModel viewModel = new CallReportProjectInfoModel();
                    //viewModel = model.ToModel();

                    return(PartialView("_EditProject", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #13
0
        public ActionResult CreateSalesCallInquiry(CallReportSalesCallInquiryInfoModel viewModel)
        {
            var strMessage = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    #region Current User

                    var userName = HttpContext.User.Identity.Name;
                    viewModel.IUser = userName;
                    viewModel.IDate = DateTime.Now;
                    viewModel.EDate = DateTime.Now;

                    #endregion

                    var entity = viewModel.ToEntity();
                    _CallReportInfoService.BMSUnit.CallReportSalesCallInquiryRepository.Add(entity);
                    _CallReportInfoService.BMSUnit.CallReportSalesCallInquiryRepository.SaveChanges();

                    #region Detail Save

                    foreach (var item in viewModel.salesCallInquiryDetailViewModel)
                    {
                        item.SalesCallInquiryId = Convert.ToInt64(entity.Id);
                        item.IUser = userName;
                        item.IDate = DateTime.Now;
                        item.EDate = DateTime.Now;
                        //item.StageId = item.StageIdTemp;
                        item.StageId = item.StageId;
                        var detailEntity = item.ToEntity();
                        _CallReportInfoService.BMSUnit.CallReportSalesCallInquiryDetailRepository.Add(detailEntity);
                        _CallReportInfoService.BMSUnit.CallReportSalesCallInquiryDetailRepository.SaveChanges();
                    }

                    #endregion

                    return(Content(Boolean.TrueString));
                    //return Content("Information has been saved successfully");
                }

                strMessage = Common.GetModelStateErrorMessage(ModelState);
            }
            catch (Exception ex)
            {
                strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Save);
            }

            return(Content(strMessage));
        }
        // GET: /Customer/Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = new CustomerInfoModel();
                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #15
0
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var sbuList     = SelectListItemExtension.PopulateDropdownList(_SalesBudgetService.BMSUnit.SBURepository.GetAll().ToList <tblSBU>(), "Id", "SBUName").ToList();
                var productList = SelectListItemExtension.PopulateDropdownList(_SalesBudgetService.BMSUnit.ProductRepository.GetAll().ToList <tblProduct>(), "Id", "ProductName").ToList();

                var customerList = SelectListItemExtension.PopulateDropdownList(_SalesBudgetService.BMSUnit.CustomerRepository.GetAll().ToList <tblCustomer>(), "Id", "CustomerName").ToList();



                var supplierList = SelectListItemExtension.PopulateDropdownList(_SalesBudgetService.BMSUnit.SupplierRepository.GetAll().ToList <tblSupplier>(), "Id", "SupplierName").ToList();

                var SalePersonName = HttpContext.User.Identity.Name;
                var SalePersonId   = _SalesBudgetService.BMSUnit.UserInfoNameRepository.GetAll().Where(c => c.UserName == SalePersonName).ToList().FirstOrDefault().Id;
                //var divisionName =
                var    divCount     = _SalesBudgetService.BMSUnit.SalesPersonRepository.GetAll().Where(c => c.SalesPersonId == SalePersonName).ToList().Count();
                string divisionName = null;

                if (divCount > 0)
                {
                    var divisionId = _SalesBudgetService.BMSUnit.SalesPersonRepository.GetAll().Where(c => c.SalesPersonId == SalePersonName).ToList().FirstOrDefault().DivisionId;
                    divisionName = _SalesBudgetService.BMSUnit.DivisionRepository.GetAll().Where(c => c.Id == divisionId).ToList().FirstOrDefault().DivisionName;
                }



                var model = new SalesBudgetModel()
                {
                    BudgetYear      = DateTime.Now.Year.ToString(),
                    SalesPersonId   = Convert.ToInt64(SalePersonId),
                    SalesPersonName = SalePersonName,
                    DivisionName    = divisionName,
                    ddlSBU          = sbuList,
                    ddlProduct      = productList
                };

                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #16
0
        // GET: Quote/Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                //SupplierName = _QuoteService.BMSUnit.SupplierRepository.GetAll().Where(c => c.Id == QuoteDetail.SupplierId).FirstOrDefault().SupplierName,
                var customerList = SelectListItemExtension.PopulateDropdownList(_QuoteService.BMSUnit.CustomerRepository.GetAll().Where(c => c.IUser.ToUpper() != "SYSTEM").ToList <tblCustomer>(), "Id", "CustomerName").ToList();
                //var customerList = SelectListItemExtension.PopulateDropdownList(_QuoteService.BMSUnit.CustomerRepository.GetAll().ToList<tblCustomer>(), "Id", "CustomerName").ToList();
                var organizationList = SelectListItemExtension.PopulateDropdownList(_QuoteService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();
                //var cusContactsList = SelectListItemExtension.PopulateDropdownList(_QuoteService.BMSUnit.TransporterRepository.GetAll().ToList<tblTransporter>(), "Id", "TransporterName").ToList();
                //var deliveryStateList = Common.PopulateDeliveryStateDDList();


                var documentModels = _QuoteService.BMSUnit.SampleDocumentRequiredRepository.GetAll().ToList().Select(
                    md => new DocumentModel
                {
                    Id         = md.Id,
                    DocName    = md.DocName,
                    IsSelected = md.IsSelected
                }).OrderBy(o => o.DocName).ThenBy(ot => ot.Id);


                var userOrganization = 3;     // Query and Set Defaul Organization Here


                var model = new QuoteModel()
                {
                    ddlCustomer     = customerList,
                    SalesCallId     = 34,
                    QuoteDate       = DateTime.Now,
                    ddlOrganization = organizationList,
                    OrganizationId  = Convert.ToInt64(userOrganization),
                    documentModels  = documentModels.ToList()
                                      //ddlContactPerson = cusContactsList,
                };


                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #17
0
        // GET: ProductSubCategory/Delete/By ID
        public ActionResult Delete(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _VisitService.BMSUnit.VisitInformationRepository.GetByID(id);

                if (model != null)
                {
                    VisitInfoModel viewModel = new VisitInfoModel();
                    viewModel = model.ToModel();

                    //ProductModel viewModel = new ProductModel
                    //{
                    //    Id = model.Id,
                    //    ProductCode = model.ProductCode,
                    //    ProductName = model.ProductName,
                    //    GenericName = model.GenericName,
                    //    ShortDesc = model.ShortDesc,
                    //    HSCode = model.HSCode,
                    //    SellingUnit = model.SellingUnit,
                    //    SamplingUnit = model.SamplingUnit,
                    //    UnitPrice = model.UnitPrice,
                    //    DutyStructure = model.DutyStructure,
                    //    Origin = model.Origin,
                    //    MOQ = model.MOQ,
                    //    LeadTime = model.LeadTime,
                    //    IsActive = Convert.ToBoolean(model.IsActive)
                    //};

                    return(PartialView("_Delete", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #18
0
        // GET: Invoice/Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var customerList     = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.CustomerRepository.GetAll().ToList <tblCustomer>(), "Id", "CustomerName").ToList();
                var organizationList = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();

                var currencyList        = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.CurrencyRepository.GetAll().ToList <tblCurrency>(), "Id", "CurrencyName").ToList();
                var priceTermList       = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.PriceTermRepository.GetAll().ToList <tblPriceTerm>(), "Id", "PriceTermName").ToList();
                var commTypeList        = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.CommCalculationTypeRepository.GetAll().ToList <tblCommCalculationType>(), "Id", "CommissionCalculationTerm").ToList();
                var shipmentCountryList = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.CountryRepository.GetAll().ToList <tblCountry>(), "Id", "CountryName").ToList();
                var portOfDischargeList = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.PortRepository.GetAll().ToList <tblPort>(), "Id", "PortName").ToList();

                var invoiceTypeList = Common.PopulateInvoiceTypeDDList();

                var userOrganization   = 3;   // Query and Set Defaul Organization Here
                var defaultInvoiceType = Common.InvoiceType.PI;
                var model = new InvoiceModel()
                {
                    ddlCustomer        = customerList,
                    InvoiceDate        = DateTime.Now,
                    InvoicePeriod      = 201605,
                    ddlOrganization    = organizationList,
                    OrganizationId     = Convert.ToInt64(userOrganization),
                    ddlInvoiceType     = invoiceTypeList,
                    InvoiceTypeId      = Convert.ToInt32(defaultInvoiceType),
                    ddlPriceTerm       = priceTermList,
                    ddlCurrency        = currencyList,
                    ddlShipmentCountry = shipmentCountryList,
                    ddlPortOfDischarge = portOfDischargeList,
                    ddlCommissionTerm  = commTypeList
                                         //OrganizationId = Convert.ToInt64(userOrganization)
                };


                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #19
0
        // GET: ProductSubCategory/Delete/By ID
        public ActionResult Delete(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _ProductService.BMSUnit.ProductRepository.GetByID(id);

                if (model != null)
                {
                    ProductModel viewModel = new ProductModel
                    {
                        Id            = model.Id,
                        ProductCode   = model.ProductCode,
                        ProductName   = model.ProductName,
                        GenericName   = model.GenericName,
                        ShortDesc     = model.ShortDesc,
                        HSCode        = model.HSCode,
                        SellingUnit   = model.SellingUnit,
                        SamplingUnit  = model.SamplingUnit,
                        UnitPrice     = model.UnitPrice,
                        DutyStructure = model.DutyStructure,
                        Origin        = model.Origin,
                        MOQ           = model.MOQ,
                        LeadTime      = model.LeadTime,
                        IsActive      = Convert.ToBoolean(model.IsActive)
                    };

                    return(PartialView("_Delete", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
        // GET: /Supplier/Edit/By ID
        public ActionResult Edit(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _SupplierInfoService.BMSUnit.SupplierRepository.GetByID(id);

                Session["ContactId"] = model.Id;

                if (model != null)
                {
                    SupplierInfoModel viewModel = new SupplierInfoModel
                    {
                        Id           = model.Id,
                        SupplierId   = model.SupplierId,
                        SupplierName = model.SupplierName,
                        Address      = model.Address,
                        Country      = model.Country,
                        Phone        = model.Phone,
                        //Fax = model.Fax,
                        //Mobile=model.Mobile,
                        Email      = model.Email,
                        WebAddress = model.WebAddress,
                        Industry   = model.Industry,
                        IsActive   = Convert.ToBoolean(model.IsActive)
                    };

                    return(PartialView("_Edit", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
        // GET: /Supplier/Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                //var SupplierTypeList = SelectListItemExtension.PopulateDropdownList(_SupplierInfoService.BMSUnit.SupplierTypeRepository.GetAll().ToList<INV_tblSupplierType>(), "Id", "Name").ToList();
                var model = new SupplierInfoModel();
                //{
                //    ddlSupplierType = SupplierTypeList
                //};

                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #22
0
        // GET: Visit/Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var userName = HttpContext.User.Identity.Name;
                var model    = new VisitInfoModel()
                {
                    PreparationDate = DateTime.Now,
                    SalesPerson     = userName
                };
                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
        // For saving detail data

        public JsonResult SetVoucherDetailsListForSave(List <VoucherDetailViewModel> lstPettyCashVoucherDetails)
        {
            var strMessage = string.Empty;

            // Clear detail list
            Session["lstPettyCashVoucherDetails"] = null;


            try
            {
                List <VoucherDetailEntityModel> list = new List <VoucherDetailEntityModel>();
                // Add new detail information
                foreach (var item in lstPettyCashVoucherDetails)
                {
                    VoucherDetailEntityModel entityModel = new VoucherDetailEntityModel();

                    entityModel.IUser = User.Identity.Name;
                    entityModel.IDate = DateTime.Now;
                    entityModel.EUser = User.Identity.Name;
                    entityModel.EDate = DateTime.Now;

                    entityModel.Id        = item.Id;
                    entityModel.AMCode    = item.AMCode;
                    entityModel.ASCode    = item.ASCode;
                    entityModel.Narration = item.Narration;
                    entityModel.Debit     = Convert.ToDecimal(item.Debit);
                    entityModel.Credit    = Convert.ToDecimal(item.Credit);

                    list.Add(entityModel);
                }

                Session["lstPettyCashVoucherDetails"] = list;
                strMessage = Boolean.TrueString;
            }
            catch (Exception ex)
            {
                strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Save);
            }

            return(Json(new { strMessage = strMessage }));
        }
Beispiel #24
0
        public JsonResult SetQuoteDetailsListForSave(List <QuoteDetailViewModel> lstQuoteDetails)
        {
            var strMessage = string.Empty;

            // Clear detail list
            Session["lstQuoteDetails"] = null;

            try
            {
                List <QuoteDetailModel> list = new List <QuoteDetailModel>();
                var _QuoteModel = new QuoteModel();

                // Add new detail information
                foreach (var item in lstQuoteDetails)
                {
                    QuoteDetailModel entityModel = new QuoteDetailModel();

                    entityModel.QuoteId       = item.QuoteId;
                    entityModel.ArticleId     = item.ArticleId;
                    entityModel.QuoteQuantity = Convert.ToDecimal(item.QuoteQuantity);
                    entityModel.MOQ           = Convert.ToInt64(item.MOQ);
                    entityModel.ValidityDate  = item.ValidityDate;
                    entityModel.UnitPrice     = Convert.ToDecimal(item.UnitPrice);
                    entityModel.SupplierId    = item.SupplierId;
                    entityModel.Origin        = item.Origin;
                    entityModel.ApproveState  = item.ApproveState;
                    entityModel.DetailText    = item.DetailText;
                    list.Add(entityModel);
                }

                Session["lstQuoteDetails"] = list;
                return(Json(_QuoteModel, JsonRequestBehavior.AllowGet));
                //strMessage = Boolean.TrueString;
            }
            catch (Exception ex)
            {
                strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Save);
            }

            return(Json(new { strMessage = strMessage }));
        }
Beispiel #25
0
        // GET: Sales Budget/Edit/By ID
        public ActionResult Edit(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _PriceRequestService.BMSUnit.PriceRequestRepository.GetByID(id);

                Session["PriceRequestMasterEditId"] = model.Id;


                var customerList = SelectListItemExtension.PopulateDropdownList(_PriceRequestService.BMSUnit.CustomerRepository.GetAll().ToList <tblCustomer>(), "Id", "CustomerName").ToList();
                var supplierList = SelectListItemExtension.PopulateDropdownList(_PriceRequestService.BMSUnit.SupplierRepository.GetAll().ToList <tblSupplier>(), "Id", "SupplierName").ToList();

                if (model != null)
                {
                    PriceRequestModel viewModel = new PriceRequestModel
                    {
                        Id               = Convert.ToInt64(model.Id),
                        SalesCallId      = Convert.ToInt64(model.SalesCallId),
                        PriceRequestDate = model.PriceRequestDate,
                        CustomerId       = model.CustomerId,
                        SupplierId       = model.SupplierId,
                        ddlSupplier      = supplierList,
                        ddlCustomer      = customerList
                    };

                    return(PartialView("_Edit", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
        public JsonResult SetSampleSubmissionDetailsListForSave(List <SampleSubmissionDetailViewModel> lstSampleSubmissionDetails)
        {
            var strMessage = string.Empty;

            // Clear detail list
            Session["lstSampleSubmissionDetails"] = null;

            try
            {
                List <SampleSubmissionDetailModel> list = new List <SampleSubmissionDetailModel>();
                var _SampleSubmissionModel = new SampleSubmissionModel();

                // Add new detail information
                foreach (var item in lstSampleSubmissionDetails)
                {
                    SampleSubmissionDetailModel entityModel = new SampleSubmissionDetailModel();

                    entityModel.SubmissionId       = item.SubmissionId;
                    entityModel.ProductId          = item.ProductId;
                    entityModel.SubmissionQuantity = Convert.ToDecimal(item.SubmissionQuantity);
                    entityModel.ExpieryDate        = item.ExpieryDate;
                    entityModel.Purpose            = item.Purpose;
                    entityModel.SupplierId         = item.SupplierId;
                    entityModel.Origin             = item.Origin;
                    entityModel.TrialReport        = item.TrialReport;
                    entityModel.ApproveState       = item.ApproveState;
                    entityModel.DetailText         = item.DetailText;
                    list.Add(entityModel);
                }

                Session["lstSampleSubmissionDetails"] = list;
                return(Json(_SampleSubmissionModel, JsonRequestBehavior.AllowGet));
                //strMessage = Boolean.TrueString;
            }
            catch (Exception ex)
            {
                strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Save);
            }

            return(Json(new { strMessage = strMessage }));
        }
        // GET: /ArticleSubCategory/Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                //var subCategoryList = SelectListItemExtension.PopulateDropdownList(_invArticleService.INVUnit.ArticleSubCategoryRepository.GetAll().ToList<tblArticleSubCategory>(), "Id", "SubCategoryName").ToList();
                var categoryList = SelectListItemExtension.PopulateDropdownList(_invArtSubCategoryService.INVUnit.ArticleCategoryRepository.GetAll().ToList <tblArticleCategory>(), "Id", "CategoryName").ToList();
                var model        = new ArticleSubCategoryModel()
                {
                    ddlArticleCategory = categoryList
                };

                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #28
0
        // GET: Invoice/SearchArticle
        public ActionResult SearchArticle()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var productList = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.ProductRepository.GetAll().Where(x => x.IsActive).ToList <tblProduct>(), "Id", "ArticleName").ToList();

                var model = new InvoiceDetailModel()
                {
                    ddlProduct = productList
                };

                return(PartialView("_SearchArticle", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
        // GET: /Customer/Delete/By ID
        public ActionResult Delete(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _CustomerService.BMSUnit.CustomerRepository.GetByID(id);

                if (model != null)
                {
                    CustomerInfoModel viewModel = new CustomerInfoModel
                    {
                        Id           = model.Id,
                        CustomerId   = model.CustomerId,
                        CustomerName = model.CustomerName,
                        Address      = model.Address,
                        //Address2 = model.Address2,
                        Country = model.Country,
                        Phone   = model.Phone,
                        //Fax = model.Fax,
                        //Mobile = model.Mobile,
                        Email      = model.Email,
                        WebAddress = model.WebAddress,
                        IsActive   = Convert.ToBoolean(model.IsActive)
                    };

                    return(PartialView("_Delete", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Beispiel #30
0
        public JsonResult SetSampleRequestDetailsListForSave(List <SampleRequestDetailViewModel> lstSampleRequestDetails)
        {
            var strMessage = string.Empty;

            // Clear detail list
            Session["lstSampleRequestDetails"] = null;

            try
            {
                List <SampleRequestDetailModel> list = new List <SampleRequestDetailModel>();
                var _SampleRequestModel = new SampleRequestModel();

                // Add new detail information
                foreach (var item in lstSampleRequestDetails)
                {
                    SampleRequestDetailModel entityModel = new SampleRequestDetailModel();

                    entityModel.RequestId        = item.RequestId;
                    entityModel.ProductId        = item.ProductId;
                    entityModel.RequestQuantity  = Convert.ToDecimal(item.RequestQuantity);
                    entityModel.CustomerId       = item.CustomerId;
                    entityModel.Purpose          = item.Purpose;
                    entityModel.ReceivedQuantity = Convert.ToDecimal(item.ReceivedQuantity);
                    entityModel.ReceivedDate     = item.ReceivedDate;
                    entityModel.DetailText       = item.DetailText;
                    list.Add(entityModel);
                }

                Session["lstSampleRequestDetails"] = list;
                return(Json(_SampleRequestModel, JsonRequestBehavior.AllowGet));
                //strMessage = Boolean.TrueString;
            }
            catch (Exception ex)
            {
                strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Save);
            }

            return(Json(new { strMessage = strMessage }));
        }