private void LoadInterfaceList()
        {
            InterfaceInfoLibraryManager plugLibraryDetailManager = new InterfaceInfoLibraryManager();
            var dt = plugLibraryDetailManager.GetAllDataSet().Tables[0];

            if (dt.Rows.Count > 0)
            {
                List <string> plugTemp = new List <string>();
                int           iRow     = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    var interNo    = dr["InterfaceNo"].ToString();
                    var contactNum = plugLibraryDetailManager.GetRowCountByWhere($"where InterfaceNo='{interNo}'");
                    if (!plugTemp.Contains(interNo))
                    {
                        plugTemp.Add(interNo);
                    }
                    else
                    {
                        continue;
                    }
                    //add radgridview
                    this.radGridViewInter.Rows.AddNew();
                    this.radGridViewInter.Rows[iRow].Cells[0].Value = iRow + 1;
                    this.radGridViewInter.Rows[iRow].Cells[1].Value = interNo;
                    this.radGridViewInter.Rows[iRow].Cells[2].Value = contactNum;
                    iRow++;
                }
            }
        }
Ejemplo n.º 2
0
        private InterfaceExTipEnum IsCanInsertOrUpdate(bool IsUpdate, long ID, string interfaceNo, string interfacePName, string switchStandStitch, string remark)
        {
            //查询本地库是否已存在要更新的值,不存在时可以更新
            var where = $"where ID == '{ID}' and InterfaceNo='{interfaceNo}'";

            var interNameCount = plugLibraryDetailManager.GetRowCountByWhere(where);

            if (interNameCount > 0)
            {
                where          = $"where InterfaceNo='{interfaceNo}' and ContactPointName='{interfacePName}' and SwitchStandStitchNo='{switchStandStitch}' and Remark='{remark}'";
                interNameCount = plugLibraryDetailManager.GetRowCountByWhere(where);
                if (interNameCount > 0)
                {
                    where = $"where InterfaceNo='{interfaceNo}' and ContactPointName='{interfacePName}'";
                    var whereDev = $"where InterfaceNo='{interfaceNo}' and SwitchStandStitchNo='{switchStandStitch}'";
                    interNameCount = plugLibraryDetailManager.GetRowCountByWhere(where);
                    var devCount = plugLibraryDetailManager.GetRowCountByWhere(where);
                    if (interNameCount > 0)
                    {
                        if (devCount > 0)
                        {
                            MessageBox.Show($"接点{interfacePName}已存在,针脚{switchStandStitch}已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return(InterfaceExTipEnum.InterfacePoint_ExistAndStitchNo_Exist);
                        }
                        else
                        {
                            MessageBox.Show($"接点{interfacePName}已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return(InterfaceExTipEnum.InterfacePoint_ExistAndStitchNo_NotExist);
                        }
                    }
                    else
                    {
                        if (devCount > 0)
                        {
                            MessageBox.Show($"针脚{switchStandStitch}已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return(InterfaceExTipEnum.InterfacePoint_NotExistANdStitch_Exist);
                        }
                        else
                        {
                            return(InterfaceExTipEnum.NONE);
                        }
                    }
                }
                else
                {
                    //接点或者针脚是否存在
                    var where1      = $"where ID != '{ID}' and InterfaceNo = '{interfaceNo}' and ContactPointName='{interfacePName}'";
                    var where2      = $"where ID != '{ID}' and InterfaceNo = '{interfaceNo}' and SwitchStandStitchNo='{switchStandStitch}'";
                    var cpointCount = plugLibraryDetailManager.GetRowCountByWhere(where1);
                    var dpointCount = plugLibraryDetailManager.GetRowCountByWhere(where2);
                    if (cpointCount > 0 && dpointCount <= 0)
                    {
                        MessageBox.Show($"接点{interfacePName}已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return(InterfaceExTipEnum.InterfacePoint_ExistAndStitchNo_Exist);
                    }
                    else if (cpointCount <= 0 && dpointCount > 0)
                    {
                        MessageBox.Show($"针脚{switchStandStitch}已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return(InterfaceExTipEnum.InterfacePoint_NotExistANdStitch_Exist);
                    }
                    else if (cpointCount > 0 && dpointCount > 0)
                    {
                        MessageBox.Show($"接点{interfacePName}已存在,针脚{switchStandStitch}已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return(InterfaceExTipEnum.InterfacePoint_ExistAndStitchNo_Exist);
                    }
                    else
                    {
                        //update
                        return(InterfaceExTipEnum.InterfacePoint_NotExistAndStitch_NoExist);
                    }
                }
            }
            else
            {
                //insert
                return(InterfaceExTipEnum.NONE);
            }
        }