コード例 #1
0
        public async Task <IHttpActionResult> PutZoneMaster(int id, ZoneMaster zoneMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != zoneMaster.Id)
            {
                return(BadRequest());
            }

            db.Entry(zoneMaster).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ZoneMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
    public DataView BindGvZoneDetail()
    {
        DataTable dt = new DataTable();

        dt = ZoneMaster.GetZoneMaster();
        DataView dv = new DataView(dt);

        return(dv);
    }
コード例 #3
0
        public async Task <IHttpActionResult> GetZoneMaster(int id)
        {
            ZoneMaster zoneMaster = await db.Zones.FindAsync(id);

            if (zoneMaster == null)
            {
                return(NotFound());
            }

            return(Ok(zoneMaster));
        }
コード例 #4
0
        public async Task <IHttpActionResult> PostZoneMaster(ZoneMaster zoneMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Zones.Add(zoneMaster);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = zoneMaster.Id }, zoneMaster));
        }
コード例 #5
0
        public async Task <IHttpActionResult> DeleteZoneMaster(int id)
        {
            ZoneMaster zoneMaster = await db.Zones.FindAsync(id);

            if (zoneMaster == null)
            {
                return(NotFound());
            }

            db.Zones.Remove(zoneMaster);
            await db.SaveChangesAsync();

            return(Ok(zoneMaster));
        }
コード例 #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            ZoneMaster a = (from c in db.ZoneMasters where c.ZoneID == id select c).FirstOrDefault();

            if (a == null)
            {
                return(HttpNotFound());
            }
            else
            {
                db.ZoneMasters.Remove(a);
                db.SaveChanges();
                TempData["SuccessMsg"] = "You have successfully Deleted Zone Name.";
                return(RedirectToAction("Index"));
            }
        }
コード例 #7
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (DDLSuperZone.SelectedIndex == 0)
     {
         MessageBox("Select SuperZone");
         DDLSuperZone.Focus();
     }
     else
     {
         ZoneMaster _objZm = new ZoneMaster();
         _objZm.ZoneID      = Convert.ToInt32(lblID.Text);
         _objZm.ZoneCode    = txtZoneCode.Text.Trim();
         _objZm.ZoneName    = txtZoneName.Text.Trim();
         _objZm.SuperZoneID = Convert.ToInt32(DDLSuperZone.SelectedItem.Value.ToString());
         _objZm.IsActive    = Chekacv.Checked;
         try
         {
             _objZm.Save();
             MessageBox("Record saved successfully");
             grdZoneDetails.DataSource = BindGvZoneDetail();
             grdZoneDetails.DataBind();
             if (btnSave.Text == "Update")
             {
                 pnlZoneDetails.Visible = true;
                 pnlZone.Visible        = false;
                 btnSave.Visible        = false;
                 btnSave.Text           = "Save";
                 txtZoneCode.Enabled    = true;
                 filter.Visible         = true;
             }
             else
             {
                 pnlZoneDetails.Visible = false;
                 pnlZone.Visible        = true;
                 txtZoneCode.Text       = "";
                 txtZoneCode.Focus();
                 txtZoneName.Text           = "";
                 DDLSuperZone.SelectedValue = null;
             }
         }
         catch
         {
         }
     }
 }
コード例 #8
0
        public ActionResult Edit(ZoneNameVM v)
        {
            ZoneMaster a = new ZoneMaster();

            if (ModelState.IsValid)
            {
                a.ZoneID     = v.ZoneID;
                a.ZoneName   = v.ZoneName;
                a.StatusZone = v.StatusZone;
                a.ZoneType   = v.ZoneType;

                db.Entry(a).State = EntityState.Modified;
                db.SaveChanges();
                TempData["SuccessMsg"] = "You have successfully Update Zone Name.";
                return(RedirectToAction("Index"));
            }

            return(View());
        }
コード例 #9
0
        public ActionResult Create(ZoneNameVM v)
        {
            ZoneMaster a   = new ZoneMaster();
            int        max = (from c in db.ZoneMasters orderby c.ZoneID descending select c.ZoneID).FirstOrDefault();

            if (ModelState.IsValid)
            {
                a.ZoneID     = max + 1;
                a.ZoneName   = v.ZoneName;
                a.StatusZone = v.StatusZone;
                a.ZoneType   = v.ZoneType;

                db.ZoneMasters.Add(a);
                db.SaveChanges();
                TempData["SuccessMsg"] = "You have successfully added Zone Name.";
                return(RedirectToAction("Index"));
            }
            return(View());
        }
コード例 #10
0
        public ActionResult Edit(int id)
        {
            var zonetype = new SelectList(new[]
            {
                new { ID = "D", type = "Domestic" },
                new { ID = "I", type = "International" },
            },
                                          "ID", "type", 1);

            ViewBag.zonetype = zonetype;

            ZoneMaster a = (from c in db.ZoneMasters where c.ZoneID == id select c).FirstOrDefault();
            ZoneNameVM v = new ZoneNameVM();

            v.ZoneID     = a.ZoneID;
            v.ZoneName   = a.ZoneName;
            v.StatusZone = a.StatusZone;
            v.ZoneType   = a.ZoneType;
            return(View(v));
        }
