Пример #1
0
 public WikiGenerator(Convertor sourceConvertor, string rootPath, IPageCache pageCache)
 {
     this.convertor = sourceConvertor;
     this.rootWikiPath = rootPath;
     this.pageCache = pageCache;
     this.fileReader = new FileReader(FileReaderPolicy.LimitedBlock, 500);
 }
Пример #2
0
        public TestWikiSite()
        {
            // setup initial site structure
            Directory.CreateDirectory(Path.Combine(".", "subdir1"));
            Directory.CreateDirectory(Path.Combine(".", "subdir1", "subdir2"));
            Directory.CreateDirectory(Path.Combine(".", "subdir1", "subdir2", "subdir3"));
            Directory.CreateDirectory(Path.Combine(".", "subdir1", "subdir2", "subdir3", "subdir4"));
            System.IO.File.AppendAllText(Path.Combine(".", "index.md"), "Hello World");
            System.IO.File.AppendAllText(Path.Combine(".", "subdir1", "index.md"), "Hello World Sub Directory");
            System.IO.File.AppendAllText(Path.Combine(".", "subdir1", "subdir2", "index.md"), "Hello World Sub Sub Directory");

            createdDirectories = new List<string>();
            updatedDirectories = new List<string>();
            deletedDirectories = new List<string>();
            movedDirectories = new List<string>();

            createdPages = new List<string>();
            updatedPages = new List<string>();
            deletedPages = new List<string>();
            movedPages = new List<string>();

            Convertor convertor = new Convertor(new MarkdownSharpDialogue());
            WikiConfig wikiConfig = new WikiConfig()
                {
                    SiteName = "Tester",
                    RootSourcePath = PathHelper.GetFullPath("."),
                    RootWikiPath = PathHelper.GetFullPath(".", "wiki"),
                    Convertor = new Convertor(new MarkdownSharpDialogue())
                };

            site = new WikiSite(wikiConfig,
                new MasterRepository(convertor.FileExtension),
                new SourceWatcher(wikiConfig.RootSourcePath, wikiConfig.Convertor.FileSearchString),
                new PageCache()
            );

            // setup event handlers
            site.DirectoryAdded += (source, args) => createdDirectories.Add(args.WikiUrl);
            site.DirectoryUpdated += (source, args) => updatedDirectories.Add(args.WikiUrl);
            site.DirectoryDeleted += (source, args) => deletedDirectories.Add(args.WikiUrl);
            site.DirectoryMoved += (source, args) => movedDirectories.Add(args.WikiUrl);

            site.PageAdded += (source, args) => createdPages.Add(args.WikiUrl);
            site.PageUpdated += (source, args) => updatedPages.Add(args.WikiUrl);
            site.PageDeleted += (source, args) => deletedPages.Add(args.WikiUrl);
            site.PageMoved += (source, args) => movedPages.Add(args.WikiUrl);

            site.Start();

            Thread.Sleep(1000);
        }
Пример #3
0
        private void butexcel_Click(object sender, EventArgs e)
        {
            try
            {
                #region 简单打印

                this.butprint.Enabled = false;
                Excel.Application myExcel = new Excel.Application();

                myExcel.Application.Workbooks.Add(true);

                //查询条件
                string title1 = "";
                string title2 = "备注:门诊和住院滞销情况";
                string where1 = "";

                if (rdosl.Checked == true)
                {
                    title1 = "销售数量在 " + Convertor.IsNull(txtnum1.Text, "0") + "到 " + Convertor.IsNull(txtnum2.Text, "0") + "之间 ";
                }
                else
                {
                    title1 = "销售金额在 " + Convertor.IsNull(txtnum1.Text, "0") + "到 " + Convertor.IsNull(txtnum2.Text, "0") + "之间 ";
                }

                int ntype = 2;
                if (rdo1.Checked == true)
                {
                    title2 = "备注:门诊滞销情况";
                }
                if (rdo2.Checked == true)
                {
                    title2 = "备注:住院滞销情况";
                }


                where1 = "日期:" + dtp1.Value.ToShortDateString();
                where1 = where1 + " 到:" + dtp2.Value.ToShortDateString() + "";

                where1 = where1 + "  " + title1 + "    " + title2;

                //写入行头
                DataTable tb          = (DataTable)this.myDataGrid1.DataSource;
                int       SumRowCount = tb.Rows.Count;
                int       SumColCount = tb.Columns.Count;

                for (int j = 0; j < tb.Columns.Count; j++)
                {
                    myExcel.Cells[5, 1 + j] = tb.Columns[j].ColumnName;
                }
                myExcel.get_Range(myExcel.Cells[5, 1], myExcel.Cells[5, SumColCount]).Font.Bold = true;
                myExcel.get_Range(myExcel.Cells[5, 1], myExcel.Cells[5, SumColCount]).Font.Size = 10;


                //逐行写入数据,
                for (int i = 0; i < tb.Rows.Count; i++)
                {
                    for (int j = 0; j < tb.Columns.Count; j++)
                    {
                        myExcel.Cells[6 + i, 1 + j] = "" + tb.Rows[i][j].ToString();
                    }
                }

                //设置报表表格为最适应宽度
                myExcel.get_Range(myExcel.Cells[6, 1], myExcel.Cells[5 + SumRowCount, SumColCount]).Select();
                myExcel.get_Range(myExcel.Cells[6, 1], myExcel.Cells[5 + SumRowCount, SumColCount]).Columns.AutoFit();

                //加边框
                myExcel.get_Range(myExcel.Cells[5, 1], myExcel.Cells[5 + SumRowCount, SumColCount]).Borders.LineStyle = 1;

                //报表名称
                myExcel.Cells[1, 1] = TrasenFrame.Classes.Constant.HospitalName + "滞销药品统计";
                myExcel.get_Range(myExcel.Cells[1, 1], myExcel.Cells[1, SumColCount]).Font.Bold = true;
                myExcel.get_Range(myExcel.Cells[1, 1], myExcel.Cells[1, SumColCount]).Font.Size = 16;
                //报表名称跨行居中
                myExcel.get_Range(myExcel.Cells[1, 1], myExcel.Cells[1, SumColCount]).Select();
                myExcel.get_Range(myExcel.Cells[1, 1], myExcel.Cells[1, SumColCount]).HorizontalAlignment = Excel.XlHAlign.xlHAlignCenterAcrossSelection;

                //报表条件
                myExcel.Cells[3, 1] = where1.Trim();
                myExcel.get_Range(myExcel.Cells[3, 1], myExcel.Cells[3, SumColCount]).Font.Size = 10;
                myExcel.get_Range(myExcel.Cells[3, 1], myExcel.Cells[3, SumColCount]).Select();
                myExcel.get_Range(myExcel.Cells[3, 1], myExcel.Cells[5, SumColCount]).HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft;

                //最后一行为黄色
                myExcel.get_Range(myExcel.Cells[5 + SumRowCount, 1], myExcel.Cells[5 + SumRowCount, SumColCount]).Interior.ColorIndex = 19;

                //让Excel文件可见
                myExcel.Visible       = true;
                this.butprint.Enabled = true;
                #endregion
            }
            catch (System.Exception err)
            {
                this.butprint.Enabled = true;
                MessageBox.Show(err.Message);
            }
        }
