コード例 #1
0
        private void fillgrdStateList(Guid CountryID)
        {
            try
            {
                var result = _objMaster.GetStatesMaster(new MDMSVC.DC_State_Search_RQ()
                {
                    Country_Id = CountryID, PageNo = intpageindexState, PageSize = pagesizeState
                });
                grdStateList.PageIndex  = intpageindexState;
                grdStateList.DataSource = result;
                if (result != null)
                {
                    if (result.Count > 0)
                    {
                        grdStateList.PageSize         = pagesizeState;
                        grdStateList.VirtualItemCount = result[0].TotalRecords;
                    }
                }

                grdStateList.DataBind();
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        protected void frmvwCity_ItemCommand(object sender, FormViewCommandEventArgs e)
        {
            TextBox      txtCityName         = (TextBox)frmvwCity.FindControl("txtCityName");
            TextBox      txtCityCode         = (TextBox)frmvwCity.FindControl("txtCityCode");
            DropDownList ddlStates           = (DropDownList)frmvwCity.FindControl("ddlStates");
            DropDownList ddlStatus           = (DropDownList)frmvwCity.FindControl("ddlStatus");
            Guid         ddlCountry_Id_Value = Guid.Parse(ddlCountry.SelectedValue);

            if (Convert.ToString(e.CommandName) == "AddCity")
            {
                var            stateid        = Guid.Parse(Convert.ToString(ddlStates.SelectedValue).Trim());
                var            status         = Convert.ToString(ddlStatus.SelectedValue);
                MDMSVC.DC_City _objCityMaster = new MDMSVC.DC_City();
                _objCityMaster.City_Id  = Guid.NewGuid();
                _objCityMaster.Name     = Convert.ToString(txtCityName.Text).Trim();
                _objCityMaster.Code     = Convert.ToString(txtCityCode.Text).Trim();
                _objCityMaster.State_Id = stateid;
                //Get Country Details
                var resultCountry = _objMasterData.GetCountryMasterData(new MDMSVC.DC_Country_Search_RQ()
                {
                    Country_Id = ddlCountry_Id_Value
                });
                if (resultCountry != null)
                {
                    _objCityMaster.Country_Id     = ddlCountry_Id_Value;
                    _objCityMaster.CountryCode    = resultCountry[0].Code;
                    _objCityMaster.CountryName    = Convert.ToString(resultCountry[0].Name).Trim();
                    _objCityMaster.Google_PlaceId = Convert.ToString(resultCountry[0].GooglePlaceID);
                }
                //Get State detils
                var resultState = _objMasterData.GetStatesMaster(new MDMSVC.DC_State_Search_RQ()
                {
                    State_Id = stateid
                });
                if (resultState != null)
                {
                    _objCityMaster.State_Id  = stateid;
                    _objCityMaster.StateName = Convert.ToString(resultState[0].State_Name).Trim();
                    _objCityMaster.StateCode = Convert.ToString(resultState[0].State_Code).Trim();
                }
                _objCityMaster.Create_User = System.Web.HttpContext.Current.User.Identity.Name;
                _objCityMaster.Create_Date = DateTime.Now;
                _objCityMaster.Status      = status;
                MDMSVC.DC_Message _msg = _objMasterData.AddCityMasterData(_objCityMaster);
                if (_msg.StatusCode == MDMSVC.ReadOnlyMessageStatusCode.Success)
                {
                    fillgvCityyList(ddlCountry_Id_Value, 0);
                    hdnFlagCity.Value  = "true";
                    dvMsgCity2.Visible = true;
                    BootstrapAlert.BootstrapAlertMessage(dvMsgCity2, _msg.StatusMessage, BootstrapAlertType.Success);
                }
                else
                {
                    dvMsgCity2.Visible = true;
                    BootstrapAlert.BootstrapAlertMessage(dvmsgCityAlert, _msg.StatusMessage, (BootstrapAlertType)_msg.StatusCode);
                }
            }
            txtCityName.Text        = String.Empty;
            txtCityCode.Text        = String.Empty;
            ddlStates.SelectedIndex = 0;
            ddlStatus.SelectedIndex = 0;
        }