void DoDataBind()
        {
            DataTable tb = DBase.GetDataTable(Config.DbGetPlayPeriod);

            dgPeriod.DataSource = tb.DefaultView;
            try
            {
                dgPeriod.DataBind();
            }
            catch
            {
                if (dgPeriod.CurrentPageIndex < 0)
                {
                    dgPeriod.CurrentPageIndex = 0;
                }
                else if (dgPeriod.CurrentPageIndex > dgPeriod.PageCount - 1)
                {
                    if (dgPeriod.PageCount > 0)
                    {
                        dgPeriod.CurrentPageIndex = dgPeriod.PageCount - 1;
                    }
                    else
                    {
                        dgPeriod.CurrentPageIndex = 0;
                    }
                }
                dgPeriod.DataBind();
            }
        }
Пример #2
0
        private void ZMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            //if (this.Visible)
            //{
            //    if (this.Height > 50) DBase.LastHeight = this.Height.ToString();
            //    if (this.Width > 120) DBase.LastWidth = this.Width.ToString();
            //    DBase.SaveSetting();
            //}

            if (DBase.CloseToTray != "0")
            {
                if (isClose == 0)
                {
                    this.WindowState = FormWindowState.Minimized;
                    this.Hide();
                    notifyIcon1.Visible = true;
                    e.Cancel            = true;
                }
                else
                {
                    string PName = Process.GetCurrentProcess().ProcessName;
                    notifyIcon1.Visible = false;
                    DBase.KillProcess(PName);
                }
            }
            else
            {
                string PName = Process.GetCurrentProcess().ProcessName;
                notifyIcon1.Visible = false;
                DBase.KillProcess(PName);
            }
        }
        private void edtSHORTKEY_KeyDown(object sender, KeyEventArgs e)
        {
            string KEYBIND = "";

            try
            {
                if (e.Control && e.Shift && e.Alt)
                {
                    KEYBIND = "CRT+ALT+SHIFT";
                }

                else if (e.Control && e.Shift)
                {
                    KEYBIND = "CRT+ALT";
                }

                else if (e.Control && e.Alt)
                {
                    KEYBIND = "CRT+SHIFT";
                }
                else if (e.Control)
                {
                    KEYBIND = "CRT";
                }


                KEYBIND = DBase.AppentString(KEYBIND, e.KeyCode.ToString(), "+");
            }
            catch (Exception) { }

            edtSHORTKEY.Text = KEYBIND;
        }
        protected void BindGrid()
        {
            DataTable oDT = DBase.GetDataTable(Config.DbGetConfig);

            foreach (DataRow oDR in oDT.Rows)
            {
                //create table row
                TableRow oTR = new TableRow();;
                oTR.CssClass = "cssReportItemOdd";
                //create table cell and populate it with text of config name
                TableCell oTC = new TableCell();
                oTC.Text = GetObjectName(oDR);                  //GetObjectName prevents to show the same names several times (first time it will be name, next time it will be &nbsp instead the same name
                oTR.Cells.Add(oTC);
                //create table cell and populate it with text of config detail name
                oTC      = new TableCell();
                oTC.Text = oDR["PropertyName"].ToString();
                oTR.Cells.Add(oTC);
                //create table cell and populate it with config detail value
                oTC = new TableCell();
                int     nID = Utils.GetInt(oDR["id"]);
                TextBox oTB = new TextBox();
                oTB.MaxLength = 7000;
                oTB.Width     = Unit.Percentage(100);
                oTB.ID        = string.Format("edtVal_{0}", nID);
                oTB.Text      = oDR["PropertyValue"].ToString();
                oTC.Controls.Add(oTB);
                oTR.Cells.Add(oTC);
                //add rows to table
                tblMain.Rows.Add(oTR);
            }
        }
