Пример #1
0
        public static string DeleteRec(long Id)
        {
            string msj = "";

            Db.Transact(() =>
            {
                if (Db.FromId((ulong)Id) is HH hh)
                {
                    if (hh.HasHrk)
                    {
                        msj = "Hareketleri var silemezsiniz.";
                    }
                    else if (hh.Skl == 1)
                    {
                        msj = "Bu Hesabı silemezsiniz.";    // Proje
                    }
                    else if (hh.Skl < 99)
                    {
                        msj = "Alt Hesapları var silemezsiniz.";
                    }
                    else
                    {
                        HH pHH = hh.Prn;
                        hh.Delete();
                        PostDel(pHH);
                    }
                }
            });
            return(msj);
        }
Пример #2
0
        void Handle(Input.ApdTrgr Action)
        {
            var p = this.Parent as HHsPage;

            if (!string.IsNullOrWhiteSpace(Ad))
            {
                Msj = HH.InsertRec(p.PPId, Id, Ad, ThmGdr, ThmGdr, Info);
                if (!string.IsNullOrEmpty(Msj))
                {
                    Action.Cancelled = true;
                    return;
                }
            }
            Opened = false;

            p.Data = null;

            Session.RunTaskForAll((s, sId) => {
                var cp = (s.Store[nameof(MasterPage)] as MasterPage).CurrentPage;
                if (cp is HHsPage)
                {
                    (s.Store[nameof(MasterPage)] as MasterPage).CurrentPage.Data = null;
                    s.CalculatePatchAndPushOnWebSocket();
                }
            });
        }
Пример #3
0
 private void ProtectFriend()
 {
     if (Operation.ProtectId != 0)
     {
         try
         {
             SetMessageLn("保护" + GetFriendNameById(Operation.ProtectId) + ":");
             string param = string.Format("verify={0}&touid={1}&_=", this._verifyCode, Operation.ProtectId);
             HH.DelayedTime = Constants.DELAY_2SECONDS;
             string content = HH.Post("http://www.kaixin001.com/bite/shield.php", param);
             //{"ret":"","prompt":"<div style='margin:20px 0 60px 60px;'><strong class='f14'>\u4f60\u5df2\u7ecf\u6210\u4e3a\u6731\u536b\u9752\u7684\u4fdd\u62a4\u5929\u4f7f\uff01<br>\u5982\u679c\u522b\u4eba\u6765\u54ac\u6731\u536b\u9752\uff0c\u4f60\u5c06\u66ff\u5979\u62b5\u6321\u4e00\u53e3\u3002<\/strong><\/div>"}
             JsonTextParser       parser  = new JsonTextParser();
             JsonObjectCollection objects = parser.Parse(content) as JsonObjectCollection;
             string ret = JsonHelper.FiltrateHtmlTags(JsonHelper.GetStringValue(objects["ret"]) + JsonHelper.GetStringValue(objects["prompt"]));
             SetMessage(ret);
         }
         catch (ThreadAbortException)
         {
             throw;
         }
         catch (ThreadInterruptedException)
         {
             throw;
         }
         catch (Exception ex)
         {
             LogHelper.Write("GameBite.ProtectFriend", ex, LogSeverity.Error);
             SetMessageLn("保护好友失败!错误:" + ex.Message);
         }
     }
 }
Пример #4
0
 public static void PostDel(HH phh)
 {
     if (phh.IsLeaf)
     {
         PostIns(phh);
     }
 }
        public IHttpActionResult PutHH(string id, HH hH)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != hH.MA_HANG)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HHExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #6
0
        public static void UpdateParentsGrcToplam(HH leaf)
        {
            // Leaf'den baslayip Roota kadar. Ara hesaplar icin yapilmaz.
            Db.Transact(() =>
            {
                if (leaf.Prn != null)   // Parent/Ust hesabi varsa
                {
                    HH pHH         = leaf.Prn;
                    decimal GrcGlr = 0, GrcGdr = 0;
                    decimal BklGlr = 0, BklGdr = 0;
                    do
                    {
                        GrcGlr = 0;
                        GrcGdr = 0;
                        BklGlr = 0;
                        BklGdr = 0;
                        foreach (var hh in Db.SQL <HH>("select r from HH r where r.Prn = ?", pHH))
                        {
                            GrcGlr += hh.GrcGlr;
                            GrcGdr += hh.GrcGdr;
                            BklGlr += hh.BklGlr;
                            BklGdr += hh.BklGdr;
                        }
                        pHH.GrcGlr = GrcGlr;
                        pHH.GrcGdr = GrcGdr;
                        pHH.BklGlr = BklGlr;
                        pHH.BklGdr = BklGdr;

                        pHH = pHH.Prn;
                    }while (pHH != null);
                }
            });
        }
