Exemplo n.º 1
0
        /// <summary>
        /// 获取项名称集合
        /// </summary>
        /// <param name="AVR_IDENT_TYPE"></param>
        /// <param name="AVR_PROTOCOL_NO"></param>
        /// <returns></returns>
        public List <CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo> GetAVR_ITEM_NAMEList(int AVR_IDENT_TYPE, int AVR_PROTOCOL_NO)
        {
            try
            {
                CLDC_DataCore.DataBase.DbHelperOleDb.connectionString = strPath;

                List <CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo> list = new List <CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo>();

                string          sql = "select AVR_ITEM_NAME from PROTOCOL_DLT645DICT where AVR_PROTOCOL_NO = '" + AVR_PROTOCOL_NO + "' and AVR_IDENT_TYPE = '" + AVR_IDENT_TYPE + "'";
                OleDbDataReader dr  = CLDC_DataCore.DataBase.DbHelperOleDb.ExecuteReader(sql);

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo proinfo = new CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo();
                        proinfo.AVR_ITEM_NAME = dr["AVR_ITEM_NAME"].ToString();
                        list.Add(proinfo);
                    }
                    dr.Close();
                }
                return(list);
            }
            catch { return(null); }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取规约信息
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        public List <CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo> GetPROTOCOLinfoList(string sql)
        {
            try
            {
                CLDC_DataCore.DataBase.DbHelperOleDb.connectionString = strPath;
                List <CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo> list = new List <CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo>();
                OleDbDataReader dr = CLDC_DataCore.DataBase.DbHelperOleDb.ExecuteReader(sql);

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo proinfo = new CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo();
                        proinfo.PK_LNG_DLT_ID   = int.Parse(dr["PK_LNG_DLT_ID"].ToString());
                        proinfo.AVR_PROTOCOL_NO = dr["AVR_PROTOCOL_NO"].ToString();
                        proinfo.AVR_IDENT_TYPE  = dr["AVR_IDENT_TYPE"].ToString();
                        proinfo.AVR_ITEM_NAME   = dr["AVR_ITEM_NAME"].ToString();
                        proinfo.AVR_ID          = dr["AVR_ID"].ToString();
                        proinfo.CHR_CLASS       = dr["CHR_CLASS"].ToString();
                        proinfo.LNG_LENGTH      = dr["LNG_LENGTH"].ToString();
                        proinfo.LNG_DOT         = dr["LNG_DOT"].ToString();
                        proinfo.CHR_TYPE        = dr["CHR_TYPE"].ToString();
                        proinfo.AVR_FORMAT      = dr["AVR_FORMAT"].ToString();
                        proinfo.AVR_DEF_VALUE   = dr["AVR_DEF_VALUE"].ToString();
                        list.Add(proinfo);
                    }
                    dr.Close();
                }
                return(list);
            }
            catch { return(null); }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据编码类型(编码类型的描述)和协议名称得到编码号
        /// </summary>
        /// <param name="AVR_IDENT_TYPE"></param>
        /// <param name="AVR_PROTOCOL_NAME"></param>
        /// <returns></returns>
        public string GetAVR_IDENT_TYPE(string DESCRIPTION, string AVR_PROTOCOL_NAME)
        {
            string GetTypr = "";
            string sql     = string.Format("select * from PROTOCOL_TYPE where AVR_PROTOCOL_NAME = '{0}' and DESCRIPTION = '{1}'", AVR_PROTOCOL_NAME, DESCRIPTION);

            CLDC_DataCore.DataBase.DbHelperOleDb.connectionString = strPath;
            OleDbDataReader dr = CLDC_DataCore.DataBase.DbHelperOleDb.ExecuteReader(sql);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo proinfo = new CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo();
                    GetTypr = dr["AVR_IDENT_TYPE"].ToString();
                }
                dr.Close();
            }
            return(GetTypr);
        }