Пример #5
0
        private void BindData()
        {
            DataSet   ds = DBase.GetDataSet("admGetCurrentStats");
            DataTable tb = ds.Tables[2];

            if (tb == null)
            {
                return;
            }
            if (tb.Rows.Count <= 0)
            {
                return;
            }
            DataRow dr = tb.Rows[0];

            lbAffNew.Text      = dr["AffSignup"].ToString();
            lbAffUnapp.Text    = dr["AffUnapproved"].ToString();
            lbDeposits.Text    = dr["Deposits"].ToString();
            lbWithdr.Text      = dr["Withdrawals"].ToString();
            lbPlayersSign.Text = dr["NewPlayers"].ToString();
            lbTAPReal.Text     = dr["ActPlayersReal"].ToString();
            lbTAPPlay.Text     = dr["ActPlayersPlay"].ToString();
            lbTATReal.Text     = dr["ActTablesReal"].ToString();
            lbTATPlay.Text     = dr["ActTablesPlay"].ToString();
            lbTournRun.Text    = dr["ToutnRun"].ToString();
            lbTournFinish.Text = dr["TournFinish"].ToString();
        }
        public void  btnDeleteBan_Click(object sender, System.EventArgs e)
        {
            string sIDs = GetCheckedValues(Config.MainCheckboxName);

            DBase.Execute(Config.DbDeleteBan, "@IDs", sIDs);
            Data_Bind();
        }
Пример #7
0
 private void timerAction_Tick(object sender, EventArgs e)
 {
     edtTimeInfo.Text = DBase.Int2Time(DBase.IntReturn((DateTime.Now - StartTime).TotalSeconds));
     if (DBase.SPEECH_STATUS == "ON" && DBase.SPEECH_STATUS != LastStatus)
     {
         LastStatus   = DBase.SPEECH_STATUS;
         edtPic.Image = Properties.Resources.Loading;
     }
     else if (DBase.SPEECH_STATUS == "PAUSE" && DBase.SPEECH_STATUS != LastStatus)
     {
         LastStatus   = DBase.SPEECH_STATUS;
         edtPic.Image = OriImage;
         SPEECH2TEXT_Click(null, null);
     }
     if (DBase.SR != LastR)
     {
         if ((DateTime.Now - LastChangeTime).TotalSeconds > 1.4)  // Add to Result
         {
             CountAddState  = CountAddState + 1;
             this.Text      = "Added State " + CountAddState;
             edtResult.Text = edtResult.Text + Environment.NewLine + LastR;
         }
         LastR          = DBase.SR;
         LastChangeTime = DateTime.Now;
         edtText.Text   = LastR;
     }
 }
 private void vGrid_UpdateCommand(object source, DataGridCommandEventArgs e)
 {
     DBase.ExecuteReturnInt(Config.DBSaveBotChatVariant, "@ID", int.Parse(e.Item.Cells[2].Text),
                            "@postvariant", ((TextBox)e.Item.Cells[3].Controls[0]).Text, "@mapid", MapID);
     vGrid.EditItemIndex = -1;
     GridBindVariant();
 }
        private void Page_Load(object sender, System.EventArgs e)
        {
            nSubCategoryID = GetMainParamInt(hdnID);

            BackPageUrl = (string)Session["SBSubCategoryMaintenanceUrl"];

            if (!IsPostBack)
            {
                DataRow oDR = GetFirstRow(Config.DbGetSBSubCategoryDetails, new object[] { "@id", nSubCategoryID });
                if (oDR != null)
                {
                    //btnSave.Visible = false;
                    txtName.Text       = oDR["Name"].ToString();
                    nCategoryID        = Utils.GetInt(oDR["CategoryID"]);
                    txtSpreadFrom.Text = oDR["SpreadFrom"].ToString();
                    txtSpreadTo.Text   = oDR["SpreadTo"].ToString();
                    txtSpreadStep.Text = oDR["SpreadStep"].ToString();
                    txtOuFrom.Text     = oDR["OuFrom"].ToString();
                    txtOuTo.Text       = oDR["OuTo"].ToString();
                    txtOuStep.Text     = oDR["OuStep"].ToString();

                    txtName.Enabled       = false;
                    comboCategory.Enabled = false;
                    txtSpreadFrom.Enabled = false;
                    txtSpreadTo.Enabled   = false;
                    txtSpreadStep.Enabled = false;
                    txtOuFrom.Enabled     = false;
                    txtOuTo.Enabled       = false;
                    txtOuStep.Enabled     = false;
                }
                DBase.FillList(comboCategory, nCategoryID, Config.DbGetDictionarySBCategoryList, false);
                BindTeam();
            }
            InitJS();
        }
        private void DoBindData()
        {
            DataTable oDT = DBase.GetDataTable(Config.DbGetActionDispatchersList);

            oGrid.DataSource = oDT.DefaultView;
            oGrid.DataBind();
        }
        private void GridBind()
        {
            DataTable tb = DBase.GetDataTable(Config.DbGetPushingContentList);

            oGrid.DataSource = tb.DefaultView;
            oGrid.DataBind();
        }