Пример #4
0
        //保存处方明细 Add by zp 2013-12-13  NewCfmxid从外部传入进来 创智医保需求
        public static void SaveCfmx(Guid cfmxid, Guid cfid, string pym, string bm, string pm, string spm, string gg, string cj, decimal dj, decimal sl, string dw, int ydwbl, int js, decimal je, string tjdxmdm, long xmid, Guid hjmxid, string gjbm, int bzby, int bpsbz, Guid pshjmxid, decimal yl, string yldw, string yfmc, int pcid, decimal ts, string zt, int fzxh, int pxxh, Guid tyid, decimal pfj, decimal pfje, int tcid, ref Guid NewCfmxid, out int err_code, out string err_text, bool IsAdd, RelationalDatabase _DataBase)
        {
            try
            {
                err_code = -1;

                Guid    yhjmxid = hjmxid;
                Guid    ytyid   = tyid;
                decimal ysl     = 0;
                int     yjs     = 0;
                decimal ytsl    = 0;
                int     ytjs    = 0;
                decimal ktsl    = 0;
                int     ktjs    = 0;
                int     qrbz    = 0;
                int     tfbz    = 0;
                string  sql     = "";

                #region 退药
                if (tyid != Guid.Empty) //退药
                {
                    NewCfmxid = Guid.Empty;
                    sql       = @"select (sl*js) ysl,js yjs,bqrbz bqrbz,qrsj,qrks,qrdjy,btfbz 
                    from mz_cfb_mx where cfmxid='" + tyid + @"' and bscbz=0  ";
                    DataTable dt_ty = _DataBase.GetDataTable(sql);
                    if (dt_ty.Rows.Count == 0)
                    {
                        err_text = "数据已转移到历史库,不能办理退费,请咨询管理员!";
                        return;
                    }
                    qrbz = Convert.ToInt32(dt_ty.Rows[0]["bqrbz"]);
                    tfbz = Convert.ToInt32(dt_ty.Rows[0]["btfbz"]);
                    ysl  = Convert.ToInt32(Convertor.IsNull(dt_ty.Rows[0]["ysl"], "0"));
                    yjs  = Convert.ToInt32(Convertor.IsNull(dt_ty.Rows[0]["js"], "0"));

                    if (tjdxmdm != "01" && tjdxmdm != "02" && tjdxmdm != "03")
                    {
                        if (qrbz == 1 && tfbz == 0 && (new SystemCfg(3013, _DataBase)).Config.Trim() == "1")
                        {
                            err_text = "该费用已被科室确认,需经科室同意才可退费!";
                            return;
                        }
                    }
                    //--已退数量 已退剂数
                    sql   = @"select coalesce(sum(sl*js),0) ytsl,coalesce(sum(js),0) ytjs  
                            from mz_cfb_mx where tyid='" + tyid + "' and bscbz=0 ";
                    dt_ty = _DataBase.GetDataTable(sql);
                    ytsl  = Convert.ToInt32(Convertor.IsNull(dt_ty.Rows[0]["ytsl"], "0"));
                    ytjs  = Convert.ToInt32(Convertor.IsNull(dt_ty.Rows[0]["ytjs"], "0"));
                    ktsl  = ysl + ytsl; //可退数量
                    ktjs  = yjs + ytjs; //可退剂数
                    if ((ktsl + sl) < 0)
                    {
                        //cast(cast(coalesce(@ysl,0) as float) as varchar(20))+@dw
                        //cast(cast(coalesce(@ytsl,0) as float) as varchar(20))+@dw
                        //cast(cast(coalesce(@ktsl,0) as float) as varchar(20))+@dw
                        //cast((@ysl*@yjs) as varchar(30))
                        //cast((@ytsl*@ytjs) as varchar(30))
                        //cast((@ktsl*@ktjs) as varchar(30))
                        err_text = "退数量输入不正确。 [" + pm + "] 原数量为" + Convert.ToDecimal(ysl).ToString() + dw + @",
                         已退" + Convert.ToDecimal(ytsl).ToString() + dw + @",可退" + Convert.ToDecimal(ktsl).ToString() + dw + @" 
                         原总量" + (ysl * yjs).ToString() + @" 已退总量" + (ytsl * ytjs).ToString() + @" 
                         可退总量" + (ktsl * ktjs).ToString() + "";
                        return;
                    }
                    if (ktjs + (-1) * js < 0 && tjdxmdm == "03")
                    {
                        //cast(cast(coalesce(@yjs,0) as float) as varchar(20))
                        //cast(cast(coalesce(@ytjs,0) as float) as varchar(20))
                        //cast(cast(coalesce(@ktjs,0) as float) as varchar(20))
                        err_text = "'退剂数输入不正确。[" + pm + "]   原剂数为 " + Convert.ToDecimal(yjs).ToString() + "'剂,  已退 " + Convert.ToDecimal(ytjs).ToString() + @"剂, 
                        可退 " + Convert.ToDecimal(ktjs).ToString() + "剂";
                        return;
                    }
                    if ((ktjs + (-1) * js) < 0 && tjdxmdm != "03")
                    {
                        if (tcid > 0)
                        {
                            //cast(cast(coalesce(@yjs,0) as float) as varchar(20))
                            //cast(cast(coalesce(@ytjs,0) as float) as varchar(20))
                            //cast(cast(coalesce(@ktjs,0) as float) as varchar(20))+'
                            err_text = "退套餐次数输入不正确。原套餐数为" + Convert.ToDecimal(yjs) + @"次,
                             已退" + Convert.ToDecimal(ytjs) + "次, 可退" + Convert.ToDecimal(ktjs).ToString() + "次";
                            return;
                        }
                    }
                }
                #endregion
                if (IsAdd) //NewCfmxid从外部传入进来
                {
                    int    bqrbz = 0;
                    object qrsj  = DBNull.Value;
                    int    qrks  = 0;
                    int    qrdjy = 0;
                    if (tjdxmdm != "01" && tjdxmdm != "02" && tjdxmdm != "03" && ytyid == Guid.Empty && yhjmxid != Guid.Empty)
                    {
                        sql = @"select bsdbz,sdsj,sdks,sddjy from mz_hjb_mx where hjmxid='" + hjmxid + "'";
                        DataTable dt = _DataBase.GetDataTable(sql);
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            //if (NewCfmxid == Guid.Empty) NewCfmxid = new Guid();
                            bqrbz = Convert.ToInt32(Convertor.IsNull(dt.Rows[0]["bsdbz"], "0"));
                            if (dt.Rows[0]["sdsj"] != null)
                            {
                                qrsj = dt.Rows[0]["sdsj"].ToString();
                            }
                            qrks  = int.Parse(Convertor.IsNull(dt.Rows[0]["sdks"], "0"));
                            qrdjy = int.Parse(Convertor.IsNull(dt.Rows[0]["sddjy"], "0"));
                        }
                    }
                    sql = @" insert into mz_cfb_mx(cfmxid,cfid,pym,bm,pm,spm,gg,cj,dj,sl,dw,ydwbl,js,je,tjdxmdm,xmid,hjmxid,  
                               gjbm,bzby,bpsbz,pshjmxid,YL,YLDW,YFMC,PCID,TS,zt,fzxh,pxxh,tyid,pfj,pfje,TCID,bqrbz,qrsj,qrks,qrdjy)  
                             values('" + NewCfmxid + "','" + cfid + "','" + pym + "','" + bm + "','" + pm + "','" + spm + "','" + gg + "','" + cj + "','" + dj + "','" + sl + "','" + dw + @"',
                             " + ydwbl + "," + js + ",round(" + je + ",2),'" + tjdxmdm + "'," + xmid + ",'" + hjmxid + "','" + gjbm + "','" + bzby + "','" + bpsbz + "','" + pshjmxid + @"',
                             " + yl + ",'" + yldw + "','" + yfmc + "','" + pcid + "'," + ts + ",'" + zt + "','" + fzxh + "'," + pxxh + ",'" + tyid + @"',
                             " + pfj + "," + pfje + "," + tcid + "," + bqrbz + ",'" + qrsj + "'," + qrks + "," + qrdjy + ")  ";
                    _DataBase.DoCommand(sql);
                }
                else
                {
                    sql = @"update mz_cfb_mx set cfid='" + cfid + "',pym='" + pym + "',bm='" + bm + "',pm='" + pm + "',spm='" + spm + @"',
                    gg='" + gg + "',cj='" + cj + "',dj=" + dj + ",sl=" + sl + ",dw='" + dw + "',ydwbl='" + ydwbl + "',js=" + js + ",je=" + je + ",tjdxmdm='" + tjdxmdm + @"',
                    xmid=" + xmid + ",hjmxid='" + hjmxid + "',gjbm='" + gjbm + "',bzby=" + bzby + ",bpsbz=" + bpsbz + @",
                    pshjmxid='" + pshjmxid + "',YL=" + yl + ",YLDW='" + yldw + "',YFMC='" + yfmc + "',PCID=" + pcid + @",  
                    TS=" + ts + ",zt='" + zt + "',fzxh=" + fzxh + ",pxxh=" + pxxh + ",tyid='" + tyid + "',pfj=" + pfj + ",pfje=" + pfje + @",
                    TCID=" + tcid + " where cfmxid='" + cfmxid + "'";
                    _DataBase.DoCommand(sql);
                }
            }
            catch (Exception ea)
            {
                throw ea;
            }
            err_code = 0;
            err_text = "保存处方明细表成功";
        }