Пример #7
0
        public static void CopyFromPP(PP spp, PP dpp)
        {
            if (!CanCopyTo(dpp))
            {
                return;
            }

            HH[] dhh = new HH[9];
            dhh[0] = dpp.HHroot;
            int not = 0;

            List <HH> list = new List <HH>();

            ChildreenOfNode(spp.HHroot, 0, list);

            Db.Transact(() =>
            {
                foreach (var hh in list)
                {
                    not = hh.Lvl - 1;   // 2den baslar. 1den baslasin 0:dpp.HHroot

                    dhh[not] = new HH
                    {
                        PP  = dpp,
                        Prn = dhh[not - 1],
                        Ad  = hh.Ad,
                    };
                }
            });
        }
Пример #8
0
        }//free video

        private void Video_Timer_Tick(object sender, EventArgs e)
        {
            string HH, MM, SS;

            if (Video_Timer_Enable)
            {
                VideoPosition  = (int)vid.CurrentPosition;
                trackBar.Value = 10 * VideoPosition;
                hour           = VideoPosition / 3600;
                minute         = (VideoPosition - hour * 3600) / 60;
                second         = (VideoPosition - hour * 3600 - minute * 60);

                HH           = ("00" + hour.ToString());
                HH           = HH.Substring(HH.Length - 2, 2);
                MM           = ("00" + minute.ToString());
                MM           = MM.Substring(MM.Length - 2, 2);
                SS           = ("00" + second.ToString());
                SS           = SS.Substring(SS.Length - 2, 2);
                curTime.Text = HH + ":" + MM + ":" + SS;

                if (curTime.Text == Video_Time)
                {
                    audio_stop_Click(null, null);
                }
            }
        }
        public IHttpActionResult PostHH(HH hH)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.HHs.Add(hH);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (HHExists(hH.MA_HANG))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = hH.MA_HANG }, hH));
        }
Пример #10
0
        private BiteStatus BiteTheFriend(int id)
        {
            if (id <= 0)
            {
                return(BiteStatus.Unknown);
            }
            SetMessageLn(string.Format("咬 {0}:", this.GetFriendNameById(id)));
            if (Operation.BiteBlackList.Contains(id))
            {
                SetMessage(" 在不被咬名单中,不咬 ");
                return(BiteStatus.InBlackList);
            }

            string content = RequestBiteStyle(id.ToString());
            string param   = string.Format("verify={0}&touid={1}&style={2}&position={3}&acc={4}", new object[] { this._verifyCode, id.ToString(), GetBiteStyle(content), GetBitePosition(content), this._biteAcc });

            for (int ix = 0; ix < 2; ix++)
            {
                HH.DelayedTime = Constants.DELAY_4SECONDS;
                content        = HH.Post("http://www.kaixin001.com/bite/bite.php", param);
                string ret = this.GetBiteFeedBack(content);
                if (ret.StartsWith("你的体力已几乎耗尽,需要休息") || ret.Contains("你的体力已耗尽,需要休息"))
                {
                    if (!this.StartRecover())
                    {
                        return(BiteStatus.NoRoom);
                    }
                    else
                    {
                        return(BiteStatus.IsRecovering);
                    }
                }
            }
            return(BiteStatus.Healthy);
        }
Пример #11
0
 public static unsafe int HtmlHelpW <T>(HandleRef hwndCaller, string pszFile, HH uCommand, ref T data) where T : unmanaged
 {
     fixed(void *dwData = &data)
     {
         return(HtmlHelpW(hwndCaller, pszFile, uCommand, (IntPtr)dwData));
     }
 }
Пример #12
0
 public static unsafe int HtmlHelpW(HandleRef hwndCaller, string pszFile, HH uCommand, string data)
 {
     fixed(char *dwData = data)
     {
         return(HtmlHelpW(hwndCaller, pszFile, uCommand, (IntPtr)(void *)dwData));
     }
 }
Пример #13
0
        public static int HtmlHelpW(HandleRef hwndCaller, string pszFile, HH uCommand, IntPtr dwData)
        {
            int result = HtmlHelpW(hwndCaller.Handle, pszFile, uCommand, dwData);

            GC.KeepAlive(hwndCaller.Wrapper);
            return(result);
        }
