Exemple #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);
    }
    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);
    }