Пример #5
0
        private void cmbyplx_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbyplx.SelectedValue == null)
            {
                return;
            }
            if (cmbjx.SelectedValue == null)
            {
                return;
            }
            if (cmbyplx.SelectedValue.ToString() == "System.Data.DataRowView")
            {
                return;
            }
            if (cmbjx.SelectedValue.ToString() == "System.Data.DataRowView")
            {
                return;
            }
            Control control = (Control)sender;

            if (control.Name == "cmbyjks")
            {
                Yp.AddCmbYplx(true, Convert.ToInt32(Convertor.IsNull(cmbyjks.SelectedValue, "0")), cmbyplx, InstanceForm.BDatabase);
            }
            this.AddData(Convert.ToInt32(Convertor.IsNull(cmbyplx.SelectedValue, "0")), Convert.ToInt32(Convertor.IsNull(cmbjx.SelectedValue, "0")), txtdm.Text.Trim(), checkBox1.Checked, checkBox2.Checked, txthw.Text.Trim());
        }
Пример #6
0
 private void txtdm_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     try
     {
         this.AddData(Convert.ToInt32(Convertor.IsNull(cmbyplx.SelectedValue, "0")), Convert.ToInt32(Convertor.IsNull(cmbjx.SelectedValue, "0")), txtdm.Text.Trim(), checkBox1.Checked, checkBox2.Checked, txthw.Text.Trim());
     }
     catch (System.Exception err)
     {
         MessageBox.Show("发生错误" + err.Message);
     }
 }