Пример #14
0
        private void ApproveRecover(string content)
        {
            //var g_be_rest_agree = parseInt("1");  有人在我家休息,而且我已经同意
            //var g_be_rest_agree = parseInt("0");  有人在我家休息,但我还没同意
            //var g_be_rest_agree = parseInt("");  没有人在我家休息

            SetMessageLn("正在检查是否有人在我家休息...");

            try
            {
                string strStatus = JsonHelper.GetMid(content, "var g_be_rest_agree = parseInt(\"", "\")");
                if (strStatus == null || strStatus == "")
                {
                    SetMessage("没有人在我家休息");
                }
                else if (strStatus == "1")
                {
                    string message = JsonHelper.GetMid(content, "<div class=\"c hf_yr\" id=rest2div", "<div class=\"c hfb\">");
                    message = JsonHelper.GetMid(message, "<ul class=\"l\">", "</li>");
                    SetMessageLn(JsonHelper.FiltrateHtmlTags(message));
                }
                else
                {
                    string user   = JsonHelper.GetMid(content, "javascript:agree(", ")");
                    int    userid = JsonHelper.GetInteger(user);

                    string param;
                    string username = JsonHelper.GetMid(content, "\"sl\"><strong>", "</strong>");
                    SetMessage(string.Format("{0}正在我家休息", username));
                    if ((Operation.AllowRestList.Count <= 0) || Operation.AllowRestList.Contains(userid))
                    {
                        param          = "verify=" + this._verifyCode + "&touid=" + userid + "&agree=1";
                        HH.DelayedTime = Constants.DELAY_1SECONDS;
                        HH.Post("http://www.kaixin001.com/bite/agree.php", param);
                        SetMessage(string.Format(" 允许{0}在我家休息", username));
                    }
                    else
                    {
                        param          = "verify=" + this._verifyCode + "&touid=" + userid + "&agree=0";
                        HH.DelayedTime = Constants.DELAY_1SECONDS;
                        HH.Post("http://www.kaixin001.com/bite/agree.php", param);
                        SetMessage(string.Format(" 拒绝{0}在我家休息", username));
                    }
                }
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (ThreadInterruptedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                LogHelper.Write("GameBite.ApproveRecover", content, ex, LogSeverity.Error);
                SetMessageLn("同意别人在我家休息失败!错误:" + ex.Message);
            }
        }
        public ActionResult DeleteConfirmed(string id)
        {
            HH dM_HANG_HOA = db.HHs.Find(id);

            db.HHs.Remove(dM_HANG_HOA);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #16
0
        private void SellAsset()
        {
            //出售资产
            SetMessageLn("出售资产...");

            if (this._myAssetsList.Count <= 0)
            {
                SetMessage("你没有任何资产可以出售!");
                return;
            }

            int num = 0;

            foreach (MyAssetInfo myasset in this._myAssetsList)
            {
                try
                {
                    //诺亚方舟船票
                    if (myasset.IId == 145)
                    {
                        SetMessageLn(string.Format("#{0}诺亚方舟船票:价值100亿,无法出售,跳过", ++num));
                        continue;
                    }

                    if (_cantransaction == false)
                    {
                        return;
                    }

                    AssetInfo asset = GetAssetById(myasset.IId);
                    if (asset != null)
                    {
                        SetMessageLn(string.Format("#{0}{1} 购买价格:{2}元 当前价格:{3}元 数量:{4}", ++num, asset.Name, myasset.BuyPrice, myasset.CurrentPrice, myasset.AssetNum));
                        if (asset.SellPrice <= myasset.CurrentPrice)
                        {
                            SetMessage(string.Format(" 当前的价格{0} >= 推荐出售价格{1},尝试出售...", myasset.CurrentPrice, asset.SellPrice));
                            HH.DelayedTime = Constants.DELAY_2SECONDS;
                            string content = HH.Post(string.Format("http://www.kaixin001.com/!rich/!sell.php?iid={0}&cost_price={1}&sell_price={2}&t=0.9385619927258357", myasset.IId, myasset.BuyPrice, myasset.CurrentPrice), string.Format("iid={0}&num={1}&sell_price={2}", myasset.IId, myasset.AssetNum, myasset.CurrentPrice));
                            if (GetSellAssetFeedback(content))
                            {
                                _transactedasset = true;
                            }
                        }
                        else
                        {
                            SetMessage(string.Format(" 当前的价格{0} < 推荐出售价格{1},跳过", myasset.CurrentPrice, asset.SellPrice));
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.Write("GameRich.SellAsset", ex, LogSeverity.Error);
                    continue;
                }
            }
        }
Пример #17
0
        public IHttpActionResult GetHH(string id)
        {
            HH Hh = db.HHs.Find(id);
            if (Hh == null)
            {
                return NotFound();
            }

            return Ok(Hh);
        }
Пример #18
0
        public IHttpActionResult PostHH(HH Hh)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            HH hanghoa = new HH();

            hanghoa.MA_HANG = AutoMA_HANG();
            if (Hh.HINH_ANH != "")
            {
                hanghoa.HINH_ANH = Hh.HINH_ANH;
            }

            hanghoa.TEN_HANG          = Hh.TEN_HANG;
            hanghoa.MA_NHOM_HANG      = Hh.MA_NHOM_HANG;
            hanghoa.MA_CHUAN          = Hh.MA_CHUAN;
            hanghoa.THONG_SO          = Hh.THONG_SO;
            hanghoa.MA_NHAP_HANG      = Hh.MA_NHAP_HANG;
            hanghoa.DON_VI_TINH       = Hh.DON_VI_TINH;
            hanghoa.KHOI_LUONG        = Hh.KHOI_LUONG;
            hanghoa.XUAT_XU           = Hh.XUAT_XU;
            hanghoa.GIA_NHAP          = Hh.GIA_NHAP;
            hanghoa.GIA_LIST          = Hh.GIA_LIST;
            hanghoa.BAO_HANH          = Hh.BAO_HANH;
            hanghoa.THONG_SO_KY_THUAT = Hh.THONG_SO_KY_THUAT;
            hanghoa.QUY_CACH_DONG_GOI = Hh.QUY_CACH_DONG_GOI;
            hanghoa.DISCONTINUE       = Hh.DISCONTINUE;
            hanghoa.GHI_CHU           = Hh.GHI_CHU;
            hanghoa.MA_CHUYEN_DOI     = Hh.MA_CHUYEN_DOI;
            hanghoa.TK_CHI_PHI        = Hh.TK_CHI_PHI;
            hanghoa.TK_DOANH_THU      = Hh.TK_DOANH_THU;
            hanghoa.TK_HACH_TOAN_KHO  = Hh.TK_HACH_TOAN_KHO;
            hanghoa.SERIES            = Hh.SERIES;
            hanghoa.MA_DO_SALE_TAO    = Hh.MA_DO_SALE_TAO;
            db.HHs.Add(hanghoa);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (DM_HANG_HOAExists(Hh.MA_HANG))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(Ok(hanghoa.MA_HANG));
        }
Пример #19
0
        public static void ChildreenOfNode(HH node, int lvl, List <HH> list)
        {
            var HHs = Db.SQL <HH>("select r from HH r where r.Prn = ? order by r.Ad", node);

            foreach (var hh in HHs)
            {
                list.Add(hh);

                ChildreenOfNode(hh, lvl + 1, list);
            }
        }
Пример #20
0
        void Handle(Input.UpdTrgr Action)
        {
            HH.UpdateRec(Id, Ad, ThmGdr, ThmGlr, Info);

            Session.RunTaskForAll((s, id) =>
            {
                s.CalculatePatchAndPushOnWebSocket();
            });

            Opened = false;
        }
Пример #21
0
        protected override void OnData()
        {
            base.OnData();

            if (Db.FromId((ulong)HHId) is HH hh)
            {
                Hdr = $"{hh.PP.CC.Ad}►{HH.FullParentAd(hh)}";

                AAs.Data = HH.CumBky(hh);
            }
        }
Пример #22
0
        public IHttpActionResult GetHH(string id)
        {
            HH HH = db.HHs.Find(id);

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

            return(Ok(HH));
        }
Пример #23
0
        public static string AdFullLvl(HH hh, int Lvl)
        {
            string full = hh.Ad;
            HH     pHH  = hh.Prn;

            while (pHH != null && pHH.Lvl > Lvl)
            {
                full = $"{full}◄{pHH.Ad}";
                pHH  = pHH.Prn;
            }
            return(full);
        }
Пример #24
0
        public string RequestRichHomePage(bool IsInitial)
        {
            string content = HH.Get("http://www.kaixin001.com/!rich/index.php");

            if (content.IndexOf("<title>添加组件 - 开心网</title>") != -1)
            {
                SetMessageLn("还未安装超级大亨组件,尝试安装中...");
                HH.Post("http://www.kaixin001.com/app/install.php", "aid=1092&isinstall=1");
                content = HH.Get("http://www.kaixin001.com/!rich/index.php");
            }
            this._verifyCode = JsonHelper.GetMid(content, "g_verify = \"", "\"");
            return(content);
        }
Пример #25
0
        public IHttpActionResult DeleteDM_HANG_HOA(string id)
        {
            HH Hh = db.HHs.Find(id);
            if (Hh == null)
            {
                return NotFound();
            }

            db.HHs.Remove(Hh);
            db.SaveChanges();

            return Ok(Hh);
        }
Пример #26
0
        public string RequestBiteHomePage()
        {
            string content = HH.Get("http://www.kaixin001.com/app/app.php?aid=1048");

            if (content.IndexOf("<title>添加组件 - 开心网</title>") != -1)
            {
                SetMessageLn("还未安装咬人组件,尝试安装中...");
                HH.Post("http://www.kaixin001.com/app/install.php", "aid=1048&isinstall=1");
                content = HH.Get("http://www.kaixin001.com/app/app.php?aid=1048");
            }
            this._verifyCode = JsonHelper.GetMid(content, "g_verify = \"", "\"");
            return(content);
        }
Пример #27
0
        public static string FullParentAd(HH hh)
        {
            string fullAd = $"{hh.Ad}";

            HH pHH = hh.Prn;

            while (pHH != null && pHH.Lvl > 1)
            {
                fullAd = $"{pHH.Ad}►{fullAd}";
                pHH    = pHH.Prn;
            }
            return(fullAd);
        }
Пример #28
0
        public IHttpActionResult PutDM_HANG_HOA(HH Hh)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var hanghoa = db.HHs.Where(x => x.MA_HANG == Hh.MA_HANG).FirstOrDefault();

            if (hanghoa != null)
            {
                if (Hh.HINH_ANH != "")
                {
                    hanghoa.HINH_ANH = Hh.HINH_ANH;
                }

                hanghoa.TEN_HANG          = Hh.TEN_HANG;
                hanghoa.MA_NHOM_HANG      = Hh.MA_NHOM_HANG;
                hanghoa.MA_CHUAN          = Hh.MA_CHUAN;
                hanghoa.THONG_SO          = Hh.THONG_SO;
                hanghoa.MA_NHAP_HANG      = Hh.MA_NHAP_HANG;
                hanghoa.DON_VI_TINH       = Hh.DON_VI_TINH;
                hanghoa.KHOI_LUONG        = Hh.KHOI_LUONG;
                hanghoa.XUAT_XU           = Hh.XUAT_XU;
                hanghoa.GIA_NHAP          = Hh.GIA_NHAP;
                hanghoa.GIA_LIST          = Hh.GIA_LIST;
                hanghoa.BAO_HANH          = Hh.BAO_HANH;
                hanghoa.THONG_SO_KY_THUAT = Hh.THONG_SO_KY_THUAT;
                hanghoa.QUY_CACH_DONG_GOI = Hh.QUY_CACH_DONG_GOI;
                hanghoa.DISCONTINUE       = Hh.DISCONTINUE;
                hanghoa.GHI_CHU           = Hh.GHI_CHU;
                hanghoa.MA_CHUYEN_DOI     = Hh.MA_CHUYEN_DOI;
                hanghoa.TK_CHI_PHI        = Hh.TK_CHI_PHI;
                hanghoa.TK_DOANH_THU      = Hh.TK_DOANH_THU;
                hanghoa.TK_HACH_TOAN_KHO  = Hh.TK_HACH_TOAN_KHO;
                hanghoa.SERIES            = Hh.SERIES;
            }


            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #29
0
        private bool SendFriendRequest(int uid, string requestcontent)
        {
            string param   = string.Format("from=&touid={0}&content={1}", uid, DataConvert.GetEncodeData(requestcontent));
            string content = HH.Post("http://www.kaixin001.com/friend/addverify.php", param);

            if (content.IndexOf("var type = \"4\"") != -1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public IHttpActionResult DeleteHH(string id)
        {
            HH hH = db.HHs.Find(id);

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

            db.HHs.Remove(hH);
            db.SaveChanges();

            return(Ok(hH));
        }