Пример #12
0
        public JsonResult SelectUserRoles()
        {
            try
            {
                List <string> roleList = new List <string>();
                using (var context = new AccountDbContext())
                {
                    var resultRoles = from ur in context.UserRoles
                                      join u in context.Users
                                      on ur.UserId equals u.UserId
                                      join r in context.Roles
                                      on ur.RoleId equals r.RoleId
                                      where u.Username == Username
                                      select new
                    {
                        RoleName = r.RoleName
                    };
                    roleList = resultRoles.Select(r => r.RoleName).ToList();
                }


                using (var context = new AccountDbContext())
                {
                    DBase dbase = new DBase(context);
                    var   a     = dbase.List <EUserRole>(b => true);
                }

                return(Json(roleList));
            }
            catch (Exception ex)
            {
                return(Json(ex.ToString()));
            }
        }
        protected void GetData(bool FromBase)
        {
            if (FromBase)
            {
                if (nTournamentPrizeID > 0)
                {
                    DataRow oDR = GetFirstRow(Config.DbGetTournamentPrizeDetails, new object[] { "@ID", nTournamentPrizeID });
                    if (oDR != null)
                    {
                        if (oDR["PaySchemaXML"] != null)
                        {
                            xmlTournamentPrize = oDR["PaySchemaXML"].ToString();
                        }
                        nValueType   = Utils.GetInt(oDR["PrizeValueType"]);
                        nCurrencyID  = Utils.GetInt(oDR["CurrencyTypeID"]);
                        txtName.Text = oDR["name"].ToString();
                    }
                }
                DBase.FillList(cbPrizeValueType, nValueType, Config.DbDictionaryTournPrizeValueType, false);
                DBase.FillList(cbCurrency, nCurrencyID, Config.DbDictionaryCurrency, false);
            }

            //		oPrize.FillTable(ref xmlTournamentPrize, ref table, true, false);
            hdnTournamentPrizeXML.Value = xmlTournamentPrize;
            prData.XMLToDataSet(xmlTournamentPrize);
        }
Пример #14
0
 public void RefreshSelect()
 {
     try
     {
         string    ID   = DBase.StringReturn(dgv.SelectedRows[0].Cells[colKEYCOL].Value);
         DataTable temp = DHuy.SELECT(TableName, KEYCOL, ID.ToString());
         if (dt != null)
         {
             try
             {
                 DBase.TablePropertyRemove(dt);
                 for (int d = 0; d < dt.Rows.Count; d++)
                 {
                     if (dt.Rows[d][KEYCOL].ToString() == ID.ToString())
                     {
                         dt.Rows[d].ItemArray = temp.Rows[0].ItemArray;
                         break;
                     }
                 }
             }
             catch (Exception ex) { }
         }
     }
     catch (Exception ex) { }
 }
Пример #15
0
        public Polygon GetPolygonByName(string s)
        {
            DBase db = new DBase(DataContextConnection);

            Polygon poly = new Polygon();

            // construct polygon
            Polygons DBpoly = (from c in db.Polygons
                                         where c.NAME==s && c.PARENT_ID==null
                                         select c).SingleOrDefault<Polygons>();

            foreach (Points pnt in DBpoly.Points)
            {
                Point p = new Point(pnt.X,pnt.Y);
                poly.AddVertex(p);
            }
            // construct subPolygons
            IQueryable <Polygons> DBsubpolys = from c in db.Polygons
                              where c.PARENT_ID == DBpoly.ID
                              select c;

            foreach (Polygons DBsubpoly in DBsubpolys)
            {
                Polygon subpoly = new Polygon();

                foreach (Points pnt in DBsubpoly.Points)
                {
                    Point p = new Point(pnt.X, pnt.Y);
                    subpoly.AddVertex(p);
                }
                poly.AddSubPolygon(subpoly);
            }

            return poly;
        }
Пример #16
0
 private void LOGON_ITEM_Load(object sender, EventArgs e)
 {
     if (Environment.UserName == USERNAME)
     {
         DBase.BoldLabel(edtUserName);
     }
 }
