示例#1
0
文件: Common.cs 项目: haasn/compilers
  // FFI wrapper, lifts a native function to a Kleisli arrow in IO
  static Fun ffi (int arity, Func<dynamic[], dynamic> f) {
    return new Fun (delegate {
      // The arrow takes ‘arity’ parameters..
      Fun[] vars = new Fun[arity];
      for (int i = 0; i < arity; i++) {
        vars[i] = stack.Pop(); }

      // ..and creates an n-tuple which simply applies them all to their cont
      stack.Push(new Fun(delegate {
        var cont = stack.Pop();
        foreach (Fun a in vars)
          stack.Push (a);
        return cont; }));

      stack.Push (_returnIOF);

      // The impure ffi action needs to be lifted to work with n-tuples
      stack.Push (new Fun (delegate {
        var i = stack.Pop ();
        stack.Push (liftn (arity, new dynamic[arity], f));
        return i; }));

      return _runIO; }); }
示例#2
0
 public void Init()
 {
     list = new HashBag <int>(TenEqualityComparer.Default);
     pred = delegate(int i) { return(i % 5 == 0); };
 }
示例#3
0
 /// <summary>
 ///     Initialize instance.
 /// </summary>
 /// <param name="fun">Function to modify reference time.</param>
 public Modify(Fun fun)
 {
     _fun = fun;
 }
示例#4
0
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);

            bool iskey = false;
            Fun  fun   = null;

            // Console.WriteLine(m.Msg.ToString());



            if (m.Msg == WM_KEYDOWN)
            {
                iskey = true;
                fun   = (x, y) => x | y;
            }
            else if (m.Msg == WM_KEYUP)
            {
                iskey = true;
                fun   = (x, y) => x ^ y;
            }

            if (iskey)
            {
                int    num = _Nes.joypaddata1;
                string key = m.WParam.ToString();

                if (key == "75") //A  (健盘K)
                {
                    num = fun(num, 0x01);
                }
                else if (key == "74") //B  (健盘J)
                {
                    num = fun(num, 0x02);
                }
                else if (key == "86") //Select   (健盘V)
                {
                    num = fun(num, 0x04);
                }
                else if (key == "66") //Select   (健盘B)
                {
                    num = fun(num, 0x08);
                }
                else if (key == "87") //Up   (健盘W)
                {
                    num = fun(num, 0x10);
                }
                else if (key == "83") //Down   (健盘S)
                {
                    num = fun(num, 0x20);
                }
                else if (key == "65") //Left   (健盘A)
                {
                    num = fun(num, 0x40);
                }
                else if (key == "68") //Right   (健盘D)
                {
                    num = fun(num, 0x80);
                }

                _Nes.joypaddata1 = num;
                System.Console.WriteLine(num);
            }
        }
示例#5
0
        public async Task <FightHistory> MakeFightAsync(List <PlayerInfo> players, bool oneCard = false)
        {
            var totalCards = new List <CardInfo>();

            foreach (var player in players)
            {
                foreach (var card in player.Cards)
                {
                    card.Health = card.GetHealthWithPenalty();
                    totalCards.Add(await card.GetCardInfoAsync(_shClient));
                }
            }

            var  rounds = new List <RoundInfo>();
            bool fight  = true;

            while (fight)
            {
                var round = new RoundInfo();
                totalCards = totalCards.Shuffle().ToList();

                foreach (var card in totalCards)
                {
                    if (card.Card.Health <= 0)
                    {
                        continue;
                    }

                    var enemies = totalCards.Where(x => x.Card.Health > 0 && x.Card.GameDeckId != card.Card.GameDeckId);
                    if (enemies.Count() > 0)
                    {
                        var target = Fun.GetOneRandomFrom(enemies);
                        var dmg    = GetDmgDeal(card, target);
                        target.Card.Health -= dmg;

                        var hpSnap = round.Cards.FirstOrDefault(x => x.CardId == target.Card.Id);
                        if (hpSnap == null)
                        {
                            round.Cards.Add(new HpSnapshot
                            {
                                CardId = target.Card.Id,
                                Hp     = target.Card.Health
                            });
                        }
                        else
                        {
                            hpSnap.Hp = target.Card.Health;
                        }

                        round.Fights.Add(new AttackInfo
                        {
                            Dmg       = dmg,
                            AtkCardId = card.Card.Id,
                            DefCardId = target.Card.Id
                        });
                    }
                }

                rounds.Add(round);

                if (oneCard)
                {
                    fight = totalCards.Count(x => x.Card.Health > 0) > 1;
                }
                else
                {
                    var alive = totalCards.Where(x => x.Card.Health > 0);
                    var one   = alive.FirstOrDefault();
                    if (one == null)
                    {
                        break;
                    }

                    fight = alive.Any(x => x.Card.GameDeckId != one.Card.GameDeckId);
                }
            }

            PlayerInfo winner = null;
            var        win    = totalCards.Where(x => x.Card.Health > 0).FirstOrDefault();

            if (win != null)
            {
                winner = players.FirstOrDefault(x => x.Cards.Any(c => c.GameDeckId == win.Card.GameDeckId));
            }

            return(new FightHistory(winner)
            {
                Rounds = rounds
            });
        }
示例#6
0
 public int RandomizeHealth(Card card)
 => Fun.GetRandomValue(card.Rarity.GetHealthMin(), card.GetHealthMax() + 1);
示例#7
0
 public int RandomizeAttack(Rarity rarity)
 => Fun.GetRandomValue(rarity.GetAttackMin(), rarity.GetAttackMax() + 1);
示例#8
0
 public List <T2> Map <T2> (Fun <T, T2> x)
 {
     return(new List <T2>());
 }
示例#9
0
        private void outputExcel()
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("  SELECT B.strName AS WBName, C.strName AS VarietyName,D.strName AS VarietyLevelName,A.numStorage");
            strSql.Append("  FROM dbo.SA_VarietyStorage A INNER JOIN WB B ON A.WBID=B.ID");
            strSql.Append("    LEFT OUTER JOIN dbo.StorageVariety C ON A.VarietyID=C.ID");
            strSql.Append("   LEFT OUTER JOIN dbo.StorageVarietyLevel_B  D ON A.VarietyLevelID=D.ID");

            if (txtWBID.Value.Trim() != "")
            {
                strSql.Append("   WHERE B.strName = '" + txtWBID.Value + "'");
            }

            strSql.Append("   order by B.strName");

            DataTable dt = SQLHelper.ExecuteDataTable(strSql.ToString());

            if (dt == null || dt.Rows.Count == 0)
            {
                Fun.Alert("请先检索要查询的信息后在导出!");
                return;
            }

            string fileName = "网点库存" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";

            HttpResponse resp;

            resp = Page.Response;
            resp.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            resp.AppendHeader("Content-Disposition", "attachment;filename=" + fileName);
            string colHeaders = "", ls_item = "", ls_Bottom = "";

            DataRow[] myRow = dt.Select();//可以类似dt.Select("id>10")之形式达到数据筛选目的
            int       i     = 0;
            int       cl    = dt.Columns.Count;

            colHeaders += "网点\t品种\t等级\t库存\n";
            resp.Write(colHeaders);
            //向HTTP输出流中写入取得的数据信息

            //逐行处理数据
            foreach (DataRow row in myRow)
            {
                //当前行数据写入HTTP输出流,并且置空ls_item以便下行数据
                for (i = 0; i < cl; i++)
                {
                    if (i == (cl - 1))//最后一列,加\n
                    {
                        ls_item += row[i].ToString() + "\n";
                    }
                    else
                    {
                        ls_item += row[i].ToString() + "\t";
                    }
                }
                resp.Write(ls_item);
                ls_item = "";
            }

            resp.End();
        }
