Exemplo n.º 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));
        }
Exemplo n.º 2
0
        public virtual void UpdateAPMC()
        {
            var     Apmcid  = 4;
            APMCDto apmcdto = this.ApmcService.GetById(Apmcid);
            //apmcdto.APMCId = A;
            List <ContactDetailsDto> contacts = new List <ContactDetailsDto>();

            contacts.Add(new ContactDetailsDto()
            {
                ContactNoType = Cams.Common.ContactType.MobileNo, ContactNo = "1234567890"
            });
            apmcdto.ContactNos = contacts;


            this.APMCInstance = this.ApmcService.Update(apmcdto, CurrentUserInstance.UserName);
            Assert.IsFalse(this.APMCInstance.APMCId == 0, "APMCId should have been updated");
            Assert.AreEqual(this.APMCInstance.Name, apmcdto.Name, "APMC Name are different");
        }
Exemplo n.º 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));
        }
Exemplo n.º 4
0
        /// <summary>
        /// This function return data in Json format to JavaScript function:APMCSelect()
        /// which is in Companyprofile.cshtml script section
        /// </summary>
        /// <param name="apmcId"></param>
        /// <returns></returns>
        public JsonResult GetSelectedApmcDetails(int apmcId)
        {
            APMCMasterServiceReference.APMCServiceClient apmcServiceClient = new APMCServiceClient();
            List <string> jsonResult = new List <string>();
            string        email      = string.Empty;
            string        mobileNo   = string.Empty;
            string        address    = string.Empty;
            string        state      = string.Empty;
            string        country    = string.Empty;

            try
            {
                APMCDto apmcDto = apmcServiceClient.GetById(apmcId);
                if (apmcDto != null)
                {
                    email = apmcDto.Email1;
                    email = !String.IsNullOrEmpty(apmcDto.Email2) ? email + "<br />" + apmcDto.Email2 : email;
                    email = !String.IsNullOrEmpty(apmcDto.Website) ? email + "<br />" + apmcDto.Website : email;

                    if (apmcDto.ContactNos != null && apmcDto.ContactNos.Count > 0)
                    {
                        foreach (ContactDetailsDto contact in apmcDto.ContactNos)
                        {
                            if (contact.ContactNoType != Cams.Common.ContactType.MobileNo)
                            {
                                mobileNo += "(" + contact.CountryCallingCode + ") - " + contact.STDCode + " - " + contact.ContactNo + "<br />";
                            }
                            else
                            {
                                mobileNo += "(" + contact.CountryCallingCode + ") - " + contact.ContactNo + "<br />";
                            }
                        }
                    }
                    if (apmcDto.Address != null && apmcDto.Address.CityVillage != null &&
                        apmcDto.Address.CityVillage.DistrictOfCityVillage != null)
                    {
                        address = apmcDto.Address.AddressLine1 + ",<br/>" + apmcDto.Address.CityVillage.Name + ","
                                  + apmcDto.Address.CityVillage.DistrictOfCityVillage.DistrictName + ",<br/>"
                                  + apmcDto.Address.PIN;

                        if (apmcDto.Address.CityVillage.DistrictOfCityVillage.StateOfDistrict != null)
                        {
                            state = apmcDto.Address.CityVillage.DistrictOfCityVillage.StateOfDistrict.RegionName;

                            if (apmcDto.Address.CityVillage.DistrictOfCityVillage.StateOfDistrict.StateInCountry != null)
                            {
                                country = apmcDto.Address.CityVillage.DistrictOfCityVillage.StateOfDistrict.StateInCountry.CountryName;
                            }
                        }
                    }

                    jsonResult.Add(email);
                    jsonResult.Add(mobileNo);
                    jsonResult.Add(address);
                    jsonResult.Add(state);
                    jsonResult.Add(country);
                }
            }
            catch (Exception ex)
            { }
            finally
            {
                if (apmcServiceClient != null && apmcServiceClient.State == System.ServiceModel.CommunicationState.Opened)
                {
                    apmcServiceClient.Close();
                }
            }
            return(Json(jsonResult));
        }
Exemplo n.º 5
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
        }
