Exemplo n.º 1
0
    private int updateDate(int type, int intId)
    {
        int intret = -1;

        using (Transaction t = new Transaction("conn"))
        {
            try
            {
                V_WEC_MODEL_SET cond = new V_WEC_MODEL_SET();
                cond.TYPE = type;
                cond.A_ID = Convert.ToInt32(userBase2.Curraid);
                V_WEC_MODEL_SET obj = BLLTable <V_WEC_MODEL_SET> .Factory(t).GetRowData(cond);

                if (obj != null)
                {
                    //删除原来的模版
                    intret = BLLTable <WEC_MODEL_SET> .Factory(t).Delete(Convert.ToInt32(obj.ID));
                }

                //添加新的模版
                WEC_MODEL_SET valObj = new WEC_MODEL_SET();
                valObj.M_ID = intId;
                valObj.A_ID = Convert.ToInt32(userBase2.Curraid);
                intret      = BLLTable <WEC_MODEL_SET> .Factory(t).Insert(valObj, WEC_MODEL_SET.Attribute.ID);

                t.Commit();
            }
            catch
            {
                t.RollBack();
                return(intret);
            }
        }
        return(intret);
    }
Exemplo n.º 2
0
    private int updateDate(int type, int intId)
    {
        int intret = -1;

        using (Transaction t = new Transaction("conn"))
        {
            try
            {
                V_WEC_MODEL_SET cond = new V_WEC_MODEL_SET();
                cond.TYPE = type;
                cond.A_ID = Convert.ToInt32(userBase2.Curraid);
                V_WEC_MODEL_SET obj = BLLTable<V_WEC_MODEL_SET>.Factory(t).GetRowData(cond);

                if (obj != null)
                {
                    //删除原来的模版
                    intret = BLLTable<WEC_MODEL_SET>.Factory(t).Delete(Convert.ToInt32(obj.ID));
                }

                //添加新的模版
                WEC_MODEL_SET valObj = new WEC_MODEL_SET();
                valObj.M_ID = intId;
                valObj.A_ID = Convert.ToInt32(userBase2.Curraid);
                intret = BLLTable<WEC_MODEL_SET>.Factory(t).Insert(valObj, WEC_MODEL_SET.Attribute.ID);

                t.Commit();
            }
            catch
            {
                t.RollBack();
                return intret;
            }
        }
        return intret;
    }