Exemple #1
0
        public ActionResult GetAPMCView()
        {
            APMCModel model  = new APMCModel();
            var       ApmcId = Request.QueryString["apmcid"];

            try
            {
                client = new APMCServiceClient();
                APMCDto ApmcDto = client.GetById(ApmcId != null ? Convert.ToInt32(ApmcId) : 0);
                model.APMCId     = ApmcDto.APMCId;
                model.Name       = ApmcDto.Name;
                model.Status     = ApmcDto.Status;
                model.Address    = ApmcDto.Address;
                model.ContactNos = ApmcDto.ContactNos;
                model.Website    = ApmcDto.Website;
                model.Email1     = ApmcDto.Email1;
                model.Email2     = ApmcDto.Email2;
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }
            finally
            {
                if (client != null && client.State == System.ServiceModel.CommunicationState.Opened)
                {
                    client.Close();
                }
            }
            return(View("APMCView", model));
        }
Exemple #2
0
        public ActionResult APMCListIndex()
        {
            APMCModel model = new APMCModel();

            try
            {
                model.APMCList = GetAPMCList();
                return(View("APMCList", model));
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }
        }
Exemple #3
0
        public ActionResult Apmc()
        {
            APMCModel model  = new APMCModel();
            string    mode   = Request.QueryString["mode"] != null ? Request.QueryString["mode"].ToString() : string.Empty;
            var       APMCId = Request.QueryString["apmcid"] != null ? Request.QueryString["apmcid"] : null;

            try
            {
                client = new APMCServiceClient();
                if (mode == "edit")
                {
                    FormMode = mode;
                    APMCDto apmcdto = client.GetById(APMCId != null ? Convert.ToInt32(APMCId) : 0);
                    Id               = apmcdto.APMCId;
                    model.Name       = apmcdto.Name;
                    model.Address    = apmcdto.Address;
                    model.ContactNos = apmcdto.ContactNos;
                    model.Email1     = apmcdto.Email1;
                    model.Email2     = apmcdto.Email2;
                    model.Status     = apmcdto.Status;
                    model.Website    = apmcdto.Website;
                    model.StateDistrictPlacesControlNames[0].HiddenFieldForCityVillageValue = apmcdto.Address.CityVillage.CityVillageId;
                    model.StateDistrictPlacesControlNames[0].HiddenFieldForDistrictValue    = apmcdto.Address.CityVillage.DistrictOfCityVillage.DistrictId;
                    model.StateDistrictPlacesControlNames[0].HiddenFieldForStateValue       = apmcdto.Address.CityVillage.DistrictOfCityVillage.StateOfDistrict.StateId;
                }
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }
            finally
            {
                if (client != null && client.State == System.ServiceModel.CommunicationState.Opened)
                {
                    client.Close();
                }
            }
            return(View("AddAPMC", model));
        }
