示例#1
0
        private void UpdateGroupThongTinXa()
        {
            XA xa = GetXaWithID();

            txtTenXa.Text = xa.TEN;

            indexXa1 = indexXa;
            indexXa  = dgvXaView.FocusedRowHandle;
        }
示例#2
0
        private void btnThemXa_Click(object sender, EventArgs e)
        {
            HUYEN huyen = GetHuyenWithID();

            if (huyen.ID == 0)
            {
                MessageBox.Show("Chưa có Huyện nào được chọn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (btnThemXa.Text == "Thêm Xã")
            {
                btnThemXa.Text   = "Lưu";
                btnXoaXa.Text    = "Hủy";
                btnSuaXa.Enabled = false;

                dgvXaMain.Enabled = false;
                txtTenXa.Enabled  = true;

                panelTinh.Enabled  = false;
                panelHuyen.Enabled = false;

                ClearControlXa();

                return;
            }

            if (btnThemXa.Text == "Lưu")
            {
                if (CheckXa())
                {
                    /// cập nhật lại trạng thái các control
                    btnThemXa.Text   = "Thêm Xã";
                    btnXoaXa.Text    = "Xóa Xã";
                    btnSuaXa.Enabled = true;

                    dgvXaMain.Enabled = true;
                    txtTenXa.Enabled  = false;

                    panelTinh.Enabled  = true;
                    panelHuyen.Enabled = true;

                    /// thêm huyện
                    XA xa = new XA();
                    xa.TEN     = txtTenXa.Text;
                    xa.HUYENID = huyen.ID;

                    db.XAs.Add(xa);
                    db.SaveChanges();

                    MessageBox.Show("Thêm thông tin Xã thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadXa();
                }
                return;
            }
        }
示例#3
0
        private void btnSuaXa_Click(object sender, EventArgs e)
        {
            /// kiểm tra xem có xã
            XA xa = GetXaWithID();

            if (xa.ID == 0)
            {
                MessageBox.Show("Chưa có Xã nào được chọn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            /// code
            if (btnSuaXa.Text == "Sửa Xã")
            {
                btnSuaXa.Text     = "Lưu";
                btnThemXa.Enabled = false;
                btnXoaXa.Text     = "Hủy";

                dgvXaMain.Enabled = false;
                txtTenXa.Enabled  = true;

                panelTinh.Enabled  = false;
                panelHuyen.Enabled = false;

                return;
            }

            if (btnSuaXa.Text == "Lưu")
            {
                if (CheckXa())
                {
                    btnSuaXa.Text     = "Sửa Xã";
                    btnThemXa.Enabled = true;
                    btnXoaXa.Text     = "Xóa Xã";

                    dgvXaMain.Enabled = true;
                    txtTenXa.Enabled  = false;

                    panelTinh.Enabled  = true;
                    panelHuyen.Enabled = true;

                    XA ti = db.XAs.Where(p => p.ID == xa.ID).FirstOrDefault();
                    ti.TEN = txtTenXa.Text;
                    db.SaveChanges();

                    MessageBox.Show("Sửa thông tin Xã thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadXa();
                }

                return;
            }
        }
示例#4
0
        private XA GetXaWithID()
        {
            XA ans = new XA();

            try
            {
                int ID = (int)dgvXaView.GetFocusedRowCellValue("ID");
                XA  xa = db.XAs.Where(p => p.ID == ID).FirstOrDefault();
                return(xa);
            }
            catch
            {
            }
            return(ans);
        }
示例#5
0
        private void btnXoaXa_Click(object sender, EventArgs e)
        {
            if (btnXoaXa.Text == "Xóa Xã")
            {
                XA xa = GetXaWithID();
                if (xa.ID == 0)
                {
                    MessageBox.Show("Chưa có Xã nào được chọn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                DialogResult rs = MessageBox.Show("Bạn có chắc chắn xóa thông tin của Xã " + xa.TEN + "?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                if (rs == DialogResult.Cancel)
                {
                    return;
                }

                try
                {
                    db.XAs.Remove(xa);
                    db.SaveChanges();
                    MessageBox.Show("Xóa thông tin của Xã thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadXa();
                }
                catch
                {
                    MessageBox.Show("Xóa thông tin của Xã thất bại\n", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return;
            }

            if (btnXoaXa.Text == "Hủy")
            {
                btnXoaXa.Text     = "Xóa Xã";
                btnSuaXa.Enabled  = true; btnSuaXa.Text = "Sửa Xã";
                btnThemXa.Enabled = true; btnThemXa.Text = "Thêm Xã";

                dgvXaMain.Enabled = true;
                txtTenXa.Enabled  = false;

                panelTinh.Enabled  = true;
                panelHuyen.Enabled = true;

                UpdateGroupThongTinXa();

                return;
            }
        }
示例#6
0
文件: test-87.cs 项目: nobled/mono
	public static int Main ()
	{
		XA x = new XA ();

		if (x.get_one () != 1)
			return 1;

		XB b = new XB ();
		if (x.get_one () != 1)
			return 2;
		if (b.get_two () != 2)
			return 3;

		XB [] xb = null;

		return 0;
	}
示例#7
0
    static int Main()
    {
        XA x = new XA();

        if (x.get_one() != 1)
        {
            return(1);
        }

        XB b = new XB();

        if (x.get_one() != 1)
        {
            return(2);
        }
        if (b.get_two() != 2)
        {
            return(3);
        }

        XB [] xb = null;

        return(0);
    }
        private void AddNodeToFeed(string parentId, XContainer node)
        {
            //Get node values
            var idAttribute = node.XPathSelectElement("./DVAL/DVAL_ID").Attribute("ID");

            if (idAttribute == null)
            {
                return;
            }
            var id          = idAttribute.Value;
            var displayName = node.XPathSelectElement("./DVAL/SYN[@DISPLAY='TRUE']").Value;

            foreach (var synonym in node.XPathSelectElements("./DVAL/SYN[@DISPLAY='FALSE'][@CLASSIFY='TRUE']"))
            {
                if (synonym.Value == id)
                {
                    continue;
                }
                if (_synonymsDict.Keys.Contains(synonym.Value))
                {
                    _synonymsDict[synonym.Value] = new Category(displayName, id);
                }
                else
                {
                    _synonymsDict.Add(synonym.Value, new Category(displayName, id));
                }
            }

            //Create node
            var current      = new XE(_gNsAtom + DefaultNodeName);
            var idElement    = new XE(_gNsAtom + "id", id);
            var titleElement = new XE(_gNsAtom + "title", displayName);
            //link?? - is it mandatory?
            var linkElement = new XE(_gNsAtom + "link");
            var linkAttr    = new XA("href", _indigoLink);

            linkElement.Add(linkAttr);
            var parentsElement = new XE(_gNsG + "parents", parentId);
            var groupElement   = new XE(_gNsG + "group", _taxonomyVersionName);

            current.Add(new object[] { idElement, titleElement, linkElement, parentsElement, groupElement });

            //Add node to the feed
            _feedElement.Add(current);

            // Add the node info to the breadcrumbs list
            if (_categoryBreadcrumbs.ContainsKey(parentId))
            {
                _categoryBreadcrumbs.Add(id, _categoryBreadcrumbs[parentId] + " > " + displayName);
            }
            else
            {
                _categoryBreadcrumbs.Add(id, "{TOP_LEVEL}");
            }

            //Add childrens as well
            foreach (var child in node.Elements("DIMENSION_NODE"))
            {
                AddNodeToFeed(id, child);
            }
        }
示例#9
0
 public VOSC(XA a, XB b)
 {
 }
 // TODO rename this to DoX, and compilation will works.
 public static void Do(this XA xa)
 {
 }
示例#11
0
        public static void ConflictResolution(FuzzyModel fm, float preserveThr, float ratioThr)
        {
            List <FuzzyEdge> toRemove = new List <FuzzyEdge>();

            foreach (FuzzyEdge AB in fm.GetEdges())
            {
                FuzzyEdge BA    = fm.GetEdge(AB.GetToNode(), AB.GetFromNode());
                float     relAB = 0;
                float     relBA = 0;
                if (BA != null)
                {
                    if (AB.Equals(BA))
                    {
                        toRemove.Add(AB);
                    }
                    if (toRemove.Contains(AB) || toRemove.Contains(BA))
                    {
                        continue;
                    }
                    FuzzyNode A = AB.GetFromNode();
                    FuzzyNode B = AB.GetToNode();
                    // compute relative significance of edge A->B
                    float sigAB = AB.GetFrequencySignificance();
                    float sigAX = 0;
                    foreach (FuzzyEdge AX in A.GetOutEdges())
                    {
                        sigAX += AX.GetFrequencySignificance();
                    }
                    float sigXB = 0;
                    foreach (FuzzyEdge XB in B.GetInEdges())
                    {
                        sigXB += XB.GetFrequencySignificance();
                    }
                    relAB = (0.5F * (sigAB / sigAX)) + (0.5F * (sigAB / sigXB));
                    Console.WriteLine("{0}, Relative significance: {1}", AB.ToString(), relAB);

                    // compute relative significance of edge B->A
                    float sigBA = BA.GetFrequencySignificance();
                    float sigBX = 0;
                    foreach (FuzzyEdge BX in B.GetOutEdges())
                    {
                        sigBX += BX.GetFrequencySignificance();
                    }
                    float sigXA = 0;
                    foreach (FuzzyEdge XA in A.GetInEdges())
                    {
                        sigXA += XA.GetFrequencySignificance();
                    }
                    relBA = (0.5F * (sigBA / sigBX)) + (0.5F * (sigBA / sigXA));
                    Console.WriteLine("{0}, Relative significance: {1}", BA.ToString(), relBA);


                    // Decide preservation
                    if (relAB < preserveThr || relBA < preserveThr)
                    {
                        float ofsAB = Math.Abs(relAB - relBA);
                        if (ofsAB < ratioThr)
                        {
                            toRemove.Add(AB);
                            toRemove.Add(BA);
                        }
                        else
                        {
                            if (relAB > relBA)
                            {
                                toRemove.Add(BA);
                            }
                            else
                            {
                                toRemove.Add(AB);
                            }
                        }
                    }
                }
            }

            foreach (FuzzyEdge fe in toRemove)
            {
                fm.RemoveEdge(fe);
            }
        }