Example #1
0
        public async Task <ActionResult> Edit(int?courierId)
        {
            using (var con = new SqlConnection(_connectionString))
            {
                var folder = "/UploadedImages/Courier/";
                var result = con.Query <ManageCourierModel>("SELECT * from Courier_Master WHERE CourierId=@CourierId", new { CourierId = courierId },
                                                            commandType: CommandType.Text).FirstOrDefault();
                result.UploadedCourierFileUrl = folder + "Logo/" + result.UploadedCourierFile;
                result.UploadedGSTFileUrl     = folder + "Gst/" + result.UploadedGSTFile;
                result.UserPANCardFileUrl     = folder + "PanCards/" + result.UserPANCardFile;
                result.VoterIDFileUrl         = folder + "VoterCards/" + result.VoterIDFile;
                result.AadhaarCardFileUrl     = folder + "AdharCards/" + result.AadhaarCardFile;
                result.AgreementScanFileUrl   = folder + "ScanAgreement/" + result.AgreementScanFile;
                result.CancelledChequeFileUrl = folder + "CancelledCheques/" + result.CancelledChequeFile;
                if (result != null)
                {
                    result.Country       = result.CountryId;
                    result.StateDropdown = result.StateId;
                    result.CityDropdown  = result.CityId;

                    result.PinCodeDropdown       = result.Pincode;
                    result.SC_CountryDropdown    = result.SC_Country;
                    result.PersonCountryDropdown = result.PersonCountry;
                    result.PersonCityDropdown    = result.PersonCity;
                    result.PersonStateDropdown   = result.PersonState;
                    result.SC_PincodeDropdown    = result.SC_Pincode;
                    string volume = result.Volume.ToString();
                    result.CountryList                   = new SelectList(dropdown.BindCountry(), "Value", "Text");
                    result.StateList                     = new SelectList(dropdown.BindState(), "Value", "Text");
                    result.CityList                      = new SelectList(dropdown.BindLocation(), "Value", "Text");
                    result.PincodeList                   = new SelectList(dropdown.BindPincodeListByCountry(Convert.ToInt32(result.SC_Country)), "Value", "Text");
                    result.ApplicableTaxTypeList         = new SelectList(await CommonModel.GetApplicationTaxType(), "Value", "Text");
                    result.PersonAddressTypeList         = new SelectList(CommonModel.GetAddressTypes(), "Value", "Text");
                    result.AWBNumberUsedList             = new SelectList(await CommonModel.GetAWBNumberUsedTypes(), "Value", "Text");
                    result.AgreementSignupList           = new SelectList(await CommonModel.GetAgreementSignup(), "Value", "Text");
                    result.LegalDocumentVerificationList = new SelectList(await CommonModel.GetLegalDocumentVerification(), "Value", "Text");
                    string[] parts = volume.ToString().Split('-');
                    result.Volumn1 = parts[0];
                    result.Volumn2 = parts[1];
                    string   weight = result.WeightRange.ToString();
                    string[] parts1 = weight.ToString().Split('-');
                    result.WeightRange1       = parts[0];
                    result.WeightRange2       = parts[1];
                    result.AgreementEndDate   = Convert.ToDateTime(result.AgreementEndDate).ToString("MM-dd-yyyy");
                    result.AgreementStartDate = Convert.ToDateTime(result.AgreementStartDate).ToString("MM-dd-yyyy");
                    result.ApplicableFromDate = Convert.ToDateTime(result.ApplicableFromDate).ToString("MM-dd-yyyy");
                }

                return(View(result));
            }
        }
Example #2
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));
        }
Example #3
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));
            }
        }