Пример #7
0
        public double AccountProfit(MqlHandler handler)
        {
            string returnValue = handler.CallMqlMethod("AccountProfit", null);

            return(Convertor.ToDouble(returnValue));
        }
Пример #8
0
        public double AccountFreeMarginMode(MqlHandler handler)
        {
            string returnValue = handler.CallMqlMethod("AccountFreeMarginMode", null);

            return(Convertor.ToDouble(returnValue));
        }
Пример #9
0
        public int AccountStopoutMode(MqlHandler handler)
        {
            string returnValue = handler.CallMqlMethod("AccountStopoutMode", null);

            return(Convertor.ToInt(returnValue));
        }
Пример #10
0
        /// <summary>
        /// If indicator with name was found, the function returns the window index containing this specified indicator, otherwise it returns -1.
        /// </summary>
        /// <param name="handler"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static int WindowFind(this MqlHandler handler, string name)
        {
            string retrunValue = handler.CallMqlMethod("WindowFind", name);

            return(Convertor.ToInt(retrunValue));
        }
Пример #11
0
        /// <summary>
        /// Function returns the amount of bars visible on the chart.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static int WindowBarsPerChart(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("WindowBarsPerChart");

            return(Convertor.ToInt(retrunValue));
        }
Пример #12
0
        /// <summary>
        /// Refreshing of data in pre-defined variables and series arrays.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static bool RefreshRates(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("RefreshRates");

            return(Convertor.ToBoolean(retrunValue));
        }
Пример #13
0
        /// <summary>
        /// Returns the amount of minutes determining the used period (chart timeframe).
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static int Period(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("Period");

            return(Convertor.ToInt(retrunValue));
        }
Пример #14
0
        /// <summary>
        /// Returns the value at Y axis in pixels for the chart window client area point at which the expert or script was dropped.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static int WindowYOnDropped(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("WindowYOnDropped");

            return(Convertor.ToInt(retrunValue));
        }
Пример #15
0
        /// <summary>
        /// Returns the time part of the chart point where expert or script was dropped.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static DateTime WindowTimeOnDropped(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("WindowTimeOnDropped");

            return(Convertor.ToDateTime(retrunValue));
        }
Пример #16
0
        /// <summary>
        /// Saves current chart screen shot as a GIF file. Returns FALSE if it fails.
        /// </summary>
        /// <param name="handler"></param>
        /// <param name="filename"></param>
        /// <param name="size_x"></param>
        /// <param name="size_y"></param>
        /// <param name="start_bar"></param>
        /// <param name="chart_scale"></param>
        /// <param name="chart_mode"></param>
        /// <returns></returns>
        public static bool WindowScreenShot(this MqlHandler handler, string filename, int size_x, int size_y, int start_bar = -1, int chart_scale = -1, int chart_mode = -1)
        {
            string retrunValue = handler.CallMqlMethod("WindowScreenShot", filename, size_x, size_y, start_bar, chart_scale, chart_mode);

            return(Convertor.ToBoolean(retrunValue));
        }
Пример #17
0
        /// <summary>
        /// The function returns the first visible bar number in the current chart window.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static int WindowFirstVisibleBar(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("WindowFirstVisibleBar");

            return(Convertor.ToInt(retrunValue));
        }
Пример #18
0
        public double AccountFreeMarginCheck(MqlHandler handler, string symbol, ORDER_TYPE cmd, double volume)
        {
            string returnValue = handler.CallMqlMethod("AccountFreeMarginCheck", symbol, (int)cmd, volume);

            return(Convertor.ToDouble(returnValue));
        }
Пример #19
0
        /// <summary>
        /// The GetTickCount() function retrieves the number of milliseconds that have elapsed since the system was started. It is limited to the resolution of the system timer.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static int GetTickCount(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("GetTickCount", null);

            return(Convertor.ToInt(retrunValue));
        }
