Exemple #1
0
if (!isset($countryObj)) {
    include_once SITE_CLASS_APPLICATION . "class.Country.php";
    $countryObj = new Country();
}
$view = PostVar("view");
$Data = PostVar("Data");
$iStateId = PostVar("iStateId");
$cntcode = $countryObj->getCountryDetail("vCountryCode", "AND iCountryId = '{$Data['iCountryId']}'");
$Data['vCountryCode'] = $cntcode[0]['vCountryCode'];
/** This is for Check Duplicate Record-------------------------------------------*/
$generalobj->getRequestVars();
$redirect_file = "index.php?file={$file}&view={$view}&iStateId={$iStateId}";
$generalobj->checkDuplicate('iStateId', PRJ_DB_PREFIX . "_state_master", array('vState' => $Data['vState']), $redirect_file, STATE_ALREADY_EXISTS, $iStateId);
if ($view == "add") {
    //prints($Data);exit;
    $stateObj->setAllVar($Data);
    $id = $stateObj->insert();
    if ($id) {
        $var_msg = "Record Added Successfully.";
    } else {
        $var_msg = "Eror-in Add.";
    }
} else {
    if ($view == "edit") {
        //prints($Data);exit;
        $arr = $stateObj->select($iStateId);
        $stateObj->setAllVar($arr);
        $stateObj->setAllVar($Data);
        $where = " iStateId = '" . $iStateId . "'";
        $id = $stateObj->update($where);
        if ($id) {
<?php

include_once $CFG->dirroot . "/lib/classes/" . "application/State.Class.php5";
$StateObj = new State();
$GeneralObj->getRequestVars();
$StateObj->setAllVar();
$redirect_file = "index.php?file=t-state_masteradd&mode={$mode}&iId={$iStateId}";
$message = "State Already Exist";
$GeneralObj->checkDuplicate('iStateId', 'state_master', array('vStateCode', 'vCountryCode'), $redirect_file, $message, $iStateId, ' AND ');
if ($mode == "Add") {
    $StateObj->insert();
    $msg = MSG_ADD;
    header("Location:index.php?file=State&AX=Yes&var_msg={$msg}");
    exit;
} else {
    if ($mode == "Update") {
        $StateObj->update($iStateId);
        $msg = MSG_UPDATE;
        header("Location:index.php?file=State&AX=Yes&var_msg={$msg}");
        exit;
    }
}