Exemplo n.º 6
0
 public APMCDto Create(APMCDto ApmcDto, string userName)
 {
     return(ExecuteCommand(() => Service.Create(ApmcDto, userName)));
 }
Exemplo n.º 7
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));
        }
Exemplo n.º 8
0
        public ActionResult AddNewApmcUsingPopup()
        {
            UserDto currentUserDto = (UserDto)Session[Constants.SKCURRENTUSER];
            APMCDto apmcDto        = new APMCDto();
            CityVillageServiceClient cityVillageServiceClient = new CityVillageServiceClient();

            client = new APMCServiceClient();
            try
            {
                apmcDto.Name    = Request.Params["ApmcName"];
                apmcDto.Address = new AddressDto();
                apmcDto.Address.AddressLine1 = Request.Params["APMCAddress"];
                apmcDto.Address.PIN          = Request.Params["ApmcPin"];
                apmcDto.Website     = Request.Params["ApmcWebsite"];
                apmcDto.Email1      = Request.Params["ApmcEmail1"];
                apmcDto.Email2      = Request.Params["ApmcEmail2"];
                apmcDto.Address.PIN = Request.Params["ApmcPin"];
                apmcDto.Status      = Request.Params["Status"];

                apmcDto.CreatedBy    = currentUserDto.UserId;
                apmcDto.CreatedDate  = DateTime.Now;
                apmcDto.ModifiedBy   = currentUserDto.UserId;
                apmcDto.ModifiedDate = DateTime.Now;

                Query     query        = new Query();
                Criterion criteriaName = new Criterion("Name", Request.Params["ApmcPlace"], CriteriaOperator.Equal);
                query.Add(criteriaName);
                query.QueryOperator         = QueryOperator.And;
                apmcDto.Address.CityVillage = cityVillageServiceClient.FindByQuery(query).Entities[0];

                apmcDto.ContactNos = new List <ContactDetailsDto>();
                for (int i = 0; i < 4; i++)
                {
                    if (Request.Params["ApmcContactNos" + i] != null)
                    {
                        ContactDetailsDto contactDetailsDto = new ContactDetailsDto();
                        contactDetailsDto.ContactNo = Request.Params["ApmcContactNos" + i];

                        switch (Request.Params["ApmcContactNos" + i + "_ContactType"])
                        {
                        case "MobileNo":
                            contactDetailsDto.ContactNoType = ContactType.MobileNo;
                            break;

                        case "OfficeNo":
                            contactDetailsDto.ContactNoType = ContactType.OfficeNo;
                            contactDetailsDto.STDCode       = Request.Params["ContactNos_" + i + "__STDCode"];
                            break;

                        case "ResidenceNo":
                            contactDetailsDto.ContactNoType = ContactType.ResidenceNo;
                            contactDetailsDto.STDCode       = Request.Params["ContactNos_" + i + "__STDCode"];
                            break;

                        case "Fax":
                            contactDetailsDto.ContactNoType = ContactType.Fax;
                            contactDetailsDto.STDCode       = Request.Params["ContactNos_" + i + "__STDCode"];
                            break;
                        }
                        apmcDto.ContactNos.Add(contactDetailsDto);
                    }
                }
                apmcDto = client.Create(apmcDto, currentUserDto.UserName);
                if (apmcDto.Response.HasWarning)
                {
                    ViewData["Apmcpresent"] = ErrorAndValidationMessages.APMCExists;
                }
                else
                {
                    ViewData["ApmcSaved"] = string.Format(ClientResources.APMCSaved, apmcDto.Name);
                }
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }
            finally
            {
                if (client != null && client.State == System.ServiceModel.CommunicationState.Opened)
                {
                    client.Close();
                }

                if (cityVillageServiceClient != null && cityVillageServiceClient.State == System.ServiceModel.CommunicationState.Opened)
                {
                    cityVillageServiceClient.Close();
                }
            }
            return(null);
        }
Exemplo n.º 9
0
 public APMCDto Create(APMCDto ApmcDto, string userName)
 {
     return(ExecuteCommand(proxy => proxy.Create(ApmcDto, userName)));
 }