Пример #20
0
        public int AccountNumber(MqlHandler handler)
        {
            string returnValue = handler.CallMqlMethod("AccountNumber", null);

            return(Convertor.ToInt(returnValue));
        }
Пример #21
0
        /// <summary>
        /// Returns various data about securities listed in the Market Watch window.
        /// </summary>
        /// <param name="handler"></param>
        /// <param name="symbol"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        public static double MarketInfo(this MqlHandler handler, string symbol, MARKER_INFO_MODE mode)
        {
            string retrunValue = handler.CallMqlMethod("MarketInfo", symbol, (int)mode);

            return(Convertor.ToDouble(retrunValue));
        }
Пример #22
0
        private void AddData(int yplx, int ypjx, string dm, bool bszkw, bool bkc, string hwmc)
        {
            if (cmbyjks.SelectedValue.ToString() == "System.Data.DataRowView")
            {
                return;
            }
            DataTable myTb   = new DataTable();
            string    ssql   = "";
            int       deptid = Convert.ToInt32(Convertor.IsNull(cmbyjks.SelectedValue, "0"));


            ssql = @"SELECT '' 序号,dbo.fun_yp_ypjx(ypjx) 剂型,YPPM 品名,ypspm 商品名,ypgg 规格,kcl 库存量,dbo.fun_yp_ypdw(a.ypdw) 单位," +
                   "  hwmc 货位编号,A.GGID FROM YP_YPGGD A  ";

            if (bkc == true)
            {
                ssql = ssql + "  inner join  ";
            }
            else
            {
                ssql = ssql + " left join ";
            }
            ssql = ssql + "   (SELECT GGID,cast(sum(KCL/DWBL) as float)  KCL FROM " + Yp.Seek_kcmx_table(deptid, InstanceForm.BDatabase) + " where  deptid=" + deptid + " GROUP BY GGID) b " +
                   "  ON A.GGID=B.GGID  ";


            if (bszkw == true || txthw.Text.Trim() != "")
            {
                ssql = ssql + "  inner join  ";
            }
            else
            {
                ssql = ssql + " left join ";
            }

            ssql = ssql + "   YP_HWSZ C ON    A.GGID=C.GGID and C.deptid=" + deptid + "";

            ssql = ssql + " WHERE A.BDELETE=0 ";

            ssql = ssql + " and ypzlx in(select ypzlx from yp_gllx where deptid=" + deptid + ") ";

            if (yplx > 0)
            {
                ssql = ssql + " and yplx=" + yplx + "";
            }
            if (ypjx > 0)
            {
                ssql = ssql + " and ypjx=" + ypjx + "";
            }

            if (dm != "")
            {
                ssql = ssql + " and a.ggid in(select ggid from yp_ypbm where ypbm like '%" + txtdm.Text.Trim() + "%' or pym like '%" + txtdm.Text.Trim() + "%' or wbm like '%" + txtdm.Text.Trim() + "%' ) ";
            }
            if (hwmc.Trim() != "")
            {
                ssql = ssql + " and hwmc like '%" + hwmc + "%'";
            }


            ssql = ssql + " order by hwmc,yplx,ypjx";
            myTb = InstanceForm.BDatabase.GetDataTable(ssql);
            FunBase.AddRowtNo(myTb);
            myTb.TableName = "Tb";
            this.myDataGrid1.DataSource = myTb;
            this.myDataGrid1.TableStyles[0].MappingName = "Tb";
            myTb.AcceptChanges();
        }
Пример #23
0
        /// <summary>
        /// Sends Push notification to mobile terminals whose MetaQuotes IDs are specified on the "Notifications" tab in options window.
        /// </summary>
        /// <param name="handler"></param>
        /// <param name="notification"></param>
        /// <returns></returns>
        public static bool SendNotification(this MqlHandler handler, string notification)
        {
            string retrunValue = handler.CallMqlMethod("SendNotification", notification);

            return(Convertor.ToBoolean(retrunValue));
        }
Пример #24
0
        private void butsave_Click(object sender, System.EventArgs e)
        {
            try
            {
                this.butsave.Enabled = false;
                InstanceForm.BDatabase.BeginTransaction();

                string    ssql   = "";
                string    hwmc   = "";
                int       ggid   = 0;
                int       deptid = Convert.ToInt32(Convertor.IsNull(cmbyjks.SelectedValue, "0"));
                string    _sDate = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();
                DataTable tb     = (DataTable)this.myDataGrid1.DataSource;
                for (int i = 0; i <= tb.Rows.Count - 1; i++)
                {
                    if (tb.Rows[i].RowState == DataRowState.Unchanged)
                    {
                        continue;
                    }

                    hwmc = tb.Rows[i]["货位编号"].ToString();
                    ggid = Convert.ToInt32(Convertor.IsNull(tb.Rows[i]["ggid"], "0"));

                    if (hwmc.Trim() != "")
                    {
                        ssql = "select * from yp_hwsz where deptid=" + deptid + " and ggid=" + ggid + " and bscbz=0";
                        DataTable tab = InstanceForm.BDatabase.GetDataTable(ssql);
                        if (tab.Rows.Count == 0)
                        {
                            ssql = "insert into YP_HWSZ(GGID,HWMC,DEPTID,DJSJ,DJY) values(" + ggid + ",'" + hwmc + "'," + deptid + ",'" + _sDate + "'," + InstanceForm.BCurrentUser.EmployeeId + ") ";
                        }
                        else
                        {
                            ssql = "update YP_HWSZ set HWMC='" + hwmc + "' where ggid=" + ggid + " and deptid=" + deptid + " ";
                        }
                    }
                    else
                    {
                        ssql = "delete yp_hwsz where deptid=" + deptid + " and ggid=" + ggid + " and bscbz=0 ";
                    }

                    InstanceForm.BDatabase.DoCommand(ssql);
                }

                InstanceForm.BDatabase.CommitTransaction();
                MessageBox.Show("保存成功");
                this.butsave.Enabled = true;
                this.AddData(Convert.ToInt32(Convertor.IsNull(cmbyplx.SelectedValue, "0")), Convert.ToInt32(Convertor.IsNull(cmbjx.SelectedValue, "0")), txtdm.Text.Trim(), checkBox1.Checked, checkBox2.Checked, txthw.Text.Trim());
            }
            catch (System.Exception err)
            {
                this.butsave.Enabled = true;
                InstanceForm.BDatabase.RollbackTransaction();
                MessageBox.Show("发生错误" + err.Message);
            }
        }