Exemple #4
0
        public ClientRegistrationModel()
        {
            StateDistrictPlacesControlNames = new List <Cams.Web.MVCRazor.Models.Shared.StateDistrictCityControlNamesModel>();
            StateDistrictPlacesControlNames.Add(new Shared.StateDistrictCityControlNamesModel(""));
            designationModel = new List <DesignationModel>();
            dOBnAgeModellist = new List <DOBnAgeModel>();

            if (!IsActive)
            {
                RegistrationDate = null;
            }

            #region Company Profile
            ClientContacts = new List <ContactDetailsDto>();
            ClientContacts.Add(new ContactDetailsDto()
            {
                ContactNoType      = Common.ContactType.MobileNo,
                ContactNo          = "",
                STDCode            = "020",
                CountryCallingCode = "+91"
            });
            #endregion

            #region Initialize Primary Contact Person
            string PCPPrefix = "PCP";
            ClientPrimaryContactPerson = new ClientPrimaryContactPersonDto();
            StateDistrictPlacesControlNames.Add(new Shared.StateDistrictCityControlNamesModel(PCPPrefix));
            StateDistrictPlacesControlNames[1].LeftLabelsClassName = "width100";
            designationModel.Add(new DesignationModel(PCPPrefix));
            dOBnAgeModellist.Add(new DOBnAgeModel(PCPPrefix));
            dOBnAgeModellist[0].MaxDate = DateTime.Today;
            dOBnAgeModellist[0].Width   = 110;
            ClientPrimaryContactPerson.ClientPrimaryContacts = new List <ContactDetailsDto>();
            ClientPrimaryContactPerson.ClientPrimaryContacts.Add(new ContactDetailsDto()
            {
                ContactNoType      = Common.ContactType.MobileNo,
                ContactNo          = "",
                STDCode            = "020",
                CountryCallingCode = "+91"
            });
            #endregion

            #region Client APMC
            ClientAPMC = new APMCDto();
            GetAllCommodities();
            ApmcModel = new APMCModel();
            #endregion

            #region Subscription Details
            SubscriptionMasterList = getSubscriptionMaster();
            ClientSubscription     = new ClientSubscriptionDto();
            ClientSubscription.SubscriptionMaster         = new SubscriptionMasterDto();
            ClientSubscription.SubscriptionPeriodFromDate = DateTime.Now;
            ClientSubscription.SubscriptionPeriodToDate   = DateTime.Now;
            ClientSubscription.ActivationDate             = DateTime.Now;
            #endregion

            #region Business Constitution
            ClientBusinessConstitution = new BusinessConstitutionDto();
            businessConstitutionModel  = new BusinessConstitutionModel();
            businessConstitutionModel.ClientPartners = new List <ClientPartnerDetailsDto>();
            ClientPartners = new List <ClientPartnerDetailsDto>();
            #endregion

            #region ClientSubscriptionPaymentDetails
            ClientSubscriptionPaymentDetailsModel = new List <ClientSubscriptionPaymentDetailsModel>();
            ClientSubscriptionPaymentDetailsModel.Add(new ClientSubscriptionPaymentDetailsModel {
                PaymentMode = PaymentMode.Cash
            });
            ClientSubscriptionPaymentDetailsModel.Add(new ClientSubscriptionPaymentDetailsModel {
                PaymentMode = PaymentMode.Cheque
            });
            ClientSubscriptionPaymentDetailsModel.Add(new ClientSubscriptionPaymentDetailsModel {
                PaymentMode = PaymentMode.Online
            });
            ClientSubscriptionPaymentDetailsModel.Add(new ClientSubscriptionPaymentDetailsModel {
                PaymentMode = PaymentMode.DD
            });
            #endregion

            CompanyAddress          = new AddressReadOnlyViewModel("");
            CompanyContacts         = new ContactsReadOnlyViewModel("");
            PrimaryContactsAddress  = new AddressReadOnlyViewModel("PCP");
            PrimaryContactsContacts = new ContactsReadOnlyViewModel("PCP");
            APMCAddress             = new AddressReadOnlyViewModel("APMC");
            APMCContacts            = new ContactsReadOnlyViewModel("APMC");
            //#region Account Manager
            //accountManagerModel = new AccountManagerModel();
            //#endregion
        }