示例#10
0
        private void outputExcel()
        {
            DataTable dt = GetoutputTable();

            if (dt == null || dt.Rows.Count == 0)
            {
                Fun.Alert("请先检索要查询的信息后在导出!");
                return;
            }

            string fileName = "业务统计" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + ".xls";

            HttpResponse resp;

            resp = Page.Response;
            resp.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            resp.AppendHeader("Content-Disposition", "attachment;filename=" + fileName);
            string colHeaders = "", ls_item = "", ls_Bottom = "";

            DataRow[] myRow = dt.Select();//可以类似dt.Select("id>10")之形式达到数据筛选目的
            int       i     = 0;
            int       cl    = dt.Columns.Count;

            colHeaders += "网点\t商品种类\t商品单价\t计量单位\t购买数量\t商品总价\t优惠金额\t预付款金额\t实付金额\t返利金额\n";
            resp.Write(colHeaders);
            //向HTTP输出流中写入取得的数据信息

            //逐行处理数据
            foreach (DataRow row in myRow)
            {
                //当前行数据写入HTTP输出流,并且置空ls_item以便下行数据
                for (i = 0; i < cl; i++)
                {
                    if (i == (cl - 1))//最后一列,加\n
                    {
                        ls_item += row[i].ToString() + "\n";
                    }
                    else
                    {
                        ls_item += row[i].ToString() + "\t";
                    }
                }
                resp.Write(ls_item);
                ls_item = "";
            }


            //添加第二张表格的内容
            StringBuilder strSql2 = new StringBuilder();

            strSql2.Append("  SELECT '', C.strName AS GoodSupplyID, '','', ");
            strSql2.Append("  SUM(GoodSupplyCount)AS GoodSupplyCount,SUM(Money_Total) AS Money_Total,SUM(Money_YouHui) AS Money_YouHui,SUM(Money_PreDefine) AS Money_PreDefine,SUM(Money_Reality) AS Money_Reality,SUM(Money_Back) AS Money_Back");
            strSql2.Append("  FROM dbo.C_Supply A  INNER JOIN dbo.GoodSupply C ON A.GoodSupplyID=C.ID");
            strSql2.Append(" INNER JOIN dbo.WB D ON A.WBID=D.ID");
            strSql2.Append("  where 1=1 and D.ISSimulate=0");
            if (Request.Form["QWBID"] != null && Request.Form["QWBID"].ToString() != "")
            {
                strSql2.Append("   AND A.WBID = " + Request.Form["QWBID"].ToString());
            }
            if (Qdtstart.Value.Trim() != "")
            {
                strSql2.Append("   AND dt_Trade> '" + Qdtstart.Value.Trim() + "'");
            }
            if (Qdtend.Value.Trim() != "")
            {
                strSql2.Append("   AND dt_Trade < '" + Qdtend.Value.Trim() + "'");
            }
            strSql2.Append("    GROUP BY C.strName");

            DataTable dt2 = SQLHelper.ExecuteDataTable(strSql2.ToString());

            DataRow[] myRow2 = dt2.Select();//可以类似dt.Select("id>10")之形式达到数据筛选目的

            int cl2 = dt2.Columns.Count;

            colHeaders = "总计\n";
            resp.Write(colHeaders);
            //向HTTP输出流中写入取得的数据信息
            ls_item = "";
            //逐行处理数据
            foreach (DataRow row in myRow2)
            {
                //当前行数据写入HTTP输出流,并且置空ls_item以便下行数据
                for (int j = 0; j < cl2; j++)
                {
                    if (j == (cl2 - 1))//最后一列,加\n
                    {
                        ls_item += row[j].ToString() + "\n";
                    }
                    else
                    {
                        ls_item += row[j].ToString() + "\t";
                    }
                }
                resp.Write(ls_item);
                ls_item = "";
            }



            resp.End();
        }
示例#11
0
        /// <summary>Метод производит расчёт значения переданной функции и записывает в файл двоинчм потоком</summary>
        /// <param name="fileName">Имя файла</param>
        /// <param name="start">Начальное значение аргумента</param>
        /// <param name="end">Конечное значение агрумента</param>
        /// <param name="step">Шаг дисретизации</param>
        /// <param name="F">Делегат функции</param>
        public static void SaveFunc(string fileName, double start, double end, double step, Fun F)
        {
            FileStream   fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
            BinaryWriter bw = new BinaryWriter(fs);

            while (start <= end)
            {
                bw.Write(F(start));
                start += step;
            }
            bw.Close();
            fs.Close();
        }