Пример #25
0
        private void AddTreeViewNode(TreeNode treeNode)
        {
            DataTable tb   = new DataTable();
            string    ssql = "";

            ssql = "select 0 序号,kwbh 编号,kwmc  名称,pym 拼音码,wbm 五笔码,kwms 描述,dbo.fun_yp_kwmc(fid,deptid) 所属上级编目,cast(bdelete as smallint) 禁用,fid,id,yjdbz,pxid 排序 from yp_hwh where fid=" + Convert.ToInt64(Convertor.IsNull(treeNode.Tag, "-10")) + " and deptid=" + InstanceForm.BCurrentDept.DeptId + " order by fid ";
            tb   = InstanceForm.BDatabase.GetDataTable(ssql);

            treeNode.Nodes.Clear();
            for (int i = 0; i <= tb.Rows.Count - 1; i++)
            {
                TreeNode Cnode = treeNode.Nodes.Add(tb.Rows[i]["名称"].ToString());
                Cnode.Tag = tb.Rows[i]["id"];
                if (tb.Rows[i]["yjdbz"].ToString() == "1")
                {
                    Cnode.ImageIndex = 1;
                }
                else
                {
                    Cnode.ImageIndex = 0;
                }
                AddTreeViewNode(Cnode);
            }
        }
Пример #26
0
        private void SelectTree1Node(string ssql, System.Windows.Forms.TreeViewEventArgs e)
        {
            DataTable tb = new DataTable();
            string    ss = "";

            if (ssql.Trim() == "")
            {
                ss = "select 0 序号,kwbh 编号,kwmc  名称,pym 拼音码,wbm 五笔码,kwms 描述,dbo.fun_yp_kwmc(fid,deptid) 所属上级编目,cast(bdelete as smallint) 禁用,fid,id,yjdbz,pxid 排序 from yp_hwh where fid=" + Convert.ToInt64(Convertor.IsNull(e.Node.Tag, "-10")) + " and deptid=" + InstanceForm.BCurrentDept.DeptId + " order by fid ";
            }
            else
            {
                ss = "select 0 序号,kwbh 编号,kwmc  名称,pym 拼音码,wbm 五笔码,kwms 描述,dbo.fun_yp_kwmc(fid,deptid) 所属上级编目,cast(bdelete as smallint) 禁用,fid,id,yjdbz,pxid 排序 from yp_hwh where deptid=" + InstanceForm.BCurrentDept.DeptId + " and (wbm like '" + ssql.Trim() + "%' or pym like '" + ssql.Trim() + "%') order by fid ";
            }
            tb = InstanceForm.BDatabase.GetDataTable(ss);

            DataRow row = tb.NewRow();

            row["序号"] = tb.Rows.Count + 1;
            row["禁用"] = (short)0;
            tb.Rows.Add(row);

            tb.TableName = "Tb";
            this.myDataGrid1.DataSource = tb;
            this.myDataGrid1.TableStyles[0].MappingName = "Tb";
            this.myDataGrid1.CurrentCell = new DataGridCell(0, 0);
        }
Пример #27
0
 public static int GetTickCount(this MqlHandler handler)
 {
     return(Convertor.ToInt(handler.CallMqlMethod("GetTickCount", (object[])null)));
 }
