Esempio n. 1
0
 public static int AddLineByObject(AsmLineObject aso)
 {
     using (IDbConnection conn = ClsCommon.OpenConnection())  //这里访问的是Sqlite数据文件,这里OpenConnection即上边获取连接数据库对象方法
     {
         var result = conn.Insert(aso);
         return(Convert.ToInt32(result));
     }
 }
Esempio n. 2
0
        public static int UpdateLineByObject(AsmLineObject aso)
        {
            var result = 0;

            using (IDbConnection conn = ClsCommon.OpenConnection())  //这里访问的是Sqlite数据文件,这里OpenConnection即上边获取连接数据库对象方法
            {
                result = conn.Update(aso);
            }
            return(Convert.ToInt32(result));
        }
Esempio n. 3
0
        public static int DeleteLineByCondition(string sql)
        {
            int           a   = 0;
            AsmLineObject aso = GetLineByCondition(sql);

            if (aso != null)
            {
                string sl = "DELETE FROM dbo.C_PMS_LINE_T WHERE " + sql;
                a = ClsCommon.dbSql.ExecuteNonQuery(sl);
            }
            return(a);
        }
Esempio n. 4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            XmlNode     rootNode   = ClsCommon.InfoRootNode.SelectSingleNode(nodeItemName + "[@name='" + configForm.listBox.Text + "']");
            XmlNode     parentNode = ClsCommon.InfoRootNode;
            XmlElement  element;
            int         index = 0;
            string      stName;
            XmlNodeList stationNodes = parentNode.SelectNodes(nodeItemName);///////DELETE

            foreach (XmlNode node in stationNodes)
            {
                if (int.Parse(node.Attributes["index"].Value) > index)
                {
                    index = int.Parse(node.Attributes["index"].Value);
                }
            }
            index++;
            stName = nodeItemName + index.ToString();

            element = ClsCommon.xml.CreateElement(nodeItemName);
            element.SetAttribute("index", index.ToString());
            element.SetAttribute("name", stName);
            element.SetAttribute("plcIP", "");
            element.SetAttribute("threaCount", "0");
            element.SetAttribute("updateRate", "0");
            element.SetAttribute("heartBeatAddr", "");
            // element.SetAttribute("packOrNot", "1");
            // element.SetAttribute("plcAgvIP", "");
            // element.SetAttribute("agvBeatAddr", "");
            // element.SetAttribute("sparePlcIp", "");
            // element.SetAttribute("sparePlcBeatAddr", "");
            parentNode.AppendChild(element);
            ClsCommon.saveXml();
            AsmLineObject ao = new AsmLineObject();

            ao.DT   = DateTime.Now;
            ao.NAME = stName;
            AsmLine_BLL.AddLineByObject(ao);
            configForm.listBox.Items.Add(stName);
            configForm.listBox.SelectedIndex = configForm.listBox.Items.Count - 1;
            if (configForm.listBox.Items.Count > 0)
            {
                configForm.btnRemove.Enabled   = true;
                configForm.btnPrevious.Enabled = true;
                configForm.btnNext.Enabled     = true;
            }
        }
Esempio n. 5
0
        public static AsmLineObject GetLineByCondition(string sql)
        {
            AsmLineObject aso = null;
            string        sl  = "SELECT ID,DT,NAME,DSC FROM dbo.C_PMS_LINE_T WHERE " + sql;
            DataTable     dt  = new DataTable();

            dt = ClsCommon.dbSql.ExecuteDataTable(sl);
            if (dt.Rows.Count > 0)
            {
                aso      = new AsmLineObject();
                aso.ID   = Convert.ToInt32(dt.Rows[0]["ID"].ToString());
                aso.NAME = dt.Rows[0]["NAME"].ToString();
                aso.DSC  = dt.Rows[0]["DSC"].ToString();
                aso.DT   = Convert.ToDateTime(dt.Rows[0]["DT"].ToString());
            }
            return(aso);
        }
Esempio n. 6
0
 public void reflsh()
 {
     allo = AsmLine_BLL.GetLineByCondition(" NAME='" + LineName + "'");
 }
Esempio n. 7
0
        public static AsmLineObject GetLineByCondition(string sql)
        {
            AsmLineObject ao = AsmLine_DAL.GetLineByCondition(sql);

            return(ao);
        }
Esempio n. 8
0
        public static int UpdateLineByObject(AsmLineObject aso)
        {
            int a = AsmLine_DAL.UpdateLineByObject(aso);

            return(a);
        }
Esempio n. 9
0
        public static int AddLineByObject(AsmLineObject aso)
        {
            int a = AsmLine_DAL.AddLineByObject(aso);

            return(a);
        }