Exemple #5
0
        public ActionResult AddApmc([ModelBinder(typeof(DevExpressEditorsBinder))] APMCModel apmcmodel)
        {
            ViewData["Error"]   = null;
            TempData["Success"] = null;

            try
            {
                client = new APMCServiceClient();
                apmcmodel.StateDistrictPlacesControlNames[0].HiddenFieldForCityVillageValue =
                    !String.IsNullOrEmpty(Request.Params[apmcmodel.StateDistrictPlacesControlNames[0].PlacesComboName + "_VI"]) ?
                    Convert.ToInt32(Request.Params[apmcmodel.StateDistrictPlacesControlNames[0].PlacesComboName + "_VI"]) : 0;
                apmcmodel.StateDistrictPlacesControlNames[0].HiddenFieldForDistrictValue =
                    !String.IsNullOrEmpty(Request.Params[apmcmodel.StateDistrictPlacesControlNames[0].DistrictComboName + "_VI"]) ?
                    Convert.ToInt32(Request.Params[apmcmodel.StateDistrictPlacesControlNames[0].DistrictComboName + "_VI"]) : 0;
                apmcmodel.StateDistrictPlacesControlNames[0].HiddenFieldForStateValue =
                    !String.IsNullOrEmpty(Request.Params[apmcmodel.StateDistrictPlacesControlNames[0].StateComboName + "_VI"]) ?
                    Convert.ToInt32(Request.Params[apmcmodel.StateDistrictPlacesControlNames[0].StateComboName + "_VI"]) : 0;

                int cityVillageID = 0;
                if (ComboBoxExtension.GetValue <object>("cmbCityVillage") != null)
                {
                    cityVillageID = ComboBoxExtension.GetValue <int>("cmbCityVillage");
                    if (cityVillageID == 0)
                    {
                        ModelState.AddModelError("", ErrorAndValidationMessages.APMCCityRequired);
                    }
                }

                if (ModelState.IsValid)
                {
                    UserDto currentUserDto = (UserDto)Session[Constants.SKCURRENTUSER];
                    APMCDto apmcDto        = new APMCDto();
                    apmcDto.Name       = apmcmodel.Name;
                    apmcDto.Status     = apmcmodel.Status;
                    apmcDto.Website    = apmcmodel.Website;
                    apmcDto.Email1     = apmcmodel.Email1;
                    apmcDto.Email2     = apmcmodel.Email2;
                    apmcDto.ModifiedBy = currentUserDto.UserId;

                    if (apmcmodel.ContactNos != null)
                    {
                        apmcDto.ContactNos = apmcmodel.ContactNos;
                        if (apmcDto.ContactNos != null && apmcDto.ContactNos.Count == 1)
                        {
                            if (String.IsNullOrEmpty(apmcDto.ContactNos[0].ContactNo))
                            {
                                apmcDto.ContactNos.RemoveAt(0);
                            }
                        }


                        if (apmcmodel.Address != null)
                        {
                            apmcDto.Address = apmcmodel.Address;
                            //if (ComboBoxExtension.GetValue<object>("cmbCityVillage") != null)
                            //{
                            //    cityVillageID = ComboBoxExtension.GetValue<int>("cmbCityVillage");
                            apmcDto.Address.AddressLine1 = apmcmodel.Address.AddressLine1;
                            apmcDto.Address.PIN          = apmcmodel.Address.PIN;
                            apmcDto.Address.CityVillage  = new CityVillageDto
                            {
                                CityVillageId = cityVillageID
                            };
                            //}
                        }
                    }

                    if (FormMode == "edit")
                    {
                        APMCDto ExistingAPMCDto = client.GetById(Id);
                        apmcDto.APMCId = Id;
                        apmcDto        = client.Update(apmcDto, currentUserDto.UserName);
                    }
                    else
                    {
                        apmcDto.CreatedBy = currentUserDto.UserId;
                        apmcDto           = client.Create(apmcDto, currentUserDto.UserName);
                    }

                    if (apmcDto.Response.HasWarning)
                    {
                        ViewData["Error"] = ErrorAndValidationMessages.APMCExists;
                    }
                    else
                    {
                        if (FormMode == "edit")
                        {
                            TempData["Success"] = string.Format(ClientResources.APMCUpdated, apmcDto.Name);
                        }
                        else
                        {
                            TempData["Success"] = string.Format(ClientResources.APMCSaved, apmcDto.Name);
                        }
                        FormMode = string.Empty;
                        return(RedirectToAction("APMCListIndex", "Masters"));
                    }
                }
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }
            finally
            {
                if (client != null && client.State == System.ServiceModel.CommunicationState.Opened)
                {
                    client.Close();
                }
            }
            return(View(apmcmodel));
        }
Exemple #6
0
 public ActionResult APMCListGridView(APMCModel model)
 {
     model.APMCList = GetAPMCList();
     return(PartialView("APMCListGridView", model));
 }