Пример #28
0
        //退挂号票
        public static void Tghp(Guid ghxxid, string fph, string sfck, string sdate, Guid NewFpid, out int err_code, out string err_text, RelationalDatabase _DataBase)
        {
            string    ssql = "select * from mz_cfb a   where ghxxid='" + ghxxid + "' and a.fph='" + fph + "' and bghpbz=1  ";
            DataTable tbcf = _DataBase.GetDataTable(ssql);

            if (tbcf.Rows.Count > 1)
            {
                err_code = -1;
                err_text = "找到多行处方信息,请和管理员联系";
                return;
            }
            if (tbcf.Rows.Count == 0)
            {
                err_code = -1;
                err_text = "没有找到处方信息,数据可能已转移";
                return;
            }

            Guid Newcfid = Guid.Empty;

            mz_cf.SaveCf(Guid.Empty, new Guid(tbcf.Rows[0]["brxxid"].ToString()), new Guid(tbcf.Rows[0]["ghxxid"].ToString()), Convertor.IsNull(tbcf.Rows[0]["blh"], ""), sfck,
                         Convert.ToDecimal(tbcf.Rows[0]["zje"]) * (-1), sdate, TrasenFrame.Forms.FrmMdiMain.CurrentUser.EmployeeId,
                         TrasenFrame.Forms.FrmMdiMain.CurrentUser.Name, Convertor.IsNull(tbcf.Rows[0]["hjck"], ""), Guid.Empty, Convert.ToInt32(tbcf.Rows[0]["ksdm"]),
                         Convertor.IsNull(tbcf.Rows[0]["ksmc"], ""), Convert.ToInt32(tbcf.Rows[0]["ysdm"]), Convertor.IsNull(tbcf.Rows[0]["ysxm"], ""),
                         Convert.ToInt32(tbcf.Rows[0]["zyksdm"]), Convert.ToInt32(tbcf.Rows[0]["zxks"]), Convertor.IsNull(tbcf.Rows[0]["zxksmc"], ""),
                         Convert.ToInt16(tbcf.Rows[0]["bghpbz"]), 0, Convert.ToInt32(tbcf.Rows[0]["xmly"]), 0,
                         Convert.ToInt32(tbcf.Rows[0]["cfjs"]), TrasenFrame.Forms.FrmMdiMain.Jgbm, out Newcfid, out err_code, out err_text, _DataBase);
            if (Newcfid == Guid.Empty || err_code != 0)
            {
                throw new Exception(err_text);
            }

            Guid NewCfmxid = Guid.Empty;

            ssql = "select * from mz_cfb_mx(nolock) where cfid='" + new Guid(tbcf.Rows[0]["cfid"].ToString()) + "' and bscbz=0 ";
            DataTable tbmx = _DataBase.GetDataTable(ssql);

            if (tbmx.Rows.Count == 0)
            {
                throw new Exception("没有找到该处方的明细");
            }
            for (int i = 0; i <= tbmx.Rows.Count - 1; i++)
            {
                mz_cf.SaveCfmx(Guid.Empty, Newcfid, Convertor.IsNull(tbmx.Rows[i]["pym"], ""), Convertor.IsNull(tbmx.Rows[i]["bm"], ""),
                               Convertor.IsNull(tbmx.Rows[i]["pm"], ""), Convertor.IsNull(tbmx.Rows[i]["spm"], ""), Convertor.IsNull(tbmx.Rows[i]["gg"], ""),
                               Convertor.IsNull(tbmx.Rows[i]["cj"], ""), Convert.ToDecimal(tbmx.Rows[i]["dj"]), Convert.ToDecimal(tbmx.Rows[i]["sl"]) * (-1),
                               Convertor.IsNull(tbmx.Rows[i]["dw"], ""), Convert.ToInt32(tbmx.Rows[i]["ydwbl"]), Convert.ToInt32(tbmx.Rows[i]["js"]), Convert.ToDecimal(tbmx.Rows[i]["je"]) * (-1),
                               Convertor.IsNull(tbmx.Rows[i]["tjdxmdm"], ""), Convert.ToInt64(tbmx.Rows[i]["xmid"]), new Guid(Convertor.IsNull(tbmx.Rows[i]["hjmxid"], Guid.Empty.ToString())),
                               Convertor.IsNull(tbmx.Rows[i]["gjbm"], ""), Convert.ToInt32(tbmx.Rows[i]["bzby"]), Convert.ToInt16(tbmx.Rows[i]["bpsbz"]), new Guid(Convertor.IsNull(tbmx.Rows[i]["pshjmxid"], Guid.Empty.ToString())),
                               Convert.ToDecimal(tbmx.Rows[i]["yl"]) * (-1), Convertor.IsNull(tbmx.Rows[i]["yldw"], ""), "", 0, 1, "", 0, 0, new Guid(tbmx.Rows[i]["cfmxid"].ToString()),
                               Convert.ToDecimal(tbmx.Rows[i]["pfj"]), Convert.ToDecimal(tbmx.Rows[i]["pfje"]) * (-1), 0, out NewCfmxid, out err_code, out err_text, _DataBase);
                if (NewCfmxid == Guid.Empty || err_code != 0)
                {
                    throw new Exception(err_text);
                }
            }

            //更新收费状态
            int Nrows = 0;

            mz_cf.UpdateCfsfzt("('" + Newcfid.ToString() + "')", Convert.ToInt32(TrasenFrame.Forms.FrmMdiMain.CurrentUser.EmployeeId.ToString()), TrasenFrame.Forms.FrmMdiMain.CurrentUser.Name, sdate, sfck, 0, fph, NewFpid, out Nrows, out err_code, out err_text, _DataBase);
            if (Nrows != 1)
            {
                throw new Exception("在更新退费处方的收费状态时,没有更新到处方头表,请和管理员联系");
            }
        }
Пример #29
0
 public static double MarketInfo(this MqlHandler handler, string symbol, MARKER_INFO_MODE mode)
 {
     return(Convertor.ToDouble(handler.CallMqlMethod("MarketInfo", (object)symbol, (object)mode)));
 }
Пример #30
0
        public string ToJson()
        {
            var res = Convertor.FromObjectToJson(this);

            return(res);
        }
