Exemplo n.º 1
0
    public static string SaveDataAttr(string strPointID, string strAttrID, string strAttribute)
    {
        bool isSuccess = true;
        TMisMonitorTaskPointVo objPoint = new TMisMonitorTaskPointVo();

        objPoint.ID = strPointID;
        objPoint.DYNAMIC_ATTRIBUTE_ID = strAttrID;
        isSuccess = new TMisMonitorTaskPointLogic().Edit(objPoint);

        TBaseAttrbuteValue3Logic logicAttrValue = new TBaseAttrbuteValue3Logic();
        //清掉原有动态属性值
        TBaseAttrbuteValue3Vo objAttrValueDelWhere = new TBaseAttrbuteValue3Vo();

        objAttrValueDelWhere.OBJECT_ID = strPointID;
        objAttrValueDelWhere.IS_DEL    = "0";
        TBaseAttrbuteValue3Vo objAttrValueDelSet = new TBaseAttrbuteValue3Vo();

        objAttrValueDelSet.IS_DEL = "1";
        logicAttrValue.Edit(objAttrValueDelSet, objAttrValueDelWhere);

        //新增动态属性值
        if (strAttribute.Length > 0)
        {
            string[] arrAttribute = strAttribute.Split('=');
            for (int i = 0; i < arrAttribute.Length; i++)
            {
                string[] arrAttrValue = arrAttribute[i].Split('|');

                TBaseAttrbuteValue3Vo objAttrValueAdd = new TBaseAttrbuteValue3Vo();
                objAttrValueAdd.ID             = GetSerialNumber("t_base_attribute_value3_id");
                objAttrValueAdd.IS_DEL         = "0";
                objAttrValueAdd.OBJECT_TYPE    = arrAttrValue[0];
                objAttrValueAdd.OBJECT_ID      = strPointID;
                objAttrValueAdd.ATTRBUTE_CODE  = arrAttrValue[1];
                objAttrValueAdd.ATTRBUTE_VALUE = arrAttrValue[2];
                isSuccess = logicAttrValue.Create(objAttrValueAdd);
            }
        }

        if (isSuccess)
        {
            return("1");
        }
        else
        {
            return("0");
        }
    }