Пример #17
0
        private void cmsStartMinimize_Click(object sender, EventArgs e)
        {
            DBase.StartMinimize = DBase.StartMinimize == 0 ? 1 : 0;
            DBase.SaveSetting();

            RefreshButton();
        }
        private void oGrid_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            int ID = Utils.GetInt(e.Item.Cells[0].Text);

            DBase.Execute(Config.DbDeleteActionDispatcher, "@ID", ID);
            DoBindData();
        }
Пример #19
0
        private void LOGON_Load(object sender, EventArgs e)
        {
            KeyboardManager.DisableSystemKeys();
            DBase.isLock = 1;
            try
            {
                //   DBase.KillProcess("explorer");
                DBase.RegistrySetLM("Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", "AutoRestartShell", "0", true);
                DBase.RegistrySetCU("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", "DisableTaskMgr", "1", true);
                DBase.RegistrySetCU("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", "DisableLockWorkstation", "1", true);
                DBase.RegistrySetCU("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", "NoLogoff", "1", true);
                DBase.RegistrySetLM("Software\\Policies\\Microsoft\\Windows\\System\\Power", "PromptPasswordOnResume", "0", true);
            }
            catch (Exception ex) {  }

            try
            {
                this.Location = new Point(0, 0);
                this.Width    = 9000;
                this.Height   = 5080;
            }
            catch (Exception ex) { }


            edtPassword.Focus();
            this.ActiveControl = edtPassword;
        }
Пример #20
0
        //SEND/RECEIVE
        private void SEND(object sender, EventArgs e)
        {
            DataTable dt = DHuy.SELECT_SQL("SELECT * FROM FILE_TRANSFER WHERE ID = " + SESSION_TRANS_ID);

            if (DBase.IsFolder(HerePath) == 1)
            {
                return;
            }

            if (dt.Rows.Count > 0)
            {
                FileTransfer_Process P = new FileTransfer_Process();
                P.isSend           = 1;
                P.dt               = dt;
                P.Here_File        = HerePath;
                P.Remote_File      = RemotePath;
                P.SESSION_TRANS_ID = SESSION_TRANS_ID;
                P.F        = this;
                P.Location = new Point(Location.X + (Width - P.Width) / 2, Location.Y + (Height - P.Height) / 2);
                P.Show();
            }
            else
            {
                Confirm C = new Confirm();
                C.SetColor(Color.LightCoral);
                C.edtText.Text  = "Session is expired ! ... Close ? ";
                C.StartPosition = FormStartPosition.Manual;
                C.Location      = new Point(Location.X + (Width - C.Width) / 2, Location.Y + (Height - C.Height) / 2);
                C.ShowDialog(this);
                if (C.Res == 1)
                {
                    this.Close();
                }
            }
        }
        private void GridBindVariant()
        {
            DataTable tb = DBase.GetDataTable(Config.DBGetBotChatVariantList, "@mapid", MapID);

            vGrid.DataSource = tb.DefaultView;
            vGrid.DataBind();
        }
Пример #22
0
        private void GridBind()
        {
            DataTable tb = DBase.GetDataTable(Config.DbGetForcedExitsList);

            oGrid.DataSource = tb.DefaultView;
            oGrid.DataBind();
        }
Пример #23
0
        protected void btnDecline_Click(object sender, System.EventArgs e)
        {
            ArrayList sIDs = GetCheckedValuesToArray(Config.MainCheckboxName);

            if (sIDs.Count <= 0)
            {
                return;
            }
            DataTable dt = (DataTable)Session["Avatars_DT"];

            dt.Constraints.Clear();
            dt.Constraints.Add("cnst_ID_Avatars", dt.Columns["ID"], true);
            string fPath = Config.GetConfigValue("AvatarUploadPath");

            foreach (string sr in sIDs)
            {
                int     id  = int.Parse(sr);
                int     ret = DBase.ExecuteReturnInt(Config.DbDeleteAvatar, "@id", id);
                DataRow dr  = dt.Rows.Find(id);
                fPath += ("\\" + dr["LoginName"] + "\\" + dr["File"]);
                if (File.Exists(fPath))
                {
                    File.Delete(fPath);
                }
            }
            Bind_Grid();
        }
