예제 #1
0
    private bool Delete(int intPKID)
    {
        bool retval = false;

        objState = new tblState();
        tblCity objCity = new tblCity();

        if (objState.LoadByPrimaryKey(intPKID))
        {
            objCity.Where.AppStateID.Value = intPKID;
            objCity.Query.Load();
            if (objCity.RowCount > 0)
            {
                retval = false;
            }
            else
            {
                objState.MarkAsDeleted();
                objState.Save();
                retval = true;
            }
        }
        objCity  = null;
        objState = null;
        return(retval);
    }
예제 #2
0
    private bool SaveData()
    {
        objCommon = new clsCommon();
        if (objCommon.IsRecordExists("tblState", tblState.ColumnNames.AppState, tblState.ColumnNames.AppStateID, txtState.Text, hdnPKID.Value))
        {
            DInfo.ShowMessage(" State already exits.", Enums.MessageType.Error);
            return(false);
        }
        objCommon = null;

        objState = new tblState();
        if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
        {
            objState.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));
        }
        else
        {
            objState.AddNew();
        }
        objState.AppState       = txtState.Text;
        objState.s_AppCountryID = ddlCountry.SelectedValue.ToString();
        objState.Save();
        iStateID = objState.AppStateID;
        objState = null;
        return(true);
    }
예제 #3
0
 private void SetValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
     {
         objPinCode = new tblPinCode();
         if (objPinCode.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
         {
             txtPINCode.Text     = objPinCode.AppPinCode.ToString();
             chkIsActive.Checked = objPinCode.AppIsActive;
             tblCity objCity = new tblCity();
             if (objCity.LoadByPrimaryKey(objPinCode.AppCityID))
             {
                 objCommon = new clsCommon();
                 tblState objState = new tblState();
                 if (objState.LoadByPrimaryKey(objCity.AppStateID))
                 {
                     ddlCountry.SelectedValue = objState.s_AppCountryID;
                     objCommon.FillDropDownList(ddlState, "tblState", tblState.ColumnNames.AppState, tblState.ColumnNames.AppStateID, "-- Select State --", tblState.ColumnNames.AppCountryID + "=" + ddlCountry.SelectedValue);
                     ddlState.SelectedValue = objState.s_AppStateID;
                     objCommon.FillDropDownList(ddlCity, "tblCity", tblCity.ColumnNames.AppCity, tblCity.ColumnNames.AppCityID, "-- Select City --", tblCity.ColumnNames.AppStateID + "=" + ddlState.SelectedValue);
                     ddlCity.SelectedValue = objCity.s_AppCityID;
                 }
                 objState  = null;
                 objCommon = null;
             }
             objCity = null;
         }
         objPinCode = null;
     }
 }
예제 #4
0
 private void SetValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
     {
         objState = new tblState();
         if (objState.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
         {
             txtState.Text            = objState.AppState.ToString();
             ddlCountry.SelectedValue = objState.s_AppCountryID;
         }
         objState = null;
     }
 }