コード例 #11
0
    protected void grdZoneDetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        ZoneMaster _objZM = new ZoneMaster();

        _objZM.ZoneID   = Convert.ToInt32(((Label)grdZoneDetails.Rows[e.RowIndex].FindControl("lblZID")).Text);
        _objZM.ZoneCode = ((Label)grdZoneDetails.Rows[e.RowIndex].FindControl("lblZCode")).Text;
        _objZM.ZoneName = ((Label)grdZoneDetails.Rows[e.RowIndex].FindControl("lblZName")).Text;
        // _objZM.SuperZoneID = Convert.ToInt32(((Label)grdZoneDetails.Rows[e.RowIndex].FindControl("lblSZName")).Text);

        _objZM.IsActive  = Convert.ToBoolean(false);
        _objZM.IsDeleted = Convert.ToBoolean(true);
        try
        {
            _objZM.Save();
            MessageBox("Your record is Deleted");
            grdZoneDetails.DataSource = BindGvZoneDetail();
            grdZoneDetails.DataBind();
            pnlZoneDetails.Visible = true;
            pnlZone.Visible        = false;
        }
        catch
        {
        }
    }
コード例 #12
0
        private static void onAtho(object arg1, ResEventArgs arg2)
        {
            try
            {
                if (arg2.PackSendData.AllData.Count < 4)
                {
                    throw new Exception("Atho Function Not Count is " + arg2.PackSendData.AllData.Count.ToString() + " Must be or more 4 ");
                }

                var username = arg2.PackSendData.AllData.Find(x => x.PramterName == 0).DataS.ToString();
                var password = arg2.PackSendData.AllData.Find(x => x.PramterName == 1).DataS.ToString();
                var id       = Convert.ToInt32(arg2.PackSendData.AllData.Find(x => x.PramterName == 2).DataS);
                var Room     = Convert.ToInt32(arg2.PackSendData.AllData.Find(x => x.PramterName == 3).DataS);
                var zone     = ZoneMaster.GetZoneBy(id);
                if (arg2.ConnctionType == Interface.Connctions.ConnctionType.UDP)
                {
                    if (zone != null)
                    {
                        if (ZoneMaster.CanLoginToZoneBy(username, password, zone))
                        {
                            IUser user;
                            ZoneMaster.AddUserToRoomLubbyBy(username, password, Room, ref zone, arg2.UserSenderAllInfo, out user);
                            if (user.ConnctionUDP == null)
                            {
                                user.ConnctionUDP      = new StateObjectupb();
                                user.ConnctionUDP.user = user;
                                var portout = 0;
                                var v       = user.ConnctionUDP;

                                if (server.WatchUdpByPort(ref v, out portout))
                                {
                                    var newdatapack = new List <Core.Data.Data>();
                                    newdatapack.Add(new Core.Data.Data(user.IdIntTempUDP, 0));
                                    newdatapack.Add(new Core.Data.Data(portout, 1));

                                    var newpacket = new PackSendData(5, newdatapack);

                                    server.Sendudp(arg2.UserSenderAllInfo.workSocket, newpacket, arg2.UserSenderAllInfo.IPEndPointUDP);
                                }
                                else
                                {
                                    throw new CanNotWatchUdpPort();
                                }
                            }
                            else
                            {
                                var newdatapack = new List <Core.Data.Data>();
                                newdatapack.Add(new Core.Data.Data(user.IdIntTempUDP, 0));
                                newdatapack.Add(new Core.Data.Data((user.ConnctionUDP.workSocket.LocalEndPoint as IPEndPoint).Port, 1));

                                var newpacket = new PackSendData(5, newdatapack);

                                server.Sendudp(arg2.UserSenderAllInfo.workSocket, newpacket, arg2.UserSenderAllInfo.IPEndPointUDP);
                            }
                        }
                    }
                }
                else
                {
                    if (zone != null)
                    {
                        if (ZoneMaster.CanLoginToZoneBy(username, password, zone))
                        {
                            IUser user;
                            ZoneMaster.AddUserToRoomLubbyBy(username, password, Room, ref zone, arg2.UserSenderAllInfo, out user);
                            if (user.ConnctionTCP == null)
                            {
                                user.ConnctionTCP      = arg2.UserSenderAllInfo;
                                user.ConnctionTCP.user = user;

                                arg2.UserSenderAllInfo.user = user;
                            }
                        }
                    }
                }
            }
            catch (UserNameOrPasswordError e)
            {
                #if DEBUG
                Console.WriteLine(e.ToString());
            #endif
            }

            catch (Exception e)
            {
                #if DEBUG
                Console.WriteLine(e.ToString());
                 #endif
            }
            finally
            {
            }
        }