Пример #31
0
        public override void onTick(Tick <int> currTickTemp)
        {
            DateTime latestDateTime = currTickTemp.DateTime;


            lock (ssList)
            {
                do
                {
                    InitComment();

                    foreach (StrategyState currSS in ssList)
                    {
                        try
                        {
                            Tick <int> currSymbolTick;

                            currSymbolTick          = new Tick <int>();
                            currSymbolTick.Ask      = Meta.MarketInfo(currSS.cparam.Symbol, MarketInfoType.MODE_ASK);
                            currSymbolTick.Bid      = Meta.MarketInfo(currSS.cparam.Symbol, MarketInfoType.MODE_BID);
                            currSymbolTick.DateTime = Convertor.SecondsToDateTime(Meta.MarketInfo(currSS.cparam.Symbol, MarketInfoType.MODE_TIME));
                            currSymbolTick.volume   = 1;
                            if (latestDateTime < currSymbolTick.DateTime)
                            {
                                latestDateTime = currSymbolTick.DateTime;
                            }

                            //currSS.UpdateDaylight(currSymbolTick.DateTime);

                            if (!TestingMode && Math.Abs((currSymbolTick.DateTime - latestDateTime).TotalMinutes) > 3)
                            {
                                AddComment(currSS.cparam.Symbol + ": time lag is too much.");
                                continue;
                            }

                            int average = (currSymbolTick.Ask + currSymbolTick.Bid) / 2;

                            if (!UpdateHappyPrice(currSymbolTick, currSS))
                            {
                                continue;
                            }

                            int diffPips = average - currSS.happyPrice;
                            AddComment(string.Format("Diff in Pips = {0}   ", diffPips));

                            currSS.spreadAnalyzer.EvaluateSpread(currSymbolTick);
                            AddComment(string.Format("Spread = {0}   ", currSS.spreadAnalyzer.AverageSpread));
                            if (currSS.spreadAnalyzer.AverageSpread * 1.7f > currSS.cparam.OpenOrderShift)
                            {
                                AddComment("Spread Filter WARNING!\n");
                                continue;
                            }

                            bool isTimeOn     = currSS.tradeTime.IsSystemON(currSymbolTick);
                            bool closeTimeAll = currSS.closeAllTime.IsSystemON(currSymbolTick);
                            AddComment(string.Format("Open season = {0}\n", isTimeOn));


                            IEnumerable <Order> ordersBuy  = OrderOperation.GetBuyMarketOrders().Where(p => p.Symbol == currSS.cparam.Symbol && p.Comment.StartsWith(currSS.cparam.IdentityComment));
                            IEnumerable <Order> ordersSell = OrderOperation.GetSellMarketOrders().Where(p => p.Symbol == currSS.cparam.Symbol && p.Comment.StartsWith(currSS.cparam.IdentityComment));
                            if (ordersBuy.Any() || ordersSell.Any())
                            {
                                if (!closeTimeAll)
                                {
                                    foreach (Order currOrder in ordersBuy.Union(ordersSell).ToArray())
                                    {
                                        OrderOperation.CloseOrder(currOrder);
                                    }
                                }

                                AddComment("Order has been opened\n");
                                if (this.TestingMode)
                                {
                                    if (ordersBuy.Any() && average >= currSS.happyPrice)
                                    {
                                        foreach (Order currOrder in ordersBuy.ToArray())
                                        {
                                            OrderOperation.CloseOrder(currOrder);
                                        }
                                    }
                                    if (ordersSell.Any() && average <= currSS.happyPrice)
                                    {
                                        foreach (Order currOrder in ordersSell.ToArray())
                                        {
                                            OrderOperation.CloseOrder(currOrder);
                                        }
                                    }
                                }
                                else
                                {
                                    if (ordersBuy.Any() && GetLatestHigh(currSS.cparam.Symbol) >= currSS.happyPrice)
                                    {
                                        foreach (Order currOrder in ordersBuy.ToArray())
                                        {
                                            OrderOperation.CloseOrder(currOrder);
                                        }
                                    }
                                    if (ordersSell.Any() && GetLatestLow(currSS.cparam.Symbol) <= currSS.happyPrice)
                                    {
                                        foreach (Order currOrder in ordersSell.ToArray())
                                        {
                                            OrderOperation.CloseOrder(currOrder);
                                        }
                                    }
                                }

                                continue;
                            }

                            if (!isTimeOn)
                            {
                                continue;
                            }

                            if (diffPips > currSS.cparam.OpenOrderShift)
                            {
                                int orderId = Meta.OrderSend(currSS.cparam.Symbol, OrderType.Market, OrderSide.Sell, GetVolume(currSS), currSymbolTick.Bid, 0, 0, currSS.cparam.NewUniqueComment());
                                if (orderId > 0)
                                {
                                    Meta.OrderModify(orderId, currSymbolTick.Bid, 0, currSS.happyPrice, OrderType.Market);
                                }
                            }
                            if (-diffPips > currSS.cparam.OpenOrderShift)
                            {
                                int orderId = Meta.OrderSend(currSS.cparam.Symbol, OrderType.Market, OrderSide.Buy, GetVolume(currSS), currSymbolTick.Ask, 0, 0, currSS.cparam.NewUniqueComment());
                                if (orderId > 0)
                                {
                                    Meta.OrderModify(orderId, currSymbolTick.Bid, 0, currSS.happyPrice, OrderType.Market);
                                }
                            }
                        }
                        catch (HistoryNotAvailableExceptions exc)
                        {
                            logger.AddMessage("tick = {0}\r\n {1}\n", currTickTemp.DateTime.ToLongTimeString(), exc);
                            throw;
                        }
                        catch (Exception exc)
                        {
                            AddComment(exc.ToString());
                        }
                    }

                    ShowComment();
                }while (!TestingMode);
            }
        }
 public static void CreateConvertor()
 {
     var convertor = new Convertor();
     convertor.ConvertBoolToString(true);
 }
Пример #33
0
        /// <summary>
        /// Returns the price part of the chart point where expert or script was dropped.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static double WindowPriceOnDropped(this MqlHandler handler)
        {
            string retrunValue = handler.CallMqlMethod("WindowPriceOnDropped");

            return(Convertor.ToDouble(retrunValue));
        }