Пример #24
0
        protected override void Page_Load(object sender, System.EventArgs e)
        {
            if (Request["isProcess"] == "1")
            {
                ProcID = int.Parse(Request["ID"]);
            }
            else
            {
                GameID = int.Parse(Request["ID"]);
            }

            if (!IsPostBack)
            {
                hdnSelGame.Value = "0";
                DataTable tb = DBase.GetDataTable("admGetGameProcessList2", "@TournID", ProcID, "@GameProcID", GameID);
                if (tb.Rows.Count > 0)
                {
                    Core.SelectItemByValue(ddGames, tb.Rows[0]["ID"].ToString());
                    hdnSelGame.Value = tb.Rows[0]["ID"].ToString();
                }
                Core.FillList(ddGames, tb);
            }
            if (hdnSelGame.Value == String.Empty)
            {
                Core.SelectItemByValue(ddGames, hdnSelGame.Value);
            }
        }
        private void Data_Bind()
        {
            DataTable tb = DBase.GetDataTable(Config.DbGetBanList);

            oGrid.DataSource = tb.DefaultView;
            oGrid.DataBind();
        }
Пример #26
0
        private void BindUserSession()
        {
            DataTable tb = DBase.GetDataTable(Config.DbGetClientSessionHistory, "@ID", nUserID);

            oGrid.DataSource = tb.DefaultView;
            oGrid.DataBind();
        }
Пример #27
0
 private void cmsBundleRemote_Click(object sender, EventArgs e)
 {
     if (BundleString != "")
     {
         string[] S = BundleString.Split('\n');
         for (int i = 0; i < S.Length; i++)
         {
             if (S[i] == "")
             {
                 continue;
             }
             String PCSID = S[i].Split(':')[0];
             //M.edtRemoteID.Text = PCSID;
             string pcsname = "";
             try
             {
                 pcsname = DBase.StringReturn(DBase.dtpcslist.Select("PCS_ID = " + PCSID)[0]["PCS_NAME"]);
             }
             catch (Exception ex)
             {
                 // MessageBox.Show(ex.ToString());
             }
             string RemotePassword = "******";
             try
             {
                 RemotePassword = S[i].Split(':')[1];
             }
             catch (Exception ex) { }
             M.REMOTE(DBase.IntReturn(PCSID), RemotePassword, pcsname, 1);
         }
     }
 }
Пример #28
0
        public bool Load(TypeOrder objtypeorder)
        {
            bool ret = false;

            DBase.CommandText = "SELECT * FROM " + TableName + " where IdTypeOrder=@IdTypeOrder ORDER BY Number ";
            DBase.Parameters["IdTypeOrder"].Value = objtypeorder.Id;
            try
            {
                SqlCeDataReader rdr = DBase.ExecuteReader();
                if (rdr != null)
                {
                    while (rdr.Read())
                    {
                        objtypeorder.ListPole.Add(new TypeOrderPole(Convert.ToInt32(rdr["Id"].ToString()),
                                                                    Convert.ToInt32(rdr["IdTypeOrder"].ToString()),
                                                                    Convert.ToInt32(rdr["Number"].ToString()),
                                                                    rdr["NamePole"].ToString()));
                    }
                }
                rdr.Close();
                ret = true;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Внимание!");
            }


            return(ret);
        }
Пример #29
0
        public static int DetectCursorID()
        {
            int kq = 0;

            try
            {
                bitmapDrawIcon = new Bitmap(50, 50, PixelFormat.Format24bppRgb);
                using (Graphics g = Graphics.FromImage(bitmapDrawIcon))
                {
                    CURSORINFO cursorInfo;
                    cursorInfo.cbSize = Marshal.SizeOf(typeof(CURSORINFO));
                    if (GetCursorInfo(out cursorInfo))
                    {
                        var      iconPointer = CopyIcon(cursorInfo.hCursor);
                        ICONINFO iconInfo;
                        int      iconX, iconY;
                        GetIconInfo(iconPointer, out iconInfo);
                        iconX = cursorInfo.ptScreenPos.x - ((int)iconInfo.xHotspot);
                        iconY = cursorInfo.ptScreenPos.y - ((int)iconInfo.yHotspot);
                        DrawIcon(g.GetHdc(), 0, 0, cursorInfo.hCursor);
                        g.ReleaseHdc();
                    }
                }
                kq = (int)DBase.getObjectLenght(bitmapDrawIcon);
                //MemoryStream ms = new MemoryStream();
                //bitmapDrawIcon.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                //kq = ms.ToArray().Length;
            }
            catch (Exception ex) { }
            return(kq);
        }