Exemplo n.º 4
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < Dgv_Data.Rows.Count; i++)
            {
                for (int j = 1; j < 8; j++)
                {
                    if (Dgv_Data.Rows[i].Cells[j].Value == null)
                    {
                        MessageBox.Show(this, "请填满数据后再保存", "提示");
                        return;
                    }
                }
            }


            ArrayList strList = new ArrayList();

            for (int i = 0; i < Dgv_Data.Rows.Count; i++)
            {
                string sql = "";
                CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo protocolinfo = new CLDC_DataCore.Model.PROTOCOLModel.PROTOCOLinfo();
                protocolinfo.AVR_PROTOCOL_NO = GetAVR_PROTOCOL_NO(Dgv_Data.Rows[i].Cells[1].Value.ToString());
                protocolinfo.AVR_IDENT_TYPE  = GetAVR_IDENT_TYPE(Dgv_Data.Rows[i].Cells[2].Value.ToString());
                protocolinfo.AVR_ITEM_NAME   = Dgv_Data.Rows[i].Cells[3].Value.ToString();
                protocolinfo.AVR_ID          = Dgv_Data.Rows[i].Cells[4].Value.ToString();
                protocolinfo.CHR_CLASS       = GetCodeByTYPE(Dgv_Data.Rows[i].Cells[5].Value.ToString());
                protocolinfo.LNG_LENGTH      = Dgv_Data.Rows[i].Cells[6].Value.ToString();
                protocolinfo.LNG_DOT         = Dgv_Data.Rows[i].Cells[7].Value.ToString();
                protocolinfo.CHR_TYPE        = GetCodeByTYPE(Dgv_Data.Rows[i].Cells[8].Value.ToString());
                protocolinfo.AVR_FORMAT      = Dgv_Data.Rows[i].Cells[9].Value == null ? "" : Dgv_Data.Rows[i].Cells[9].Value.ToString();
                protocolinfo.AVR_DEF_VALUE   = Dgv_Data.Rows[i].Cells[10].Value == null ? "" : Dgv_Data.Rows[i].Cells[10].Value.ToString();

                if (Dgv_Data.Rows[i].Cells[0].Value == null)
                {
                    protocolinfo.PK_LNG_DLT_ID = int.Parse(System.DateTime.Now.ToString("hhmmssff")) + i;
                    sql = string.Format(@"insert into PROTOCOL_DLT645DICT(PK_LNG_DLT_ID,AVR_PROTOCOL_NO,AVR_IDENT_TYPE,AVR_ITEM_NAME," +
                                        "AVR_ID,CHR_CLASS,LNG_LENGTH,LNG_DOT,CHR_TYPE,AVR_FORMAT,AVR_DEF_VALUE) values (" +
                                        "{0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')", +
                                        protocolinfo.PK_LNG_DLT_ID,
                                        protocolinfo.AVR_PROTOCOL_NO,
                                        protocolinfo.AVR_IDENT_TYPE,
                                        protocolinfo.AVR_ITEM_NAME,
                                        protocolinfo.AVR_ID,
                                        protocolinfo.CHR_CLASS,
                                        protocolinfo.LNG_LENGTH,
                                        protocolinfo.LNG_DOT,
                                        protocolinfo.CHR_TYPE,
                                        protocolinfo.AVR_FORMAT,
                                        protocolinfo.AVR_DEF_VALUE,
                                        protocolinfo.PK_LNG_DLT_ID);
                }
                else
                {
                    protocolinfo.PK_LNG_DLT_ID = int.Parse(Dgv_Data.Rows[i].Cells[0].Value.ToString());
                    sql = string.Format(@"update PROTOCOL_DLT645DICT set AVR_PROTOCOL_NO ='{0}',AVR_IDENT_TYPE='{1}'," +
                                        "AVR_ITEM_NAME='{2}',AVR_ID='{3}',CHR_CLASS='{4}',LNG_LENGTH='{5}'," +
                                        "LNG_DOT='{6}',CHR_TYPE='{7}',AVR_FORMAT='{8}',AVR_DEF_VALUE='{9}' where PK_LNG_DLT_ID={10}",
                                        protocolinfo.AVR_PROTOCOL_NO,
                                        protocolinfo.AVR_IDENT_TYPE,
                                        protocolinfo.AVR_ITEM_NAME,
                                        protocolinfo.AVR_ID,
                                        protocolinfo.CHR_CLASS,
                                        protocolinfo.LNG_LENGTH,
                                        protocolinfo.LNG_DOT,
                                        protocolinfo.CHR_TYPE,
                                        protocolinfo.AVR_FORMAT,
                                        protocolinfo.AVR_DEF_VALUE,
                                        protocolinfo.PK_LNG_DLT_ID);
                }
                strList.Add(sql);
            }
            bool blnSuccess = CLDC_DataCore.DataBase.DbHelperOleDb.ExecuteSqlTran(strList);

            if (blnSuccess)
            {
                MessageBox.Show(this, "保存成功", "提示");
                DGV_source();
                show_TV_Protocol();
            }
            else
            {
                MessageBox.Show(this, "保存失败", "提示");
            }
        }