Exemplo n.º 2
0
    public static string SaveData(string strPointID, string strSubtaskID, string strPOINT_NAME, string strMONITOR_ID, string strPOINT_TYPE, string strDYNAMIC_ATTRIBUTE_ID, string strFREQ,
                                  string strCREATE_DATE, string strADDRESS, string strLONGITUDE, string strLATITUDE, string strNUM, string strAttribute,
                                  string strNATIONAL_ST_CONDITION_ID, string strLOCAL_ST_CONDITION_ID, string strINDUSTRY_ST_CONDITION_ID)
    {
        bool isSuccess = true;

        TMisMonitorTaskPointVo objPoint = new TMisMonitorTaskPointVo();

        objPoint.ID                   = strPointID.Length > 0 ? strPointID : GetSerialNumber("t_mis_monitor_taskpointId");
        objPoint.IS_DEL               = "0";
        objPoint.SUBTASK_ID           = strSubtaskID;
        objPoint.POINT_NAME           = strPOINT_NAME;
        objPoint.MONITOR_ID           = strMONITOR_ID;
        objPoint.DYNAMIC_ATTRIBUTE_ID = strDYNAMIC_ATTRIBUTE_ID;
        objPoint.FREQ                 = strFREQ;
        objPoint.CREATE_DATE          = strCREATE_DATE;
        objPoint.ADDRESS              = strADDRESS;
        objPoint.LONGITUDE            = strLONGITUDE;
        objPoint.LATITUDE             = strLATITUDE;
        objPoint.NUM                  = strNUM;

        objPoint.NATIONAL_ST_CONDITION_ID = strNATIONAL_ST_CONDITION_ID;
        objPoint.LOCAL_ST_CONDITION_ID    = strLOCAL_ST_CONDITION_ID;
        objPoint.INDUSTRY_ST_CONDITION_ID = strINDUSTRY_ST_CONDITION_ID;

        TMisMonitorSubtaskVo objSubtask = new TMisMonitorSubtaskLogic().Details(strSubtaskID);
        TMisMonitorTaskVo    objTask    = new TMisMonitorTaskLogic().Details(objSubtask.TASK_ID);

        objPoint.TASK_ID = objTask.ID;

        //监测任务出现新增排口时,基础资料企业表也要新增
        TBaseCompanyPointVo objnewPoint = new TBaseCompanyPointVo();

        if (strPointID.Length == 0)
        {
            objnewPoint.ID                   = GetSerialNumber("t_base_company_point_id");
            objnewPoint.IS_DEL               = "0";
            objnewPoint.POINT_NAME           = strPOINT_NAME;
            objnewPoint.MONITOR_ID           = strMONITOR_ID;
            objnewPoint.DYNAMIC_ATTRIBUTE_ID = strDYNAMIC_ATTRIBUTE_ID;
            objnewPoint.FREQ                 = strFREQ;
            objnewPoint.CREATE_DATE          = strCREATE_DATE;
            objnewPoint.ADDRESS              = strADDRESS;
            objnewPoint.LONGITUDE            = strLONGITUDE;
            objnewPoint.LATITUDE             = strLATITUDE;
            objnewPoint.NUM                  = strNUM;

            objnewPoint.NATIONAL_ST_CONDITION_ID = strNATIONAL_ST_CONDITION_ID;
            objnewPoint.LOCAL_ST_CONDITION_ID    = strLOCAL_ST_CONDITION_ID;
            objnewPoint.INDUSTRY_ST_CONDITION_ID = strINDUSTRY_ST_CONDITION_ID;

            TMisMonitorTaskCompanyVo objTaskCompany = new TMisMonitorTaskCompanyVo();
            objTaskCompany.TASK_ID = objTask.ID;;
            objTaskCompany         = new TMisMonitorTaskCompanyLogic().Details(objTaskCompany);

            TMisContractCompanyVo objContractCompany = new TMisContractCompanyLogic().Details(objTaskCompany.COMPANY_ID);
            objnewPoint.COMPANY_ID = objContractCompany.COMPANY_ID;

            new TBaseCompanyPointLogic().Create(objnewPoint);

            objPoint.POINT_ID = objnewPoint.ID;
        }

        if (strPointID.Length > 0)
        {
            isSuccess = new TMisMonitorTaskPointLogic().Edit(objPoint);
        }
        else
        {
            isSuccess = new TMisMonitorTaskPointLogic().Create(objPoint);

            //增加点位样品信息
            TMisMonitorSampleInfoVo objSample = new TMisMonitorSampleInfoVo();
            objSample.ID          = GetSerialNumber("MonitorSampleId");
            objSample.SUBTASK_ID  = strSubtaskID;
            objSample.QC_TYPE     = "0";
            objSample.NOSAMPLE    = "0";
            objSample.POINT_ID    = objPoint.ID;
            objSample.SAMPLE_NAME = objPoint.POINT_NAME;
            string[] strSampleCode = new string[2] {
                "S" + DateTime.Now.Year + DateTime.Now.Month, i3.View.PageBase.GetSerialNumber("monitor_samplecode")
            };
            objSample.SAMPLE_CODE = CreateSerialNumber(strSampleCode);

            new TMisMonitorSampleInfoLogic().Create(objSample);
        }

        TBaseAttrbuteValue3Logic logicAttrValue = new TBaseAttrbuteValue3Logic();

        //清掉原有动态属性值
        TBaseAttrbuteValue3Vo objAttrValueDelWhere = new TBaseAttrbuteValue3Vo();

        objAttrValueDelWhere.OBJECT_ID = objPoint.ID;
        objAttrValueDelWhere.IS_DEL    = "0";
        TBaseAttrbuteValue3Vo objAttrValueDelSet = new TBaseAttrbuteValue3Vo();

        objAttrValueDelSet.IS_DEL = "1";
        logicAttrValue.Edit(objAttrValueDelSet, objAttrValueDelWhere);

        //新增动态属性值
        if (strAttribute.Length > 0)
        {
            string[] arrAttribute = strAttribute.Split('-');
            for (int i = 0; i < arrAttribute.Length; i++)
            {
                string[] arrAttrValue = arrAttribute[i].Split('|');

                TBaseAttrbuteValue3Vo objAttrValueAdd = new TBaseAttrbuteValue3Vo();
                objAttrValueAdd.ID             = GetSerialNumber("t_base_attribute_value3_id");
                objAttrValueAdd.IS_DEL         = "0";
                objAttrValueAdd.OBJECT_TYPE    = arrAttrValue[0];
                objAttrValueAdd.OBJECT_ID      = objPoint.ID;
                objAttrValueAdd.ATTRBUTE_CODE  = arrAttrValue[1];
                objAttrValueAdd.ATTRBUTE_VALUE = arrAttrValue[2];
                isSuccess = logicAttrValue.Create(objAttrValueAdd);
            }
        }

        if (isSuccess)
        {
            return("1");
        }
        else
        {
            return("0");
        }
    }