Exemplo n.º 1
0
        public async Task <ActionResult> Create()
        {
            DropdownBindController drop         = new DropdownBindController();
            ManageCourierModel     courierModel = new ManageCourierModel
            {
                CountryList                   = new SelectList(dropdown.BindCountry(), "Value", "Text"),
                StateList                     = new SelectList(Enumerable.Empty <SelectListItem>()),
                CityList                      = new SelectList(Enumerable.Empty <SelectListItem>()),
                PincodeList                   = new SelectList(Enumerable.Empty <SelectListItem>()),
                ApplicableTaxTypeList         = new SelectList(await CommonModel.GetApplicationTaxType(), "Value", "Text"),
                PersonAddressTypeList         = new SelectList(CommonModel.GetAddressTypes(), "Value", "Text"),
                AWBNumberUsedList             = new SelectList(await CommonModel.GetAWBNumberUsedTypes(), "Value", "Text"),
                AgreementSignupList           = new SelectList(await CommonModel.GetAgreementSignup(), "Value", "Text"),
                LegalDocumentVerificationList = new SelectList(await CommonModel.GetLegalDocumentVerification(), "Value", "Text")
            };

            return(View(courierModel));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Create(ManageCourierModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (var con = new SqlConnection(_connectionString))
                    {
                        string UploadedCourierFile = SaveImageFile(model.UploadedCourierFilePath, "Courier/Logo");
                        string UploadedGSTFile     = SaveImageFile(model.UploadedGSTFilePath, "Courier/Gst");
                        string PANCardFile         = SaveImageFile(model.PANCardFilePath, "Courier/PanCards");
                        string UserPANCardFile     = SaveImageFile(model.UserPANCardFilePath, "Courier/Pancards");
                        string VoterIDFile         = SaveImageFile(model.VoterIDFilePath, "Courier/VoterCards");
                        string AadhaarCardFile     = SaveImageFile(model.AadhaarCardFilePath, "Courier/AdharCards");
                        string AgreementScanFile   = SaveImageFile(model.AgreementScanFilePath, "Courier/ScanAgreement");
                        string CancelledChequeFile = SaveImageFile(model.CancelledChequeFilePath, "Courier/CancelledCheques");
                        var    result = con.Query <int>("Add_Modify_Delete_Courier",
                                                        new
                        {
                            //Settings
                            model.CourierId,
                            model.CourierName,
                            model.CourierCode,
                            model.CourierBrandName,
                            model.Priority,
                            model.CourierTAT,
                            model.AWBNumber,
                            //CountryId = model.Country,
                            //StateId = model.StateDropdown,
                            // CityId = model.CityDropdown,
                            model.CountryId,
                            model.StateId,
                            model.CityId,

                            UploadedCourierFile,
                            model.IsReverse,
                            model.IsAllowPreference,
                            //Organisation
                            model.CourierCompanyName,
                            model.OrganizationCode,
                            model.StatutoryType,
                            model.ApplicableTaxType,
                            model.GSTNumber,
                            UploadedGSTFile,
                            model.PANCardNumber,
                            PANCardFile,
                            model.BikeMakeandModel,
                            model.BikeNumber,
                            //Address and Contact Person
                            model.PersonAddresstype,
                            PersonCountry = model.PersonCountryDropdown,
                            PersonState   = model.PersonStateDropdown,
                            PersonCity    = model.PersonCityDropdown,
                            model.FullAddress,
                            model.Locality,
                            model.NearByLocation,
                            model.Pincode,
                            model.FirstName,
                            model.LastName,
                            model.MobileNumber,
                            model.EmailAddress,
                            model.UserPANCard,
                            UserPANCardFile,
                            model.VoterIDCardNo,
                            VoterIDFile,
                            model.AadhaarCardNo,
                            AadhaarCardFile,
                            model.IsUser,
                            //Service Charge
                            SC_Country = model.SC_CountryDropdown,
                            SC_Pincode = model.SC_PincodeDropdown,
                            model.Currency,
                            model.ServiceChargeType,
                            model.ValueRange,
                            WeightRange = model.WeightRange1 + "-" + model.WeightRange2,
                            Volume      = model.Volumn1 + "-" + model.Volumn2,
                            model.ServiceCharge,
                            model.ApplicableFromDate,
                            model.ItemType,
                            //Agreement
                            model.LegalDocumentVerificationStatus,
                            model.AgreementSignupStatus,
                            model.AgreementStartDate,
                            model.AgreementEndDate,
                            model.AgreementNumber,
                            AgreementScanFile,
                            //Bank Details
                            model.BankName,
                            model.BankAccountNumber,
                            model.CompanyNameatBank,
                            model.IFSCCode,
                            model.BankBranch,
                            CancelledChequeFile,
                            model.PaymentCycle,
                            //Registration
                            model.LuluandSky_Status,
                            model.Comments,
                            model.IsActive,
                            User = CurrentUser.UserId,
                            CurrentUser.CompanyId,
                            Action = "I",
                        }, commandType: CommandType.StoredProcedure).FirstOrDefault();
                        var response = new ResponseModel();
                        if (result == 1)
                        {
                            response.IsSuccess   = true;
                            response.Response    = "New Courier Successfully Added ";
                            TempData["response"] = response;
                        }

                        else
                        {
                            response.IsSuccess   = true;
                            response.Response    = "Courier Already Exist ";
                            TempData["response"] = response;
                        }
                    }
                    //return View(model);
                    return(RedirectToAction("ManageCourier"));
                }
                else
                {
                    model.CountryList                   = new SelectList(dropdown.BindCountry(), "Value", "Text");
                    model.StateList                     = new SelectList(Enumerable.Empty <SelectListItem>());
                    model.CityList                      = new SelectList(Enumerable.Empty <SelectListItem>());
                    model.PincodeList                   = new SelectList(Enumerable.Empty <SelectListItem>());
                    model.ApplicableTaxTypeList         = new SelectList(await CommonModel.GetApplicationTaxType(), "Value", "Text");
                    model.PersonAddressTypeList         = new SelectList(CommonModel.GetAddressTypes(), "Value", "Text");
                    model.AWBNumberUsedList             = new SelectList(await CommonModel.GetAWBNumberUsedTypes(), "Value", "Text");
                    model.AgreementSignupList           = new SelectList(await CommonModel.GetAgreementSignup(), "Value", "Text");
                    model.LegalDocumentVerificationList = new SelectList(await CommonModel.GetLegalDocumentVerification(), "Value", "Text");
                    return(View(model));
                }
            }
            catch (Exception e)
            {
                model.CountryList                   = new SelectList(dropdown.BindCountry(), "Value", "Text");
                model.StateList                     = new SelectList(Enumerable.Empty <SelectListItem>());
                model.CityList                      = new SelectList(Enumerable.Empty <SelectListItem>());
                model.PincodeList                   = new SelectList(Enumerable.Empty <SelectListItem>());
                model.ApplicableTaxTypeList         = new SelectList(await CommonModel.GetApplicationTaxType(), "Value", "Text");
                model.PersonAddressTypeList         = new SelectList(CommonModel.GetAddressTypes(), "Value", "Text");
                model.AWBNumberUsedList             = new SelectList(await CommonModel.GetAWBNumberUsedTypes(), "Value", "Text");
                model.AgreementSignupList           = new SelectList(await CommonModel.GetAgreementSignup(), "Value", "Text");
                model.LegalDocumentVerificationList = new SelectList(await CommonModel.GetLegalDocumentVerification(), "Value", "Text");

                return(View(model));
            }
        }