Пример #30
0
        private void cmsStartWithWindow_Click(object sender, EventArgs e)
        {
            try
            {
                DBase.RegistryDeleteCU("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", "JCS");

                RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);

                if (rk.GetValue("JCS") == null)
                {
                    if (DBase.AutoLogOn == "1")
                    {
                        rk.SetValue("JCS", "\"" + Application.ExecutablePath.ToString() + "\" STARTUP_LOGON");
                    }
                    else
                    {
                        rk.SetValue("JCS", "\"" + Application.ExecutablePath.ToString() + "\" STARTUP");
                    }
                }
                else
                {
                    rk.DeleteValue("JCS");
                }

                if (rk.GetValue("JCS") == null)
                {
                    this.cmsStartWithWindow.Image = null;
                }
                else
                {
                    this.cmsStartWithWindow.Image = global::GB.Properties.Resources._011_yes_16;
                }
            }
            catch (Exception ex) { }
        }
Пример #31
0
 public void UpdateIcon(DataTable dt)
 {
     DBase.AddColumn(dt, "ICON", typeof(Image));
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         //  DBase.SetValue(dt, i, "ICON", Properties.Resources.RemoveBlack);
     }
 }
Пример #32
0
        public void DeletePolygonByName(string name)
        {
            DBase db = new DBase(DataContextConnection);

            Polygons DBpoly = (from c in db.Polygons
                             where c.PARENT_ID == null && c.NAME==name
                             select c).SingleOrDefault<Polygons>();
            // delete subpolygons
            IQueryable<Polygons> DBsubpolys = from c in db.Polygons
                                              where c.PARENT_ID == DBpoly.ID
                                              select c;
            foreach (Polygons DBsubpoly in DBsubpolys)
            {
                db.Points.DeleteAllOnSubmit(DBsubpoly.Points);
                db.Polygons.DeleteOnSubmit(DBsubpoly);
            }
            // delete polygon
            db.Points.DeleteAllOnSubmit(DBpoly.Points);
            db.Polygons.DeleteOnSubmit(DBpoly);

            db.SubmitChanges();
        }
Пример #33
0
        public bool PolygonExists(string name)
        {
            DBase db = new DBase(DataContextConnection);

            Polygons DBpoly = (from c in db.Polygons
                               where c.NAME == name && c.PARENT_ID == null
                               select c).SingleOrDefault<Polygons>();
            if (DBpoly == null) return false;

            return true;
        }
Пример #34
0
        public List<string> loadPolygonsList()
        {
            List<string> list = new List<string>();

            DBase db = new DBase(DataContextConnection);

            IQueryable<Polygons> DBpolys = from c in db.Polygons
                                              where c.PARENT_ID == null
                                              select c;

            foreach (Polygons DBpoly in DBpolys)
            {
                list.Add(DBpoly.NAME);
            }

            return list;
        }
Пример #35
0
        public void SavePolygon(Polygon polyg, string name)
        {
            DBase db = new DBase(DataContextConnection);
            // insert polygon
            Polygons DBpoly = new Polygons
            {
                NAME = name,
            };

            for (int i = 0; i < polyg.VertexCount; i++)
            {
                Points p = new Points
                {
                    X = polyg.GetVertex(i).X,

                    Y = polyg.GetVertex(i).Y,

                    POLYGON_ID = DBpoly.ID,
                };
                DBpoly.Points.Add(p);
            }
            db.Polygons.InsertOnSubmit(DBpoly);
            db.SubmitChanges();

            // insert subPolygons
            for (int i = 0; i < polyg.SubPolygs.Count; i++)
            {
                Polygons DBsubpoly = new Polygons
                {
                    NAME = name,
                    PARENT_ID = DBpoly.ID,
                };

                for (int j = 0; j < polyg.SubPolygs[i].VertexCount; j++)
                {
                    Points sp = new Points
                    {
                        X = polyg.SubPolygs[i].GetVertex(j).X,

                        Y = polyg.SubPolygs[i].GetVertex(j).Y,

                        POLYGON_ID = DBsubpoly.ID,
                    };
                    DBsubpoly.Points.Add(sp);
                }
                db.Polygons.InsertOnSubmit(DBsubpoly);
            }

            db.SubmitChanges();
        }