Exemple #1
0
    /// <summary>
    /// Used insert an item group
    /// </summary>
    /// <param name="igdi"></param>
    /// <param name="lItemGroupID"></param>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatus"></param>
    /// <returns></returns>
    public CStatus InsertItemGroup(CItemGroupDataItem igdi, out long lItemGroupID)
    {
        //initialize parameters
        lItemGroupID = 0;

        //create a status object and check for valid dbconnection
        CStatus status = DBConnValid();

        if (!status.Status)
        {
            return(status);
        }

        //load the paramaters list
        CParameterList pList = new CParameterList(SessionID,
                                                  ClientIP,
                                                  UserID);

        //add the rest of the parameters
        pList.AddInputParameter("pi_vItemGroupLabel", igdi.ItemGroupLabel);
        pList.AddInputParameter("pi_nIsActive", (long)((igdi.IsActive) ? k_TRUE_FALSE_ID.True : k_TRUE_FALSE_ID.False));
        pList.AddOutputParameter("po_nItemGroupID", igdi.ItemGroupID);

        //execute the SP
        status = DBConn.ExecuteOracleSP("PCK_VARIABLE.InsertItemGroup", pList);

        if (status.Status)
        {
            //get the TS_ID returned from the SP call
            lItemGroupID = pList.GetParamLongValue("po_nItemGroupID");
        }

        return(status);
    }
    /// <summary>
    /// method
    /// creates a new item group data item and loads it with the values from the dialog
    /// </summary>
    /// <returns></returns>
    private CItemGroupDataItem LoadNewDataItem()
    {
        CItemGroupDataItem di = new CItemGroupDataItem();

        di.ItemGroupID    = -1;
        di.ItemGroupLabel = txtItemGroupLabel.Text;
        di.IsActive       = chkItemGroupActive.Checked;
        return(di);
    }
    /// <summary>
    /// update an item group
    /// </summary>
    /// <param name="lItemGroupID"></param>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatusComment"></param>
    /// <returns></returns>
    private CStatus UpdateItemGroup(long lItemGroupID)
    {
        //create a new data item and load it
        CItemGroupDataItem igdi = LoadNewDataItem();

        igdi.ItemGroupID = lItemGroupID;

        CItemGroupData igData = new CItemGroupData(BaseMstr.BaseData);

        return(igData.UpdateItemGroup(igdi));
    }
    /// <summary>
    /// helper to insert an item group
    /// </summary>
    /// <param name="lItemGroupID"></param>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatusComment"></param>
    /// <returns></returns>
    private CStatus InsertItemGroup(out long lItemGroupID)
    {
        lItemGroupID = -1;

        CItemGroupDataItem igdi = LoadNewDataItem();

        //save the data item
        CItemGroupData igd    = new CItemGroupData(BaseMstr.BaseData);
        CStatus        status = igd.InsertItemGroup(igdi, out lItemGroupID);

        if (status.Status)
        {
            LongID = lItemGroupID;
        }

        return(status);
    }
Exemple #5
0
    /// <summary>
    /// Used to get a dataset holding 1 item group by id
    /// </summary>
    /// <param name="lItemGroupID"></param>
    /// <param name="ds"></param>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatus"></param>
    /// <returns></returns>
    public CStatus GetItemGroupDI(long lItemGroupID, out CItemGroupDataItem di)
    {
        //initialize parameters
        di = null;

        //create a status object and check for valid dbconnection
        CStatus status = DBConnValid();

        if (!status.Status)
        {
            return(status);
        }

        //load the paramaters list
        CParameterList pList = new CParameterList(
            SessionID,
            ClientIP,
            UserID);

        pList.AddInputParameter("pi_nItemGroupID", lItemGroupID);

        //get the dataset
        CDataSet cds = new CDataSet();
        DataSet  ds  = null;

        status = cds.GetOracleDataSet(
            DBConn,
            "PCK_VARIABLE.GetItemGroupIDRS",
            pList,
            out ds);
        if (!status.Status)
        {
            return(status);
        }

        di = new CItemGroupDataItem(ds);

        return(new CStatus());
    }
Exemple #6
0
    /// <summary>
    /// Used to update an item group
    /// </summary>
    /// <param name="igdi"></param>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatus"></param>
    /// <returns></returns>
    public CStatus UpdateItemGroup(CItemGroupDataItem igdi)
    {
        //create a status object and check for valid dbconnection
        CStatus status = DBConnValid();

        if (!status.Status)
        {
            return(status);
        }

        //load the paramaters list
        CParameterList pList = new CParameterList(SessionID,
                                                  ClientIP,
                                                  UserID);

        //add the rest of the parameters
        pList.AddInputParameter("pi_nItemGroupID", igdi.ItemGroupID);
        pList.AddInputParameter("pi_vItemGroupLabel", igdi.ItemGroupLabel);
        pList.AddInputParameter("pi_nIsActive", (long)((igdi.IsActive) ? k_TRUE_FALSE_ID.True : k_TRUE_FALSE_ID.False));

        //execute the SP
        return(DBConn.ExecuteOracleSP("PCK_VARIABLE.UpdateItemGroup", pList));
    }