示例#12
0
        private void buttj_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = PubStaticFun.WaitCursor();
                int count = 10;
                if (speci.Equals(1))
                {
                    count = 9;
                }
                //Modify By Kevin 2013-10-16
                ParameterEx[] parameters = new ParameterEx[count];

                parameters[0].Text  = "@RQ1";
                parameters[0].Value = dtp1.Value.ToString();

                parameters[1].Text  = "@RQ2";
                parameters[1].Value = dtp2.Value.ToString();

                int type = 0;
                if (rbJg.Checked)
                {
                    type = 0;
                }
                else
                {
                    type = 1;
                }
                parameters[2].Text  = "@TYPE";
                parameters[2].Value = type;

                int tj_type = 0;
                if (rbJsrq.Checked)
                {
                    tj_type = 1;
                }
                if (rbDqzy.Checked)
                {
                    tj_type = 2;
                }

                parameters[3].Text  = "@TJ_TYPE";
                parameters[3].Value = tj_type;

                parameters[4].Text  = "@YKS";
                parameters[4].Value = Convert.ToInt32(Convertor.IsNull(cmbZcDept.SelectedValue, "0"));

                parameters[5].Text  = "@XKS";
                parameters[5].Value = Convert.ToInt32(Convertor.IsNull(cmbZrDept.SelectedValue, "0"));

                //Add By Tany 2011-07-04
                parameters[6].Text  = "@ISBRMX";
                parameters[6].Value = chkBrmx.Checked ? 1 : 0;

                //Modify By Tany 2011-12-06 增加机构编码过滤
                parameters[7].Text  = "@JGBM";
                parameters[7].Value = FrmMdiMain.Jgbm;

                parameters[8].Text  = "@ISZRKS";
                parameters[8].Value = chkZrks.Checked ? 1 : 0;

                if (!speci.Equals(1))
                {
                    //Modify By Daniel 2015-01-22 增加住院号
                    parameters[9].Text  = "@ZYH";
                    parameters[9].Value = txtInp_NO.Text.Trim();
                }

                string Sp_name = "[SP_ZY_TJ_BRSRTJ_ZKBR_zyf2]";
                if (speci == 1)
                {
                    Sp_name = "[SP_ZY_TJ_BRSRTJ_ZKBR_ICU]";
                }

                DataSet dset = new DataSet();
                TrasenFrame.Forms.FrmMdiMain.Database.AdapterFillDataSet(Sp_name, parameters, dset, "sfmx", 60);
                Fun.AddRowtNo(dset.Tables[0]);
                DataTable tb = dset.Tables[0];

                tb.Columns["病人科室"].ColumnName = "计费科室";
                //DataTable tb = InstanceForm.BDatabase.GetDataTable(Sp_name, parameters, 120);
                //AddRowtNo(tb);
                if (tb.Columns.Contains("序号") && tb.Rows.Count > 0)
                {
                    tb.Rows[tb.Rows.Count - 1]["序号"] = "合计";
                }
                tb.Columns[3].SetOrdinal(5);
                //tb.Columns[3].SetOrdinal(4);


                this.dataGridView1.Columns.Clear();
                this.dataGridView1.DataSource = tb;
                //Modify By Daniel 2015-01-22 当病人科室与转入科室不一致时,该行背景色变为淡蓝色
                //Begin
                //if (chkBrmx.Checked == true)
                //{
                //    for (int i = 0; i < tb.Rows.Count; i++)
                //    {
                //        if (tb.Rows[i]["病人科室"].ToString() != tb.Rows[i]["转入科室"].ToString())
                //        {
                //            this.dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Aqua;
                //        }
                //    }
                //}
                //End
                //Modify By Daniel 2015-02-11 修改转入科室的背景色为淡蓝色,转出科室的背景色为黄绿色
                this.dataGridView1.Columns["转入科室"].DefaultCellStyle.BackColor = Color.Blue;
                this.dataGridView1.Columns["转出科室"].DefaultCellStyle.BackColor = Color.Yellow;
                for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
                {
                    if (this.dataGridView1.Columns[i].Name == "sort")
                    {
                        this.dataGridView1.Columns[i].Visible = false;
                        break;
                    }
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
        public async Task GoodsCheck(string code, string state, string prcode)
        {
            if (string.IsNullOrEmpty(code))
            {
                string ip = this.httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
                if (!string.IsNullOrEmpty(prcode))
                {
                    state = $"{state}_{prcode}";
                }
                state = $"{state}|{ip}";
                var url = Helper.WeiChat.Utility.GetWebpageAuthorization(appConfig.WeiXin.Appid, $"http://{Request.Host.Host}{Request.Path}", Fun.Base64Encode(state), false);
                Response.Redirect(url);
            }
            else
            {
                var stateList = Fun.Base64Decode(state).Split('|');
                state = stateList[0];
                var goodsGuid = state.Split("_")[0];
                var goodsCode = state.Split("_")[1];

                WxUserEntity wxUser = new WxUserEntity();
                try
                {
                    //出错后,返回重新查看
                    wxUser = Helper.WeiChat.Utility.GetWebpageUserInfo(appConfig.WeiXin.Appid, appConfig.WeiXin.Secret, code);
                }
                catch
                {
                    await ShowHtml($"微信用户有误。<a href=\"GoodsDetail?state={goodsGuid}\">点击返回</a>");

                    return;
                }

                wxUser.ip = stateList[1];
                PsGoodsLogEntity inLog = new PsGoodsLogEntity()
                {
                    goodsGuid = goodsGuid,
                    ip        = wxUser.ip,
                    openid    = wxUser.openid
                };

                var reObj = await _respoitory.GoodsCheck(inLog, goodsCode);

                if (reObj.success)
                {
                    Response.Redirect($"GoodsDetail?state={goodsGuid}");
                }
                else
                {
                    await ShowHtml($"产品防伪码有误。<a href=\"GoodsDetail?state={goodsGuid}\">点击返回</a>");
                }
            }
        }
        public async Task GoodsDetail(string code, string state)
        {
            if (string.IsNullOrEmpty(code))
            {
                string ip = this.httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
                state = $"{state}|{ip}";
                string rebackUrl = $"http://{Request.Host.Host}{Request.Path}";
                rebackUrl = HttpUtility.UrlEncode(rebackUrl);
                var url = Helper.WeiChat.Utility.GetWebpageAuthorization(appConfig.WeiXin.Appid, rebackUrl, Fun.Base64Encode(state), true);
                Response.Redirect(url);
            }
            else
            {
                var stateList = Fun.Base64Decode(state).Split('|');
                state = stateList[0];
                WxUserEntity wxUser = new WxUserEntity();
                try
                {
                    //出错后,返回重新查看
                    wxUser = Helper.WeiChat.Utility.GetWebpageUserInfo(appConfig.WeiXin.Appid, appConfig.WeiXin.Secret, code);
                }
                catch
                {
                    Response.Redirect($"GoodsDetail?state={state}");
                    return;
                }
                wxUser.ip = stateList[1];
                var addressList = await httpClientFactory.CreateClient().GetAddressAsync(wxUser.ip);

                wxUser.address = string.Join("", addressList);
                var opNum = await weiXin.saveUser(wxUser, new List <string> {
                    "nickname", "headimgurl", "lastTime", "ip", "address", "subscribe"
                });

                PsGoodsLogEntity inLog = new PsGoodsLogEntity()
                {
                    goodsGuid = state,
                    ip        = wxUser.ip,
                    openid    = wxUser.openid
                };
                var reObj = await _respoitory.GoodsDetail(inLog);

                if (reObj.success)
                {
                    StringBuilder htmlStringBuilder = new StringBuilder();
                    htmlStringBuilder.Append($"<a>");
                    string proNumStr = $"00000000{reObj.data.proNum}";
                    proNumStr = proNumStr.Substring(proNumStr.Length - 8);
                    htmlStringBuilder.Append($"产品编号:{reObj.data.batchCode}{proNumStr}<br />");
                    htmlStringBuilder.Append($"查阅次数:{reObj.data.lookNum}次<br />");
                    if (reObj.data.confirmTime == 0)
                    {
                        #region css样式
                        string headStr = @"
    <style>
        body {
            font-size: 14px;
        }
        input{
            border: 1px solid #333333;
        }
        button {
            font-size: 14px;
            border: 1px solid #333333;
        }
        .black_overlay {
            display: none;
            position: absolute;
            top: 0%;
            left: 0%;
            width: 100%;
            height: 100%;
            background-color: black;
            -moz-opacity: 0.5;
            opacity: .50;
            filter: alpha(opacity=50);
        }

        .white_content {
            display: none;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -80%);
            width: 50%;
            height: 100px;
            padding: 20px;
            background-color: white;
            overflow: auto;
            text-align: center;
        }

        .white_content div {
            margin-bottom: 5px;
        }
    </style>
";
                        #endregion

                        #region js脚本
                        string bootStr = @"
<script type='text/javascript'>
    function openDialog() {
        document.getElementById('light').style.display = 'block';
        document.getElementById('fade').style.display = 'block'
    }
    function closeDialog() {
        document.getElementById('light').style.display = 'none';
        document.getElementById('fade').style.display = 'none'
    }
</script>
";
                        #endregion

                        htmlStringBuilder.Append($"<a onclick=\"openDialog()\" href=\"#\">点击验证</a>");
                        htmlStringBuilder.Append($"</a>");

                        #region 验证框
                        htmlStringBuilder.Append($@"
    <div id='fade' class='black_overlay'></div>
    <div id='light' class='white_content'>
        <form action='GoodsCheck' method='GET'>
            <div>
                <a>请输入产品防伪码</a>
            </div>
            <div>
                <input name='prcode' />
            </div>
            <div>
                <input name='state' type='hidden' value='{state}'/>
                <button  onclick='submit()'>确定</button>
                <button type='reset' onclick='closeDialog()' style='margin-left: 10px;'>取消</button>
            </div>
        </form>
    </div>                    
                    ");
                        #endregion

                        await ShowHtml(htmlStringBuilder.ToString(), headStr, bootStr);
                    }
                    else
                    {
                        htmlStringBuilder.Append($"验证时间:{Helper.DataTimeHelper.getDate(reObj.data.confirmTime).ToString()}\r\n<br />");
                        htmlStringBuilder.Append($"防 伪 码:{reObj.data.code}");
                        htmlStringBuilder.Append($"</a>");
                        await ShowHtml(htmlStringBuilder.ToString());
                    }
                }
                else
                {
                    await ShowHtml(reObj.msg);
                }
            }
        }
示例#15
0
 private void filter(Fun element)
 {
 }
示例#16
0
 public ActionResult GetFun(string moduleId)
 {
     Fun fun = new Fun()
     {
         funs = new Fun[] {
         new Fun() { funname = "search", iconCls = "icon-search", funid = "EEB02601-9BF6-412F-A63E-92857BF38638", isActive = true },
         new Fun() { funname = "add", iconCls = "icon-search", funid = "EEB02601-9BF6-412F-A63E-92857BF38638" , isActive = true},
         new Fun() { funname = "edit", iconCls = "icon-search", funid = "EEB02601-9BF6-412F-A63E-92857BF38638" , isActive = true},
         new Fun() { funname = "delete", iconCls = "icon-search", funid = "EEB02601-9BF6-412F-A63E-92857BF38638" , isActive = true},
          new Fun() { funname = "functionadmin", iconCls = "icon-search", funid = "EEB02601-9BF6-412F-A63E-92857BF38638" , isActive = true},
         new Fun() { funname = "permissionadmin", iconCls = "icon-search", funid = "EEB02601-9BF6-412F-A63E-92857BF38638" , isActive = true},
         new Fun() { funname = "useradmin", iconCls = "icon-search", funid = "EEB02601-9BF6-412F-A63E-92857BF38638" , isActive = true},
         new Fun() { funname = "roleadmin", iconCls = "icon-search", funid = "EEB02601-9BF6-412F-A63E-92857BF38638" , isActive = true},
         new Fun() { funname = "authorize", iconCls = "icon-search", funid = "EEB02601-9BF6-412F-A63E-92857BF38638" , isActive = true},
         new Fun() { funname = "print", iconCls = "icon-search", funid = "EEB02601-9BF6-412F-A63E-92857BF38638" , isActive = true},
         new Fun() { funname = "help", iconCls = "icon-search", funid = "EEB02601-9BF6-412F-A63E-92857BF38638", isActive = true }
         }
     };
     var funs = ModuleService.GetModuleFuns(User.Identity.Name, this.GetCookieValue("cityid"), moduleId);
     return Json(funs,"text",JsonRequestBehavior.AllowGet);
 }
示例#17
0
        private void DsetSelect(int xmly, int zyyf, int execdeptid, string ss)
        {
            string filter = "";

            filter = filter.Replace("%", "[%]");
            filter = filter.Replace("'", "''");
            filter = filter.Replace("[", "[[]");
            filter = filter + "  项目id>0 ";
            if (rdomh.Checked == true)
            {
                ss = "%" + ss;
            }
            if (rdopy.Checked == true)
            {
                filter = filter + " and (拼音码 LIKE '" + ss + "%') ";
            }
            if (rdowb.Checked == true)
            {
                filter = filter + " and (五笔码 LIKE '" + ss + "%') ";
            }
            if (rdomc.Checked == true)
            {
                filter = filter + " and (项目内容 LIKE '%" + ss + "%') ";
            }
            if (_tjdxm != "" && _tjdxm == "03") //如果是新开处方并且是中药处方的话只能开中草药
            {
                filter = filter + " and statitem_code='03' ";
            }
            else if (_tjdxm == "02") //如果是成药处方就不能开中草药
            {
                filter = filter + " and statitem_code<>'03'";
            }
            else if (new SystemCfg(3047).Config == "1" && _tjdxm == "01")//Add By Zj 2012-12-26 中药与西药不能开在一张处方上
            {
                filter = filter + " and statitem_code<>'03'";
            }
            else
            {
                filter = filter + "";
            }

            if ((execdeptid > 0 && xmly == 1) || (execdeptid > 0 && cfg_ff.Config == "0"))
            {
                filter = filter + " and zxksid = " + execdeptid + " ";
            }
            if (xmly != 0)
            {
                filter = filter + " and 项目来源 = " + xmly + " ";
            }
            if (zyyf == 1)
            {
                filter = filter + " and ( ( kslx2 = '住院药房'or kslx2 ='病室药房' ) or 项目来源=2)";
            }
            else
            {
                filter = filter + " and ( kslx2 <> '住院药房' or kslx2 <> '病室药房' )";
            }

            DataRow[] drs = Dset.Tables["ITEM"].Select(filter, " bmcd ASC");

            for (int i = 0; i < Dset.Tables["ITEM"].Columns.Count; i++)
            {
                Console.WriteLine(Dset.Tables["ITEM"].Columns[i].ColumnName);
                Console.WriteLine(Dset.Tables["ITEM"].Columns[i].Caption);
            }

            DataTable tb  = (DataTable)dataGridView1.DataSource;
            DataTable tab = tb.Clone();

            DataRow[] row_bl = null;
            for (int i = 0; i <= drs.Length - 1; i++)
            {
                if (_issfy && drs[i]["项目来源"].ToString() == "1")
                {
                    continue;
                }
                //Add By zp 2014-01-10
                if (_lgzdyfid > 0 && drs[i]["项目来源"].ToString() == "1")
                {
                    if (_lgzdyfid != Convert.ToInt32(drs[i]["zxksid"]))
                    {
                        continue;
                    }
                }
                //找医保比例
                string ssss = "";
                if (drs[i]["项目来源"].ToString() == "1")
                {
                    ssss = " xmid=" + drs[i]["ggid"] + "  and yblx=" + yblx.ToString() + " and xmly=" + drs[i]["项目来源"] + "";
                }
                else
                {
                    ssss = " xmid=" + drs[i]["项目id"] + "  and yblx=" + yblx.ToString() + " and xmly=" + drs[i]["项目来源"] + "";
                }
                row_bl = Dset.Tables["ZFBL"].Select(ssss, "");
                if (row_bl.Length > 0)
                {
                    try
                    {
                        drs[i]["医保比例"] = Convertor.IsNull(row_bl[0]["zfbl"], "") == "" ? "" : Convert.ToString(Convert.ToDouble(row_bl[0]["zfbl"]) * 100) + "%";
                    }
                    catch
                    {
                        drs[i]["医保比例"] = Convertor.IsNull(row_bl[0]["zfbl"], "") == "" ? "0" : Convert.ToString(Convert.ToDouble(row_bl[0]["zfbl"]) * 100) + "%";
                    }
                }
                else
                {
                    if (_issfy)
                    {
                        drs[i]["医保比例"] = "0";
                    }
                    else
                    {
                        drs[i]["医保比例"] = ""; //护士留观划价 模板的dt该列为decimal类型
                    }
                }
                drs[i]["序号"] = Convert.ToString(i + 1);
                tab.ImportRow(drs[i]);
                if (_issfy)
                {
                    tab.Rows[tab.Rows.Count - 1]["项目内容"] = drs[i]["项目名称"];
                }
            }
            Fun.AddRowtNo(tab); //Add by CC
            dataGridView1.DataSource = tab;
        }
示例#18
0
        private void BuildTopology(long eulerCharacteristic, bool strict)
        {
            Report.BeginTimed(12, "building topology for {0} {1}",
                              m_faceCount,
                              "face".Plural(m_faceCount));

            // use Eulers Formula to compute number of edges, but there
            // must be at least one edge per vertex, otherwise the mesh
            // cannot be topologically correct
            long edgeCount
                = Fun.Max(m_vertexCount,
                          m_vertexCount + m_faceCount - eulerCharacteristic);
            long nonManifoldEdgeCount = 0;

            BigFaceRef[] edgeFaceRefArray
                = new BigFaceRef[2 * edgeCount].Set(new BigFaceRef(long.MinValue, int.MinValue));

            // make this array large enough to hold one counter (for the
            // borderedges) per vertex, even if there are unused vertices
            long[] faceEdgeRefArray
                = new long[Fun.Max(m_faceVertexCount,
                                   m_vertexCount)].Set(0);
            long freeEdgeRef = BigEdgeRef.Create(m_vertexCount, 0);

            long[] fvia = m_faceVertexIndexArray;

            // create list of edges for each vertex stored in edgeFaceRefArray
            for (long fi = 0; fi < m_faceCount; fi++)
            {
                long ffi = m_firstIndexArray[fi];
                long fvc = m_firstIndexArray[fi + 1] - ffi;
                for (long fs0 = fvc - 1, fs1 = 0; fs1 < fvc; fs0 = fs1, fs1++)
                {
                    nonManifoldEdgeCount +=
                        AddEdge(ref edgeFaceRefArray, ref freeEdgeRef,
                                faceEdgeRefArray,
                                fvia[ffi + fs0], fvia[ffi + fs1], strict, true);
                }
            }

            long borderEdgeCount = 0;

            for (long vi = 0; vi < m_vertexCount; vi++)
            {
                borderEdgeCount += faceEdgeRefArray[vi];
            }

            if (borderEdgeCount > 0)
            {
                for (long vi = 0; vi < m_vertexCount; vi++)
                {
                    SwapBorderEdgeToFront(edgeFaceRefArray,
                                          faceEdgeRefArray, vi);
                }
            }

            // fill faceEdgeRefArray by searching edge in both vertex lists

            for (long fi = 0; fi < m_faceCount; fi++)
            {
                long ffi = m_firstIndexArray[fi];
                long fvc = m_firstIndexArray[fi + 1] - ffi;
                for (long fs0 = fvc - 1, fs1 = 0; fs1 < fvc; fs0 = fs1, fs1++)
                {
                    long v0 = fvia[ffi + fs0], v1 = fvia[ffi + fs1];
                    long edgeRef = FindEdgeInList(edgeFaceRefArray, v0, v1);
                    if (edgeRef < 0)
                    {
                        edgeRef = BigEdgeRef.Reversed(
                            FindEdgeInList(edgeFaceRefArray, v1, v0));
                    }
                    faceEdgeRefArray[ffi + fs0] = edgeRef;
                }
            }

            if (nonManifoldEdgeCount > 0)
            {
                for (long fi = 0; fi < m_faceCount; fi++)
                {
                    long ffi = m_firstIndexArray[fi];
                    long fvc = m_firstIndexArray[fi + 1] - ffi;
                    for (long fs0 = fvc - 1, fs1 = 0; fs1 < fvc; fs0 = fs1, fs1++)
                    {
                        ConnectNonManifoldEdges(edgeFaceRefArray,
                                                fvia[ffi + fs0], fvia[ffi + fs1]);
                    }
                }
                for (long edgeRef = 0; edgeRef < freeEdgeRef; edgeRef += 2)
                {
                    if (edgeFaceRefArray[edgeRef].Index < 0)
                    {
                        edgeFaceRefArray[edgeRef | 1].Index =
                            edgeFaceRefArray[edgeRef].Index;
                    }
                    else
                    {
                        edgeFaceRefArray[edgeRef | 1].Index = long.MinValue;
                    }
                    edgeFaceRefArray[edgeRef].Index = long.MinValue;
                    edgeFaceRefArray[edgeRef].Side  = int.MinValue;
                }
            }
            else
            {
                edgeFaceRefArray.Set(new BigFaceRef(long.MinValue, int.MinValue));
            }

            // go through faces, store backpointers from edges to faces

            for (long fi = 0; fi < m_faceCount; fi++)
            {
                long ffi = m_firstIndexArray[fi];
                long fvc = m_firstIndexArray[fi + 1] - ffi;
                for (int fs = 0; fs < fvc; fs++)
                {
                    long edgeRef = faceEdgeRefArray[ffi + fs];
                    edgeFaceRefArray[edgeRef].Index = fi;
                    edgeFaceRefArray[edgeRef].Side  = fs;
                }
            }

            EdgeCount            = BigEdgeRef.Index(freeEdgeRef);
            BorderEdgeCount      = borderEdgeCount;
            NonManifoldEdgeCount = nonManifoldEdgeCount;
            FaceEdgeRefArray     = faceEdgeRefArray;
            EdgeFaceRefArray     = edgeFaceRefArray;
            EulerCharacteristic  = m_vertexCount + m_faceCount - EdgeCount;

            if (nonManifoldEdgeCount > 0)
            {
                Report.End(12, ": non-manifold");
            }
            else
            {
                Report.End(12, ": euler characteristic {0}", EulerCharacteristic);
            }
        }
示例#19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        try
        {
            // str_a002 = Session["JUMP_A002"].ToString();
            key      = Session["JUMP_KEY"].ToString(); //菜单的跳转KEY
            a002_key = Session["JUMP_A002_KEY"].ToString();
        }
        catch
        {
            key      = "-1";
            a002_key = "-1";
        }
        try
        {
            IF_JUMP = Session["IF_JUMP"].ToString();
        }
        catch
        {
            IF_JUMP = "1";
        }
        key      = Request.QueryString["JUMP_KEY"] == null ? "-1" : Request.QueryString["JUMP_KEY"].ToString();
        a002_key = Request.QueryString["JUMP_A002_KEY"] == null ? "-1" : Request.QueryString["JUMP_A002_KEY"].ToString();
        IF_JUMP  = Request.QueryString["IF_JUMP"] == null ? "1" : Request.QueryString["IF_JUMP"].ToString();
        string QUERY = Request.QueryString["QUERY"] == null ? "0" : Request.QueryString["QUERY"].ToString();

        dt_main = Fun.getDtBySql("Select t.* from A002_v01 t where a002_key='" + a002_key + "'");

        showchild = GlobeAtt.GetValue("SHOWCHILD_" + a002_key);
        if (showchild == "")
        {
            Session["SHOWCHILD_" + a002_key] = "0";
            showchild = "0";
        }
        string if_showdetail = "1";

        try
        {
            if_showdetail = dt_main.Rows[0]["if_showdetail"].ToString();
        }
        catch
        {
            if_showdetail = "0";
        }
        if (if_showdetail == "1")
        {
            dt_detail = Fun.getDtBySql("Select t.* from A00201_V01 t where t.menu_id='" + dt_main.Rows[0]["MENU_ID"].ToString() + "' and line_no > 0  order by control_id");
        }
        else
        {
            dt_detail = Fun.getDtBySql("Select t.* from A00201_V01 t where t.menu_id='" + dt_main.Rows[0]["MENU_ID"].ToString() + "' and line_no > 0  and 1=2 order by control_id");
        }
        query_id = "";
        if (QUERY == "0")
        {
            DataTable dt_a006  = new DataTable();
            string    a006_sql = "Select query_id  from A006 t  where user_id='" + GlobeAtt.A007_KEY + "' AND a00201_key ='" + a002_key + "' and DEF_FLAG ='1' and rownum = 1";

            dt_a006 = Fun.getDtBySql(a006_sql);
            if (dt_a006.Rows.Count > 0)
            {
                query_id = dt_a006.Rows[0][0].ToString();
            }
            else
            {
                query_id = "";
            }
        }
        else
        {
            query_id = "最近的查询";
        }
    }
示例#20
0
        private void buttj_Click(object sender, EventArgs e)
        {
            try
            {
                if (chkbkrq.Checked == false &&
                    chkye.Checked == false && chkdj.Checked == false && chkgs.Checked == false &&
                    txtjtdz.Text.Trim() == "" && txtgzdw.Text.Trim() == ""
                    )
                {
                    MessageBox.Show("检索的范围太大,请选择条件", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                ParameterEx[] parameters = new ParameterEx[21];

                parameters[0].Text  = "@klx";
                parameters[0].Value = 0;

                parameters[1].Text  = "@kh";
                parameters[1].Value = "";

                parameters[2].Text  = "@brxm";
                parameters[2].Value = "";

                parameters[3].Text  = "@BRLXFS";
                parameters[3].Value = "";

                parameters[4].Text  = "@BRLX";
                parameters[4].Value = 0;;

                parameters[5].Text  = "@gj";
                parameters[5].Value = "";

                parameters[6].Text  = "@mz";
                parameters[6].Value = "";

                parameters[7].Text  = "@sfzh";
                parameters[7].Value = "";

                parameters[8].Text  = "@cblx";
                parameters[8].Value = 0;

                parameters[9].Text  = "@zy";
                parameters[9].Value = "";

                parameters[10].Text  = "@csdz";
                parameters[10].Value = "";

                parameters[11].Text  = "@jtdz";
                parameters[11].Value = txtjtdz.Text.Trim();

                parameters[12].Text  = "@gzdw";
                parameters[12].Value = txtgzdw.Text.Trim();

                parameters[13].Text  = "@DJSJ1";
                parameters[13].Value = chkbkrq.Checked == true?dtpjsrq1.Value.ToString() : "";

                parameters[14].Text  = "@DJSJ2";
                parameters[14].Value = chkbkrq.Checked == true?dtpjsrq2.Value.ToString() : "";

                parameters[15].Text  = "@CSRQ1";
                parameters[15].Value = "";

                parameters[16].Text  = "@CSRQ2";
                parameters[16].Value = "";

                parameters[17].Text  = "@djy";
                parameters[17].Value = 0;

                parameters[18].Text  = "@BYE";
                parameters[18].Value = chkye.Checked == true ? 1 : 0;

                parameters[19].Text  = "@BDJ";
                parameters[19].Value = chkdj.Checked == true ? 1 : 0;

                parameters[20].Text  = "@BGS";
                parameters[20].Value = chkgs.Checked == true ? 1 : 0;

                dset = new DataSet();
                InstanceForm.BDatabase.AdapterFillDataSet("SP_MZSF_CX_BRXX_JCQK", parameters, dset, "sfmx", 30);

                Fun.AddRowtNo(dset.Tables[0]);
                this.dataGridView1.DataSource = dset.Tables[0];

                lblbkzs.Text = dset.Tables[0].Rows.Count.ToString();
                lblljcr.Text = dset.Tables[0].Compute("sum(累计存入)", "").ToString();
                lblljxf.Text = dset.Tables[0].Compute("sum(累计消费)", "").ToString();
                lbljcje.Text = dset.Tables[0].Compute("sum(卡余额)", "").ToString();
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#21
0
 public int RandomizeDefence(Rarity rarity)
 => Fun.GetRandomValue(rarity.GetDefenceMin(), rarity.GetDefenceMax() + 1);
 public TreeIndex(Fun <T, Q> toKey)
 {
     this.toKey = toKey;
     dict       = new TreeDictionary <Q, HashSet <T> >();
 }
示例#23
0
        public Dere RandomizeDere()
        {
            var allDere = Enum.GetValues(typeof(Dere)).Cast <Dere>();

            return(Fun.GetOneRandomFrom(allDere));
        }
 public HashIndex(Fun <T, Q> toKey)
 {
     this.toKey = toKey;
     dict       = new HashDictionary <Q, HashSet <T> >();
 }
示例#25
0
        public async Task <List <Card> > OpenBoosterPackAsync(BoosterPack pack)
        {
            var cardsFromPack = new List <Card>();

            for (int i = 0; i < pack.CardCnt; i++)
            {
                ICharacterInfo chara = null;
                if (pack.Characters.Count > 0)
                {
                    var id = pack.Characters.First();
                    if (pack.Characters.Count > 1)
                    {
                        id = Fun.GetOneRandomFrom(pack.Characters);
                    }

                    var res = await _shClient.GetCharacterInfoAsync(id.Character);

                    if (res.IsSuccessStatusCode())
                    {
                        chara = res.Body;
                    }
                }
                else if (pack.Title != 0)
                {
                    var res = await _shClient.Title.GetCharactersAsync(pack.Title);

                    if (res.IsSuccessStatusCode())
                    {
                        if (res.Body.Count > 0)
                        {
                            var id = Fun.GetOneRandomFrom(res.Body).CharacterId;
                            if (id.HasValue)
                            {
                                var response = await _shClient.GetCharacterInfoAsync(id.Value);

                                if (response.IsSuccessStatusCode())
                                {
                                    chara = response.Body;
                                }
                            }
                        }
                    }
                }
                else
                {
                    chara = await GetRandomCharacterAsync();
                }

                if (chara != null)
                {
                    var newCard = GenerateNewCard(chara, pack.RarityExcludedFromPack.Select(x => x.Rarity).ToList());
                    if (pack.MinRarity != Rarity.E && i == pack.CardCnt - 1)
                    {
                        newCard = GenerateNewCard(chara, pack.MinRarity);
                    }

                    newCard.IsTradable = pack.IsCardFromPackTradable;
                    newCard.Source     = pack.CardSourceFromPack;

                    cardsFromPack.Add(newCard);
                }
            }

            return(cardsFromPack);
        }
示例#26
0
        private DataTable GetDataOfPrint()
        {
            try
            {
                ParameterEx[] parameters = new ParameterEx[10];
                int           ii         = 0;



                parameters[ii].Text  = "@rq1";
                parameters[ii].Value = dtpBjksj.Value.ToString();
                ++ii;

                parameters[ii].Text  = "@rq2";
                parameters[ii].Value = dtpEjksj.Value.ToString();
                ++ii;

                parameters[ii].Text  = "@userName";
                parameters[ii].Value = "";
                ++ii;

                parameters[ii].Text  = "@dept";
                parameters[ii].Value = "";
                ++ii;

                parameters[ii].Text  = "@inpatientType";
                parameters[ii].Value = comboBox1.Text;
                ++ii;

                parameters[ii].Text  = "@ChargeType";
                parameters[ii].Value = 0;
                ++ii;

                parameters[ii].Text  = "@BillNo";
                parameters[ii].Value = "";
                ++ii;

                parameters[ii].Text  = "@LackNo";
                parameters[ii].Value = Decimal.Parse(textBox3.Text == "" ? "0" : textBox3.Text);
                ++ii;

                parameters[ii].Text  = "@zyh";
                parameters[ii].Value = textBox1.Text;
                ++ii;

                parameters[ii].Text  = "@ReportType";
                parameters[ii].Value = 1;
                ++ii;

                DataSet dset = new DataSet();
                TrasenFrame.Forms.FrmMdiMain.Database.AdapterFillDataSet("dbo_zy_LackDisChargeReport", parameters, dset, "sfmx", 60);


                Fun.AddRowtNo(dset.Tables[0]);
                DataTable dt = dset.Tables[0];
                return(dt);
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
        }
示例#27
0
        private void buttj_Click(object sender, EventArgs e)
        {
            try
            {
                ParameterEx[] parameters = new ParameterEx[9];
                parameters[0].Text  = "@rq1";
                parameters[0].Value = dtp1.Value.ToString();

                parameters[1].Text  = "@rq2";
                parameters[1].Value = dtp2.Value.ToString();

                parameters[2].Text  = "@type";
                parameters[2].Value = rdJg.Checked == true ? 0 : 1;
                //add by Daniel 2014-09-22
                if (cmbQt.SelectedIndex != -1)
                {
                    parameters[2].Text  = "type";
                    parameters[2].Value = cmbQt.SelectedIndex + 2;
                }

                int _jsfs = 0;
                if (rbYb.Checked)
                {
                    _jsfs = 1;
                }
                else if (rbZf.Checked)
                {
                    _jsfs = 2;
                }
                else
                {
                    _jsfs = 0;
                }

                parameters[3].Text  = "@jsfs";
                parameters[3].Value = _jsfs;

                parameters[4].Text  = "@jgbm";
                parameters[4].Value = Convert.ToInt32(Convertor.IsNull(cmbjgbm.SelectedValue, "0"));

                parameters[5].Text  = "@bks";
                parameters[5].Value = checkBox2.Checked == true ? 1 : 0;

                parameters[6].Text  = "@dept_id";
                parameters[6].Value = Convert.ToInt32(Convertor.IsNull(cmbdept.SelectedValue, "0"));

                parameters[7].Text  = "@sfdeptid";
                parameters[7].Value = this.Cmb_SfDept.SelectedValue.ToString().Trim() == "-1" ? "" : this.Cmb_SfDept.SelectedValue.ToString().Trim();
                //150203 chencan/ 添加"显示病人明细"
                parameters[8].Text  = "@patient";
                parameters[8].Value = ckb_patient.Checked == true ? 1 : 0;

                DataSet dset = new DataSet();
                TrasenFrame.Forms.FrmMdiMain.Database.AdapterFillDataSet("SP_MZSF_TJ_SK_yssrtj", parameters, dset, "sfmx", 30);
                Fun.AddRowtNo(dset.Tables[0]);
                this.dataGridView1.DataSource = null;
                this.dataGridView1.DataSource = dset.Tables[0];
                if (this.dataGridView1.Columns["KSDM"] != null)
                {
                    this.dataGridView1.Columns["KSDM"].Visible = false;
                }
                if (dataGridView1.Columns.Contains("排序码") == true)
                {
                    dataGridView1.Columns["排序码"].Visible = false;
                }
                this.dataGridView1.Refresh();
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#28
0
        private void GetData()
        {
            try
            {
                ParameterEx[] parameters = new ParameterEx[10];
                int           ii         = 0;



                parameters[ii].Text  = "@rq1";
                parameters[ii].Value = dtpBjksj.Value.ToString();
                ++ii;

                parameters[ii].Text  = "@rq2";
                parameters[ii].Value = dtpEjksj.Value.ToString();
                ++ii;

                parameters[ii].Text  = "@userName";
                parameters[ii].Value = "";
                ++ii;

                parameters[ii].Text  = "@dept";
                parameters[ii].Value = "";
                ++ii;

                parameters[ii].Text  = "@inpatientType";
                parameters[ii].Value = comboBox1.Text;
                ++ii;

                parameters[ii].Text  = "@ChargeType";
                parameters[ii].Value = 0;
                ++ii;

                parameters[ii].Text  = "@BillNo";
                parameters[ii].Value = "";
                ++ii;

                parameters[ii].Text  = "@LackNo";
                parameters[ii].Value = Decimal.Parse(textBox3.Text == ""?"0":textBox3.Text);
                ++ii;

                parameters[ii].Text  = "@zyh";
                parameters[ii].Value = textBox1.Text;
                ++ii;

                parameters[ii].Text  = "@ReportType";
                parameters[ii].Value = 0;
                ++ii;

                DataSet dset = new DataSet();
                TrasenFrame.Forms.FrmMdiMain.Database.AdapterFillDataSet("dbo_zy_LackDisChargeReport", parameters, dset, "sfmx", 60);


                Fun.AddRowtNo(dset.Tables[0]);
                DataTable dt = dset.Tables[0];

                this.dataGridView1.Columns.Clear();
                this.dataGridView1.DataSource = dt;
                for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
                {
                    this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
                    if (this.dataGridView1.Columns[i].Name.ToLower() == "ksdm" || this.dataGridView1.Columns[i].Name.ToLower() == "sort")
                    {
                        this.dataGridView1.Columns[i].Visible = false;
                    }
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#29
0
        public void TestEvents()
        {
            Fun <CollectionOfInt> factory = delegate() { return(new CollectionOfInt(TenEqualityComparer.Default)); };

            new C5UnitTests.Templates.Events.CollectionTester <CollectionOfInt>().Test(factory);
        }
示例#30
0
        private void outputExcel()
        {
            DataTable dt = GetoutputTable();

            if (dt == null || dt.Rows.Count == 0)
            {
                Fun.Alert("请先检索要查询的信息后在导出!");
                return;
            }

            string fileName = "社员信息" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + ".xls";

            HttpResponse resp;

            resp = Page.Response;
            resp.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            resp.AppendHeader("Content-Disposition", "attachment;filename=" + fileName);
            string colHeaders = "", ls_item = "", ls_Bottom = "";

            DataRow[] myRow = dt.Select();//可以类似dt.Select("id>10")之形式达到数据筛选目的
            int       i     = 0;
            int       cl    = dt.Columns.Count;


            //取得数据表各列标题,各标题之间以\t分割,最后一个列标题后加回车符
            //for (i = 0; i < cl; i++)
            //{
            //    if (i == (cl - 1))//最后一列,加\n
            //    {
            //        colHeaders += dt.Columns[i].Caption.ToString() + "\n";
            //    }
            //    else
            //    {
            //        colHeaders += dt.Columns[i].Caption.ToString() + "\t";
            //    }

            //}
            colHeaders += "网点\t社员账号\t地址\t姓名\t身份证号\t手机号\t田亩册\t田亩数\t入社时间\n";
            resp.Write(colHeaders);
            //向HTTP输出流中写入取得的数据信息

            //逐行处理数据
            foreach (DataRow row in myRow)
            {
                //当前行数据写入HTTP输出流,并且置空ls_item以便下行数据
                for (i = 0; i < cl; i++)
                {
                    if (i == (cl - 1))//最后一列,加\n
                    {
                        ls_item += row[i].ToString() + "\n";
                    }
                    else
                    {
                        ls_item += row[i].ToString() + "\t";
                    }
                }
                resp.Write(ls_item);
                ls_item = "";
            }
            GetCount();//再次获取统计数目
            ls_Bottom += "统计\t社员数:" + IDCount + "\t\t\t\t\t田亩数:\t" + FieldCount + "\t\n";
            resp.Write(ls_Bottom);
            resp.End();
        }
示例#31
0
        private void butjk_Click(object sender, EventArgs e)
        {
            if (dataGridView1.DataSource == null)
            {
                return;
            }
            try
            {
                if (Jkid != Guid.Empty)
                {
                    MessageBox.Show("已点击交账,不能重复操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (dtpjsrq2.Value > DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase))
                {
                    MessageBox.Show("统计时间不能大于当前系统时间", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (yjjrow == 0 && fpbrow == 0)
                {
                    MessageBox.Show("没有需要交款的记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }


                #region 权限确认
                try
                {
                    string dlgvalue = DlgPW.Show();
                    string pwStr    = dlgvalue; //YS.Password;
                    bool   bOk      = InstanceForm.BCurrentUser.CheckPassword(pwStr);
                    if (!bOk)
                    {
                        FrmMessageBox.Show("你没有通过权限确认,不能交帐!", new Font("宋体", 12f), Color.Red, "Sorry!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        Cursor = Cursors.Default;
                        return;
                    }
                }
                catch (System.Exception err)
                {
                    MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                #endregion

                string    sDate   = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();
                int       _yjjrow = 0;
                int       _fpbrow = 0;
                DataTable tb      = (DataTable)dataGridView1.DataSource;
                DataRow[] rows    = tb.Select("sfy>0");

                try
                {
                    butjk.Enabled = false;
                    buttj.Enabled = false;
                    InstanceForm.BDatabase.BeginTransaction();

                    for (int i = 0; i <= rows.Length - 1; i++)
                    {
                        int    sfy   = Convert.ToInt32(Convertor.IsNull(rows[i]["sfy"], "0"));
                        string sfyxm = Fun.SeekEmpName(sfy, InstanceForm.BDatabase);
                        string ksrq  = Scjksj(sfy).ToString();
                        string jsrq  = dtpjsrq2.Value.ToString();

                        long    yxzs = 0;
                        long    zfzs = 0;
                        decimal fpje = Convert.ToDecimal(Convertor.IsNull(rows[i]["刷卡消费"], "0")) +
                                       Convert.ToDecimal(Convertor.IsNull(rows[i]["银联卡消费"], "0"));
                        decimal xjzf  = 0;
                        decimal zpzf  = 0;
                        decimal ylkzf = Convert.ToDecimal(Convertor.IsNull(rows[i]["银联卡消费"], "0"));
                        decimal ybzf  = 0;
                        decimal cwjz  = Convert.ToDecimal(Convertor.IsNull(rows[i]["刷卡消费"], "0"));
                        decimal qfgz  = 0;
                        decimal yhje  = Convert.ToDecimal(Convertor.IsNull(rows[i]["优惠金额"], "0"));;
                        decimal zfje  = 0;
                        string  fpd   = "";
                        string  zffpd = "";

                        if ((fpje - xjzf - zpzf - ylkzf - ybzf - cwjz - qfgz - yhje) != 0)
                        {
                            MessageBox.Show("消费总额,与各支付项不等,请检查数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        //缴款日期为收费结束日期,新增加操作日期
                        string ssql = "select dbo.FUN_GETGUID(newid(),getdate()) ";
                        Jkid = new Guid(InstanceForm.BDatabase.GetDataResult(ssql).ToString());

                        ssql = "insert into mz_jkb(jkid,jgbm,ksrq,jsrq,jkrq,jky,yxfpzs,fpje,zfzs,zfje,xjzf,zpzf,ylkzf,ybzf,cwjz,qfgz,yhje,sffpd,ZFFPH,czrq)values('" +
                               Jkid + "'," + _menuTag.Jgbm + ",'" + ksrq + "','" + jsrq + "','" + jsrq + "'," + sfy + "," + yxzs + "," + fpje + "," + zfzs + "," + (-1) * zfje +
                               "," + xjzf + "," + zpzf + "," + ylkzf + "," + ybzf + "," + cwjz + "," + qfgz + "," + yhje + ",'" + fpd + "','" + zffpd + "','" + sDate + "')";
                        int x = InstanceForm.BDatabase.DoCommand(ssql);
                        if (x == 0)
                        {
                            throw new Exception("插入交款记录时失败");
                        }


                        if (Jkid == Guid.Empty || Jkid == null)
                        {
                            throw new Exception("交款id为零,请和管理员联系");
                        }

                        //ssql = "update mz_fpb set jkid='" + Jkid + "' where (BGHPBZ <> 2 or ZJE > 0) and sfy=" + sfy + " and  sfrq>='" + ksrq + "' and sfrq<='" + jsrq + "' and bscbz=0 and  isnull(jkid,dbo.FUN_GETEMPTYGUID())=dbo.FUN_GETEMPTYGUID()";
                        ssql    = string.Format(@"update mz_fpb set jkid='{0}' where ZJE>0 and sfy= {1} and  sfrq>='{2}' and sfrq<='{3}' 
and bscbz=0 and  isnull(jkid,dbo.FUN_GETEMPTYGUID())=dbo.FUN_GETEMPTYGUID()", Jkid, sfy, ksrq, jsrq);
                        x       = InstanceForm.BDatabase.DoCommand(ssql);
                        _fpbrow = _fpbrow + x;


                        ssql = "update mz_skjl set jkid='" + Jkid + "' where ZJE > 0 and sfy=" + sfy + " and  sfrq>='" + ksrq + "' and sfrq<='" + jsrq + "' and bscbz=0 and  isnull(jkid,dbo.FUN_GETEMPTYGUID())=dbo.FUN_GETEMPTYGUID()";
                        x    = InstanceForm.BDatabase.DoCommand(ssql);

                        ssql    = "update yy_kdjb_je set jkid='" + Jkid + "' where CRJE > 0 and dzrq>='" + ksrq + "' and dzrq<='" + jsrq + "' and dzy=" + sfy + " and bdzbz=1 and bzfbz=0 and isnull(jkid,dbo.FUN_GETEMPTYGUID())=dbo.FUN_GETEMPTYGUID() ";
                        x       = InstanceForm.BDatabase.DoCommand(ssql);
                        _yjjrow = _yjjrow + x;

                        rows[i]["缴款日期"] = sDate;
                        rows[i]["jkid"] = Jkid;//add by wangzhi 2014-08-05
                    }

                    if (_fpbrow != fpbrow)
                    {
                        throw new Exception("统计的发票记录为" + fpbrow + "条,交款更新影响到" + _fpbrow + "行。请刷新后重试");
                    }
                    if (_yjjrow != yjjrow)
                    {
                        throw new Exception("统计的预交款记录为" + yjjrow + "条,交款更新影响到" + _yjjrow + "行。请刷新后重试");
                    }

                    InstanceForm.BDatabase.CommitTransaction();

                    MessageBox.Show("交账成功");
                }
                catch (System.Exception err)
                {
                    butjk.Enabled = true;
                    buttj.Enabled = true;
                    Jkid          = Guid.Empty;
                    InstanceForm.BDatabase.RollbackTransaction();
                    throw new Exception(err.Message);
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
示例#32
0
        private void buttj_Click(object sender, EventArgs e)
        {
            try
            {
                if (radioButton2.Checked == true)
                {
                    ParameterEx[] parameters1 = new ParameterEx[3];

                    parameters1[0].Text  = "@KSRQ";
                    parameters1[0].Value = dtp1.Value.ToString();

                    parameters1[1].Text  = "@JSRQ";
                    parameters1[1].Value = dtp2.Value.ToString();

                    parameters1[2].Text  = "@jky";
                    parameters1[2].Value = 0;

                    dset = new DataSet();
                    InstanceForm.BDatabase.AdapterFillDataSet("SP_MZSF_TJ_JK_TJ_YJJCX", parameters1, dset, "sfmx", 30);
                    Fun.AddRowtNo(dset.Tables[0]);
                    this.dataGridView1.DataSource = dset.Tables[0];

                    for (int i = 0; i <= dset.Tables[0].Columns.Count - 1; i++)
                    {
                        if (i > 1)
                        {
                            dataGridView1.Columns[i].Width = 70;
                        }
                        if (dataGridView1.Columns[i].HeaderText == "缴款日期")
                        {
                            dataGridView1.Columns[i].Width = 120;
                        }
                    }

                    //Mod by Hxy 20150110 设置金额以及数量列靠右。
                    this.DGVFormat();
                    return;
                }


                if (dtpjsrq2.Value > DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase) && radioButton1.Checked == true)
                {
                    MessageBox.Show("统计时间不能大于当前系统时间", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                ParameterEx[] parameters = new ParameterEx[3];

                parameters[0].Text  = "@sky";
                parameters[0].Value = 0;

                parameters[1].Text  = "@jsrq";
                parameters[1].Value = dtpjsrq2.Value.ToString();

                parameters[2].Text          = "@err_text";
                parameters[2].ParaDirection = ParameterDirection.Output;
                parameters[2].ParaSize      = 100;

                dset = new DataSet();
                InstanceForm.BDatabase.AdapterFillDataSet("SP_MZSF_TJ_JK_TJ_YJJ", parameters, dset, "sfmx", 30);

                string err_text = Convertor.IsNull(parameters[2].Value, "");

                if (err_text != "")
                {
                    MessageBox.Show(err_text, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    butjk.Enabled = false;
                }
                dset.Tables[0].Columns.Add("jkid"); //add by wangzhi 2014-08-05 加jkid列,与历史查询保持输出到报表的列一致,不然会导致打印时收费员列显示不正确
                Fun.AddRowtNo(dset.Tables[0]);

                this.dataGridView1.DataSource = dset.Tables[0];
                yjjrow = Convert.ToInt32(Convertor.IsNull(dset.Tables[2].Rows[0][0], "0"));
                fpbrow = Convert.ToInt32(Convertor.IsNull(dset.Tables[2].Rows[0][1], "0"));

                for (int i = 0; i <= dset.Tables[0].Columns.Count - 1; i++)
                {
                    if (i > 1)
                    {
                        dataGridView1.Columns[i].Width = 70;
                    }
                }
                //Mod by Hxy 20150110 设置金额以及数量列靠右。
                this.DGVFormat();

                butjk.Enabled = true;
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#33
0
 private void EachSession(Fun fn)
 {
     foreach (AudioSessionControl s in ActiveSessions)
     {
         fn(s);
     }
 }
示例#34
0
 public static void EnusureReturn(Fun f)
 {
     bool rds = false;
     foreach (Sema x in f.Exes)
     {
         if (x is IReturnDeterminacyState)
         { rds |= (x as IReturnDeterminacyState).RDS; }
     }
     if (false == f.IsConstructor && f.IsReturnValue)
     {
         if (false == rds)
         { throw new SemanticError("Function doesn't return value"); }
     }
     f.Exes.Add(f.RetPoint);
 }