Example #1
0
        public void Test(Func <decimal> func, OperType type, Func <decimal> func_deposit = null)
        {
            Console.WriteLine(type.ToString());
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            List <Task <decimal> > tasks = new List <Task <decimal> >();

            for (int i = 0; i < taskNum; i++)
            {
                tasks.Add(Task.Run <decimal>(func));
            }
            if (func_deposit != null)
            {
                for (int i = 0; i < taskNum; i++)
                {
                    tasks.Add(Task.Run <decimal>(func_deposit));
                }
            }
            var result = Task.WhenAll(tasks);

            OutputResult(result.Result);

            stopwatch.Stop();
            Console.WriteLine("cost time: " + stopwatch.Elapsed.TotalMilliseconds);
            Console.WriteLine();
        }
Example #2
0
        public void AddSignal(DateTime dt, OperType tp)
        {
            if (tp == OperType.Buy)
            {
                if (_HasStock)
                {
                    // 不处理两次买入
                    return;
                }

                _BuyPrice = HoldValues.GetTotalValue(dt);
                _HasStock = true;

                // Valid last sell operation
                if (_SellPrice > 0)
                {
                    _BuyScore += CalcScore();
                }
            }
            else if (tp == OperType.Sell)
            {
                if (!_HasStock)
                {
                    // 不处理两次卖出
                    return;
                }

                _HasStock   = false;
                _SellPrice  = HoldValues.GetTotalValue(dt);
                _SellScore += CalcScore();
            }
            else
            {
            }
        }
Example #3
0
        public bool AddStock(IStockData sd)
        {
            if (sd == null)
            {
                return false;
            }

            prevStock_ = currentStock_;
            currentStock_ = sd;

            if ((prevStock_ == null) || (currentStock_ == null))
            {
                return false;
            }

            EngulfingType et = JudgeEngulfing(prevStock_, currentStock_);

            if (et == EngulfingType.RED_ENGULFING)
            {
                TodayOper_ = OperType.Buy;
            }
            else if (et == EngulfingType.GREEN_ENGULFING)
            {
                TodayOper_ = OperType.Sell;
            }
            else
            {
                TodayOper_ = OperType.NoOper;
            }
            return true;
        }
Example #4
0
        public bool AddStock(IStockData sd)
        {
            if (sd == null)
            {
                return false;
            }

            if (!Averager_.IsEnough())
            {
                Averager_.AddVal(sd.Amount);
                return false;
            }

            double avgMinAmount = Averager_.GetValue() * (1 - BuyMargin_);
            double avgMaxAmount = Averager_.GetValue() * (1 + SellMargin_);

            if (sd.Amount < avgMinAmount)
            {
                // 成交地量,买入
                TodayOper_ = OperType.Buy;
            }
            else if (sd.Amount > avgMaxAmount)
            {
                // 成交天量,卖出
                TodayOper_ = OperType.Sell;
            }
            else
            {
                TodayOper_ = OperType.NoOper;
            }

            Averager_.AddVal(sd.Amount);
            return true;
        }
Example #5
0
        /// <summary>
        /// 获取表结构序列化数据(同时产生增加/修改/保存的SQL)
        /// </summary>
        /// <param name="TabName">表名</param>
        /// <param name="operType">数据操作类型</param>
        /// <param name="DataSource">表结构数据源</param>
        /// <param name="KeyWords">删除条件拼接脚本</param>
        /// <returns>表结构序列化数据(XML)</returns>
        public string GetTabStrc(string TabNam, string FrmNam, OperType operType, string KeyWords, string PanelNam)
        {
            try
            {
                List <ExpandoObject> List_EObj  = new List <ExpandoObject>();
                SqlParameter[]       Parameters = { new SqlParameter("@TableName", TabNam), new SqlParameter("@PanelNam", PanelNam), new SqlParameter("@IfGetFstRow", "1"), new SqlParameter("@FFrmNam", FrmNam) };
                //获取表架构数据源
                List <DTSerializer <string, object> > ListDTObj = GetEnColData(CommandType.StoredProcedure, "Sp_ADMM_CrtSQLByTblNmToEnCol", Parameters);
                //ListDTObj没有数据
                foreach (var DTObj in ListDTObj)
                {
                    dynamic EObj  = new ExpandoObject();
                    var     IDObj = (IDictionary <string, object>)EObj;
                    foreach (var a in DTObj)
                    {
                        IDObj[a.Key] = a.Value;
                    }

                    List_EObj.Add(EObj);
                }

                return(GetStructure(TabNam, operType, List_EObj, KeyWords));
            }
            catch (Exception Ex)
            {
                Common.ShowMsg(Ex.Message);
            }

            return("");
        }
Example #6
0
        private static int DoSnmp(Snmp snmp, SnmpTarget target, Pdu pdu,
                                  OperType operType, ref TableReader.GetTableOptions tableOptions,
                                  uint repeat, bool asyncSync, bool debug)
        {
            int ncalls = 0;

            for (uint i = 0; i < repeat; i++)
            {
                using (IMemoryManager mgr = MemoryManager.GetMemoryManager())
                {
                    bool show = (i % 1000) == 0;
                    if (show || debug)
                    {
                        PrintPdu(Console.Out, "Sending PDU to target " + target, pdu, debug);
                    }

                    Pdu resPdu = DoSnmp(snmp, target, pdu,
                                        operType, ref tableOptions,
                                        asyncSync, show, debug, ref ncalls);

                    if ((show || debug) && resPdu != null)
                    {
                        PrintPdu(Console.Out, "Received PDU:", resPdu, debug);
                    }
                    if (debug)
                    {
                        Console.WriteLine("Removing " + mgr.Count + " objects");
                    }
                }
            }
            return(ncalls);
        }
Example #7
0
 /// <summary>
 /// 获取表结构序列化数据(同时产生增加/修改/保存的SQL)
 /// </summary>
 /// <param name="TabName">表名</param>
 /// <param name="operType">数据操作类型</param>
 /// <param name="DataSource">表结构数据源</param>
 /// <param name="KeyWords">删除条件拼接脚本</param>
 /// <returns>表结构序列化数据(XML)</returns>
 public string GetStructure(string TabName, OperType operType, List <ExpandoObject> DataSource, string KeyWords)
 {
     //DataSource反序列化成List<ExpandObject>列表
     //List<ExpandoObject> ListEObj = Serializer.DeserializeXMLToEObject(DataSource);
     //将数据序列化为XML格式
     return(Serializer.SerializeDTToXml(ComDAL.GetStructure(TabName, operType, DataSource, KeyWords)));
 }
Example #8
0
 public QCIemMainpageConfig(IEmrHost app)
 {
     m_app          = app;
     DataAccess.App = app;
     m_opertype     = OperType.QUERY;
     InitializeComponent();
 }
        public void AddSignal(DateTime dt, OperType tp)
        {
            if (tp == OperType.Buy)
            {
                if (_HasStock)
                {
                    // 不处理两次买入
                    return;
                }

                _BuyPrice = HoldValues.GetTotalValue(dt);
                _HasStock = true;

                // Valid last sell operation
                if (_SellPrice > 0)
                {
                    _BuyScore += CalcScore();
                }
            }
            else if (tp == OperType.Sell)
            {
                if (!_HasStock)
                {
                    // 不处理两次卖出
                    return;
                }

                _HasStock = false;
                _SellPrice = HoldValues.GetTotalValue(dt);
                _SellScore += CalcScore();
            }
            else
            {
            }
        }
 private void TankMenu_Click(object sender, EventArgs e)
 {
     if (SingleObject.GetObject().T == null)
     {
         Type = OperType.DrawTank;
     }
 }
Example #11
0
        public bool AddStock(IStockData sd)
        {
            if (sd == null)
            {
                return false;
            }

            slopeCalc.AddVal(sd.EndPrice);
            if (!slopeCalc.IsEnough())
            {
                return false;
            }

            if (slopeCalc.IsDownPeriod() && ShapeJudger.IsUpCross(sd))
            {
                TodayOper_ = OperType.Buy;
            }
            else if (slopeCalc.IsRisePeriod() && ShapeJudger.IsDownCross(sd))
            {
                TodayOper_ = OperType.Sell;
            }
            else
            {
                TodayOper_ = OperType.NoOper;
            }
            return true;
        }
 /// <summary>
 /// 【新游戏】
 /// </summary>
 public void NewGame()
 {
     #region  清理所有游戏对象
     SingleObject.listBrick.Clear();
     SingleObject.listRiver.Clear();
     SingleObject.listBullet.Clear();
     SingleObject.listBoom.Clear();
     SingleObject.listStell.Clear();
     #endregion
     #region 初始化变量
     for (int i = 0; i < GridNum; i++)
     {
         for (int j = 0; j < GridNum; j++)
         {
             GameObject.InitMap[i, j]     = '#';
             GameObject.IsVisit[i, j]     = true;
             GameObject.InitIsVisit[i, j] = true;
         }
     }
     GameObject.StartPoint.X = -1;
     GameObject.EndPoint.X   = -1;
     GameObject.IsDrawOk     = true;
     GameObject.Cost         = 0;
     AutoModelOpen           = false;
     ManualModelOpen         = false;
     Type = OperType.None;
     SingleObject.GetObject().T = null;
     SingleObject.GetObject().S = null;
     label2.Text = "当前坦克坐标 :  ";
     label3.Text = "当前鼠标坐标: ";
     #endregion
 }
Example #13
0
 /// <summary>
 /// 构造函数
 /// </summary>
 ///<param name="list">汇总日结时间段和操作员</param>
 ///<param name="operType">操作类型</param>
 public ucDayReportDetail(List <Class.DayReport> arrylist, OperType operType)
 {
     InitializeComponent();
     list          = arrylist;
     operationType = operType;
     this.panelDayReport.Visible = false;
 }
Example #14
0
        /// <summary>
        /// 取消出院结算
        /// </summary>
        /// <param name="hashtable"></param>
        /// <returns></returns>
        public bool CancelCharge(System.Collections.Hashtable hashtable)
        {
            string Nccm_NO = hashtable["Nccm_NO"].ToString();

            BudgetFee hisData = new BudgetFee();


            JoinArea joinArea = new JoinArea();

            joinArea.code = JOIN_AREA_CODE;
            joinArea.name = JOIN_AREA_NAME;


            DataClass dataClass = new DataClass();

            dataClass.dataClassName  = "新农合数据";
            dataClass.dataClassValue = "1";

            DataType dataType = new DataType();

            dataType.dataTypeName  = "住院数据";
            dataType.dataTypeValue = "2";

            OperType operType = new OperType();

            operType.operTypeName  = "取消登记";
            operType.operTypeValue = "7";

            ZyPatBaseData patBaseData = new ZyPatBaseData();

            patBaseData.hisID       = zyPatlist.Nccm_NO;//zyPatlist.CureNo + zyPatlist.PatListID.ToString();
            patBaseData.area_id     = JOIN_AREA_CODE;
            patBaseData.person_code = zyPatlist.patientInfo.PatCode;
            patBaseData.name        = zyPatlist.patientInfo.PatName;
            patBaseData.idCard      = zyPatlist.patientInfo.PatNumber; //?
            patBaseData.medcard_id  = zyPatlist.patientInfo.MediCard;  //?
            patBaseData.visit_type  = "2";
            patBaseData.medorg_code = MED_ORG_CODE;

            patBaseData.his_billno = Nccm_NO;

            hisData.uploadPerson = ((HospitalInfo)hospitalInfo).userCode;

            hisData.joinArea  = joinArea;
            hisData.dataClass = dataClass;
            hisData.dataType  = dataType;
            hisData.operType  = operType;
            hisData.zyPat     = patBaseData;
            hisData.uploadorg = MED_ORG_CODE;
            NcmsResult retMsg = NccmInterfaces.CanOutPatZYCharge(hisData);

            if (retMsg.resultId)
            {
                return(true);
            }
            else
            {
                throw new Exception("农合接口调用失败:" + retMsg.resultString);
            }
        }
Example #15
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dtbegin">开始时间</param>
 /// <param name="dtend">终止时间</param>
 ///<param name="operType">操作类型</param>
 public ucDayReportDetail(DateTime dtbegin, DateTime dtend, OperType operType)
 {
     InitializeComponent();
     dtBegin       = dtbegin;
     dtEnd         = dtend;
     operationType = operType;
 }
Example #16
0
 /// <summary>
 /// 操作病案首页评分标准表
 /// </summary>
 /// <returns>iem_mainpage_qc首页评分标准表</returns>
 public static DataTable OperIemMainPageQC(IemMainpageQC qc, OperType opertype)
 {
     SqlParameter[] sqlParam = new SqlParameter[]
     {
         new SqlParameter("@OPERTYPE", SqlDbType.VarChar),
         new SqlParameter("@ID", SqlDbType.VarChar),
         new SqlParameter("@TABLETYPE", SqlDbType.VarChar),
         new SqlParameter("@FIELDS", SqlDbType.VarChar),
         new SqlParameter("@FIELDSVALUE", SqlDbType.VarChar),
         new SqlParameter("@CONDITIONTABLETYPE", SqlDbType.VarChar),
         new SqlParameter("@CONDITIONFIELDS", SqlDbType.VarChar),
         new SqlParameter("@CONDITIONFIELDSVALUE", SqlDbType.VarChar),
         new SqlParameter("@REDUCTSCORE", SqlDbType.VarChar),
         new SqlParameter("@REDUCTREASON", SqlDbType.VarChar),
         new SqlParameter("@VALIDE", SqlDbType.VarChar)
     };
     sqlParam[0].Value  = ((int)opertype).ToString();
     sqlParam[1].Value  = qc.ID;
     sqlParam[2].Value  = qc.TableType;
     sqlParam[3].Value  = qc.Fields;
     sqlParam[4].Value  = qc.FieldsValue;
     sqlParam[5].Value  = qc.ConditionTableType;
     sqlParam[6].Value  = qc.ConditionFields;
     sqlParam[7].Value  = qc.ConditionValues;
     sqlParam[8].Value  = qc.ReductScore.ToString();
     sqlParam[9].Value  = qc.ReductReason;
     sqlParam[10].Value = qc.Valide.ToString();
     return(m_SqlHelper.ExecuteDataTable("iem_main_page.usp_operiem_mainpage_qc", sqlParam, CommandType.StoredProcedure));
 }
 private void StarMenu_Click(object sender, EventArgs e)
 {
     if (SingleObject.GetObject().S == null)
     {
         Type = OperType.DrawStar;
     }
 }
Example #18
0
 /// <summary>
 /// 删除 edit by 王冀 2012 12 19
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (DialogResult.OK == m_app.CustomMessageBox.MessageShow("确定要删除标准?", DrectSoft.Core.CustomMessageBoxKind.QuestionOkCancel))
         {
             if (this.textEditID.Text == "")
             {
                 m_app.CustomMessageBox.MessageShow("请选择一条删除标准");
                 return;
             }
             m_opertype = OperType.DEL;
             this.FreshOperView();
             IemMainpageQC qc = this.GetQCFromView();
             if (qc == null)
             {
                 return;
             }
             DataAccess.OperIemMainPageQC(qc, m_opertype);
             //DataTable dtMainpageQC = DataAccess.OperIemMainPageQC(qc, OperType.QUERY);
             //this.gridControlConfig.DataSource = dtMainpageQC;
             m_app.CustomMessageBox.MessageShow("删除成功");
             m_opertype = OperType.QUERY;
             this.FreshOperView();
             refreshData();
         }
     }
     catch (Exception ex)
     {
         m_app.CustomMessageBox.MessageShow(ex.Message);
     }
 }
Example #19
0
        public bool AddStock(IStockData sd)
        {
            if (sd == null)
            {
                return false;
            }

            stocks_.Add(sd);

            if (!stocks_.IsEnough())
            {
                return false;
            }

            if (Judger_.FulFil(stocks_.GetAt(0), stocks_.GetAt(1), stocks_.GetAt(2)))
            {
                TodayOper_ = OperType.Sell;
            }
            else if (Judger_.ReverseFulFil(stocks_.GetAt(0), stocks_.GetAt(1), stocks_.GetAt(2)))
            {
                TodayOper_ = OperType.Buy;
            }
            else
            {
                TodayOper_ = OperType.NoOper;
            }

            return true;
        }
Example #20
0
 // ���õ��ղ�������
 // ��ǰ��֧��ͬһ����������
 public void SetOperationSignal(DateTime dt, OperType val)
 {
     if (_Signals.ContainsKey(dt))
     {
         return;
     }
     _Signals.Add(dt, val);
 }
Example #21
0
        public ActionResult DeleteConfirmed(int id)
        {
            OperType operType = db.OperTypes.Find(id);

            db.OperTypes.Remove(operType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #22
0
 // 设置当日操作类型
 // 当前不支持同一天买入和卖出
 public void SetOperationSignal(DateTime dt, OperType val)
 {
     if (_Signals.ContainsKey(dt))
     {
         return;
     }
     _Signals.Add(dt, val);
 }
Example #23
0
        public static Operation rebuildOperation(Operation inOperation, List <string> excludeProperty)
        {
            Operation outOperation = null;

            if (inOperation != null)
            {
                outOperation           = new Operation(inOperation.Id);
                outOperation.DocNumber = inOperation.DocNumber;
                outOperation.DocDate   = inOperation.DocDate;
                outOperation.Note      = inOperation.Note;
                outOperation.Wear      = inOperation.Wear;
                if (outOperation.Wear == null)
                {
                    outOperation.Wear = inOperation.Storage.Wear;
                }

                outOperation.Quantity = inOperation.Quantity;
                outOperation.OperDate = inOperation.OperDate;
                outOperation.Partner  = rebuildStorageName(inOperation.Partner);
                if (!isExclude(excludeProperty, "StorageName"))
                {
                    outOperation.StorageName = rebuildStorageName(inOperation.StorageName, rebuildExcludeProperty(excludeProperty, "StorageName"));
                }
                OperType ot = new OperType(inOperation.OperType.Id, inOperation.OperType.Name);
                outOperation.OperType = ot;
                if (!isExclude(excludeProperty, "Storage"))
                {
                    outOperation.Storage = rebuildStorage(inOperation.Storage, rebuildExcludeProperty(excludeProperty, "Storage"));
                }
                if (!isExclude(excludeProperty, "DocType"))
                {
                    if (inOperation.DocType != null)
                    {
                        DocType doct = new DocType(inOperation.DocType.Id, inOperation.DocType.Name);
                        outOperation.DocType = doct;
                    }
                }
                if (!isExclude(excludeProperty, "WorkerWorkplace"))
                {
                    WorkerWorkplace wwp    = new WorkerWorkplace();
                    Organization    org    = new Organization();
                    Worker          worker = new Worker();
                    wwp.Organization = org;
                    wwp.Worker       = worker;
                    if (inOperation.WorkerWorkplace != null)
                    {
                        wwp = rebuildWorkerWorkplaceSimple(inOperation.WorkerWorkplace, rebuildExcludeProperty(excludeProperty, "WorkerWorkplace"));
                    }
                    outOperation.WorkerWorkplace = wwp;
                }
                if (inOperation.Motiv != null)
                {
                    Motiv m = new Motiv(inOperation.Motiv.Id, inOperation.Motiv.Name);
                    outOperation.Motiv = m;
                }
            }
            return(outOperation);
        }
Example #24
0
        public StockOper(double price, int count, OperType type)
        {
            MarketStock stock = new MarketStock();
            stock.UnitPrice = price;
            stock.Count = count;

            TargetStock = stock;
            operType = type;
        }
Example #25
0
 public ActionResult Edit([Bind(Include = "Id,Oper_Type,OperTypeDesc")] OperType operType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(operType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(operType));
 }
Example #26
0
        public StockOper(double price, int count, OperType type)
        {
            MarketStock stock = new MarketStock();

            stock.UnitPrice = price;
            stock.Count     = count;

            TargetStock = stock;
            operType    = type;
        }
Example #27
0
 public void SaveFltSlt1(OperType operType, string StrXML, string TabName, string KeyWords)
 {
     try
     {
         ComBLL.SaveFltSlt1(operType, StrXML, TabName, KeyWords, SqlCmd);
     }
     catch (Exception Ex)
     {
         Common.ShowMsg(Ex.Message);
     }
 }
Example #28
0
 /// <summary>
 /// 保存数据
 /// </summary>
 /// <param name="StrXML">实体对象的序列化数据</param>
 /// <param name="operType">操作类型</param>
 public void SaveData(string StrXML, string SQL, OperType operType)
 {
     try
     {
         ComDAL.SaveData(StrXML, SQL, operType);
     }
     catch (Exception Ex)
     {
         Common.ShowMsg(Ex.Message);
     }
 }
Example #29
0
        public ActionResult Create([Bind(Include = "Id,Oper_Type,OperTypeDesc")] OperType operType)
        {
            if (ModelState.IsValid)
            {
                db.OperTypes.Add(operType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(operType));
        }
 /// <summary>
 /// 设置界面控件状态
 /// </summary>
 /// <param name="type">操作类型</param>
 private void SetbtnState(OperType type)
 {
     if (type == OperType.新增)
     {
         txtpaycode.Enabled = true;
     }
     else
     {
         txtpaycode.Enabled = false;
     }
 }
Example #31
0
 /// <summary>
 /// 取消  edit by 王冀 2012 12 19
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnCancel_Click(object sender, EventArgs e)
 {
     try
     {
         m_opertype = OperType.QUERY;
         this.FreshOperView();
     }
     catch (Exception ex)
     {
         m_app.CustomMessageBox.MessageShow(ex.Message);
     }
 }
Example #32
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="StrXML">包含参数名和参数值的序列化数据</param>
        /// <param name="operType">操作类型</param>
        public void SaveData(string StrXML, string SQL, OperType operType)
        {
            try
            {
                //根据操作类型执行不同的操作
                if ((operType != OperType.Delete && operType != OperType.EditSave && operType != OperType.UnApprove && operType != OperType.UnApprove) || (operType == OperType.CoverSlt))
                {
                    List <ExpandoObject> List_EObj = Serializer.DeserializeXMLToEObject(StrXML);
                    foreach (ExpandoObject EObj in List_EObj)
                    {
                        //自动生成SQL参数列表
                        List <SqlParameter>          Parameters = new List <SqlParameter>();
                        IDictionary <string, object> IDObj      = (IDictionary <string, object>)EObj;

                        if (IDObj.Keys.Count > 0)
                        {
                            foreach (string Key in IDObj.Keys)
                            {
                                SqlParameter Parameter;
                                if (Key == "fAppDate" || Key == "fModiDate")
                                {
                                    if (IDObj[Key].ToString() != "")
                                    {
                                        Parameter = new SqlParameter(Key, IDObj[Key]);
                                    }
                                    else
                                    {
                                        Parameter = new SqlParameter(Key, DBNull.Value);
                                    }
                                }
                                else
                                {
                                    Parameter = new SqlParameter(Key, IDObj[Key]);
                                }

                                Parameters.Add(Parameter);
                            }
                            //执行自动生成的SQL语句
                            SqlHelper.ExecteNonQuery(CommandType.Text, SQL, Parameters.ToArray());
                        }
                    }
                }
                else
                {
                    //执行自动生成的SQL语句
                    SqlHelper.ExecteNonQuery(CommandType.Text, SQL, null);
                }
            }
            catch (Exception Ex)
            {
                Common.ShowMsg(Ex.Message);
            }
        }
Example #33
0
        /// <summary>
        /// 取消入院
        /// </summary>
        /// <param name="hashtable"></param>
        /// <returns></returns>
        public bool CancelRegister(System.Collections.Hashtable hashtable)
        {
            PatBaseInfo hisData = new PatBaseInfo();


            JoinArea joinArea = new JoinArea();

            joinArea.code = JOIN_AREA_CODE;
            joinArea.name = JOIN_AREA_NAME;


            DataClass dataClass = new DataClass();

            dataClass.dataClassName  = "新农合数据";
            dataClass.dataClassValue = "1";

            DataType dataType = new DataType();

            dataType.dataTypeName  = "住院数据";
            dataType.dataTypeValue = "2";

            OperType operType = new OperType();

            operType.operTypeName  = "取消登记";
            operType.operTypeValue = "7";

            PatBaseData patBaseData = new PatBaseData();

            patBaseData.hisID       = zyPatlist.Nccm_NO;//病人的唯一ID,住院则对应的是住院号,门诊则对应的是门诊号
            patBaseData.area_id     = JOIN_AREA_CODE;
            patBaseData.person_code = zyPatlist.patientInfo.PatCode;
            patBaseData.name        = zyPatlist.patientInfo.PatName;
            patBaseData.idCard      = zyPatlist.patientInfo.PatNumber; //?(身份证)
            patBaseData.medcard_id  = zyPatlist.patientInfo.MediCard;  //?
            patBaseData.visit_type  = "2";                             //住院

            hisData.joinArea  = joinArea;
            hisData.dataClass = dataClass;
            hisData.dataType  = dataType;
            hisData.operType  = operType;
            hisData.baseData  = patBaseData;
            hisData.uploadorg = MED_ORG_CODE;
            NcmsResult retMsg = NccmInterfaces.CanInpatientRegister(hisData);

            if (retMsg.resultId)
            {
                return(true);
            }
            else
            {
                throw new Exception("农合接口调用失败:" + retMsg.resultString);
            }
        }
Example #34
0
        private void boxPlan_CheckedChanged(object sender, EventArgs e)
        {
            if ((boxPlan.Checked) && (operation == OperType.Buy))
            {
                operation = OperType.PlanBuy;
            }

            if ((!boxPlan.Checked) && (operation == OperType.PlanBuy))
            {
                operation = OperType.Buy;
            }
        }
Example #35
0
 /// <summary>
 /// 设置界面控件是否可用
 /// </summary>
 /// <param name="type">操作类型</param>
 private void SetbtnState(OperType type)
 {
     if (type == OperType.新增)
     {
         groupAdd.Enabled    = true;
         groupSearch.Enabled = false;
     }
     else
     {
         groupAdd.Enabled    = false;
         groupSearch.Enabled = true;
     }
 }
Example #36
0
 /// <summary>
 /// 设置界面控件是否可用
 /// </summary>
 /// <param name="type">操作类型</param>
 private void SetbtnState(OperType type)
 {
     if (type == OperType.新增)
     {
         txtParaID.Enabled   = true;
         txtParaName.Enabled = true;
     }
     else
     {
         txtParaID.Enabled   = false;
         txtParaName.Enabled = false;
     }
 }
Example #37
0
 /// <summary>
 /// 设置组合项目维护按钮是否可用
 /// </summary>
 /// <param name="type">操作类型</param>
 private void SetbtnEIState(OperType type)
 {
     if (type == OperType.新增)
     {
         btnNewEI.Enabled  = false;
         btnSaveEI.Enabled = true;
         CurrExamItem      = new Basic_ExamItem();
     }
     else
     {
         btnNewEI.Enabled  = true;
         btnSaveEI.Enabled = true;
     }
 }
Example #38
0
 private void AnalyseOperation(double rsi)
 {
     if (rsi > RSISELLMARGIN)
     {
         TodayOper_ = OperType.Sell;
     }
     else if (rsi < RSIBUYMARGIN)
     {
         TodayOper_ = OperType.Buy;
     }
     else
     {
         TodayOper_ = OperType.NoOper;
     }
 }
Example #39
0
        public bool AddStock(IStockData sd)
        {
            if (sd == null)
            {
                return false;
            }

            stocks_.Add(sd);

            if (!stocks_.IsEnough())
            {
                return false;
            }

            TodayOper_ = Scanner_.Analyse(stocks_.GetAt(0), stocks_.GetAt(1), stocks_.GetAt(2));
            return true;
        }
Example #40
0
        public bool AddStock(IStockData sd)
        {
            if (sd == null)
            {
                return false;
            }
            prevStock_ = currentStock_;
            currentStock_ = sd;

            if ((prevStock_ == null) || (currentStock_ == null))
            {
                return false;
            }

            TodayOper_ = Scanner_.Analyse(currentStock_, prevStock_);
            return true;
        }
Example #41
0
        public bool AddStock(IStockData sd)
        {
            if (sd == null)
            {
                return false;
            }

            prevStock_ = currentStock_;
            currentStock_ = sd;

            if (prevStock_ == null)
            {
                return false;
            }

            TodayOper_ = Rule_.Execute(currentStock_.EndPrice, prevStock_.EndPrice);
            return true;
        }
Example #42
0
        public bool AddStock(IStockData sd)
        {
            if (sd == null)
            {
                return false;
            }
            if (ShapeJudger.IsT2(sd, DeltaRatio_))
            {
                TodayOper_ = OperType.Buy;
            }
            else if (ShapeJudger.IsReverseT2(sd, DeltaRatio_))
            {
                TodayOper_ = OperType.Sell;
            }
            else
            {
                TodayOper_ = OperType.NoOper;
            }

            return true;
        }
        public bool AddStock(IStockData sd)
        {
            prediction_.AddPrice(sd.EndPrice);

            if (!prediction_.IsCountEnough())
            {
                return false;
            }

            // 长周期日线和短周期日线
            double longEMA = prediction_.GetLongAverage();
            double shortEMA = prediction_.GetShortAverage();

            double diff = shortEMA - longEMA; // 短周期均值-长周期均值

            if (double.IsNaN(previousMA_))
            {
                previousMA_ = diff;
                return false;
            }

            TodayOper_ = OperType.NoOper;
            if (previousMA_ < 0)
            {
                if (prediction_.CalcNextPredictionValue() > 0)
                {
                    TodayOper_ = OperType.Buy;
                }
            }
            else if (previousMA_ > 0)
            {
                if (prediction_.CalcNextPredictionValue() < 0)
                {
                    TodayOper_ = OperType.Sell;
                }
            }

            previousMA_ = diff;
            return true;
        }
        private Byte[] packetHeader(OperType operType, Int32 length)
        {
            Byte byteHead = (Byte)(byte80 | (Byte)operType);
            Byte[] byteLen;
            if (length < 126)
            {
                byteLen = new Byte[1];
                byteLen[0] = (Byte)(byte80 | (Byte)length);
            }
            else if (length < 65535)
            {
                byteLen = new Byte[3];
                byteLen[0] = (Byte)(byte80 | (Byte)126);
                for (int i = 1; i < 3; i++)
                    byteLen[i] = (Byte)(length >> (8 * (2 - i)));
            }
            else
            {
                byteLen = new Byte[9];
                byteLen[0] = (Byte)(byte80 | (Byte)127);
                for (int i = 1; i < 9; i++)
                    byteLen[i] = (Byte)(length >> (8 * (8 - i)));
            }

            Byte[] packet = new Byte[1 + byteLen.Length + maskKey.Length];
            packet[0] = byteHead;
            Buffer.BlockCopy(byteLen, 0, packet, 1, byteLen.Length);
            Buffer.BlockCopy(maskKey, 0, packet, 1 + byteLen.Length, maskKey.Length);
            return packet;
        }
Example #45
0
        // 将读者记录数据从XML格式转换为HTML格式
        // parameters:
        //      strRecPath  读者记录路径 2009/10/18
        public int ConvertReaderXmlToHtml(
            SessionInfo sessioninfo,
            string strCsFileName,
            string strRefFileName,
            string strXml,
            string strRecPath,
            OperType opertype,
            string[] saBorrowedItemBarcode,
            string strCurrentItemBarcode,
            out string strResult,
            out string strError)
        {
            strResult = "";
            strError = "";

            OpacApplication app = this;

            // 转换为html格式
            Assembly assembly = null;
            int nRet = app.GetXml2HtmlAssembly(
                strCsFileName,
                strRefFileName,
                app.BinDir,
                out assembly,
                out strError);
            if (nRet == -1)
            {
                goto ERROR1;
            }

            // 得到Assembly中Converter派生类Type
            Type entryClassType = ScriptManager.GetDerivedClassType(
                assembly,
                "DigitalPlatform.OPAC.Server.ReaderConverter");

            if (entryClassType == null)
            {
                strError = "从DigitalPlatform.OPAC.Server.ReaderConverter派生的类 type entry not found";
                goto ERROR1;
            }

            // new一个Converter派生对象
            ReaderConverter obj = (ReaderConverter)entryClassType.InvokeMember(null,
                BindingFlags.DeclaredOnly |
                BindingFlags.Public | BindingFlags.NonPublic |
                BindingFlags.Instance | BindingFlags.CreateInstance, null, null,
                null);

            // 为Converter派生类设置参数
            // obj.MainForm = this;
            obj.BorrowedItemBarcodes = saBorrowedItemBarcode;
            obj.CurrentItemBarcode = strCurrentItemBarcode;
            obj.OperType = opertype;
            obj.App = app;
            obj.SessionInfo = sessioninfo;
            obj.RecPath = strRecPath;

            // 调用关键函数Convert
            try
            {
                strResult = obj.Convert(strXml);
            }
            catch (Exception ex)
            {
                strError = "脚本执行时抛出异常: " + ExceptionUtil.GetDebugText(ex);
                goto ERROR1;
            }

            return 0;
        ERROR1:
            return -1;
        }
Example #46
0
 public int GetOperCount(OperType oper)
 {
     var result = from item in _Signals.Values where item == oper select item;
     return result.Count();
 }
Example #47
0
        // 创建读者记录返回格式
        // 注:出于安全需要,readerdom 和 strXml 在调用前就应该把里面的 barcode 元素删除
        // parameters:
        //      readerdom   读者 XMLDocument 对象。如果为空,则 strXml 参数中应该有读者记录
        //      strXml      读者 XML 记录。如果 readerdom 为空,可以用这里的值
        int BuildReaderResults(
            SessionInfo sessioninfo,
            XmlDocument readerdom,
            string strXml,
            string strResultTypeList,
            string strLibraryCode,  // calendar/advancexml/html 时需要
            List<string> recpaths,    // recpaths 时需要
            string strOutputPath,   // recpaths 时需要
            byte[] baTimestamp,    // timestamp 时需要
            OperType operType,  // html 时需要
            string[] saBorrowedItemBarcode,
            string strCurrentItemBarcode,
            ref string[] results_param,
            out string strError)
        {
            strError = "";
            int nRet = 0;

            if (string.IsNullOrEmpty(strResultTypeList) == true)
            {
                results_param = new string[0];
                return 0;
            }

            string[] result_types = strResultTypeList.Split(new char[] { ',' });
            //results = new string[result_types.Length];
            List<string> results_list = new List<string>();

            int i = 0;
            foreach (string strResultType in result_types)
            {
                // string strResultType = result_types[i];

                // 2008/4/3 
                // if (String.Compare(strResultType, "calendar", true) == 0)
                if (IsResultType(strResultType, "calendar") == true)
                {
                    if (readerdom == null)
                    {
                        nRet = LibraryApplication.LoadToDom(strXml,
                            out readerdom,
                            out strError);
                        if (nRet == -1)
                        {
                            strError = "装载读者记录进入XML DOM时发生错误: " + strError;
                            goto ERROR1;
                        }
                    }

                    string strReaderType = DomUtil.GetElementText(readerdom, "readerType");

                    // 获得日历
                    DigitalPlatform.LibraryServer.Calendar calendar = null;
                    // return:
                    //      -1  出错
                    //      0   没有找到日历
                    //      1   找到日历
                    nRet = this.GetReaderCalendar(strReaderType,
                        strLibraryCode,
                        out calendar,
                        out strError);
                    if (nRet == -1 || nRet == 0)
                    {
                        calendar = null;
                    }

                    string strCalendarName = "";

                    if (calendar != null)
                        strCalendarName = calendar.Name;

                    // results[i] = strCalendarName;
                    SetResult(results_list, i, strCalendarName);
                }
                // else if (String.Compare(strResultType, "xml", true) == 0)
                else if (IsResultType(strResultType, "xml") == true)
                {
                    // results[i] = strXml;
                    string strResultXml = "";
                    nRet = GetItemXml(strXml,
        strResultType,
        out strResultXml,
        out strError);
                    if (nRet == -1)
                    {
                        strError = "获取 " + strResultType + " 格式的 XML 字符串时出错: " + strError;
                        goto ERROR1;
                    }
                    // results[i] = strResultXml;
                    SetResult(results_list, i, strResultXml);
                }
                else if (String.Compare(strResultType, "timestamp", true) == 0)
                {
                    // 2011/1/27
                    // results[i] = ByteArray.GetHexTimeStampString(baTimestamp);
                    SetResult(results_list, i, ByteArray.GetHexTimeStampString(baTimestamp));
                }
                else if (String.Compare(strResultType, "recpaths", true) == 0)
                {
                    // 2013/5/21
                    if (recpaths != null)
                    {
                        // results[i] = StringUtil.MakePathList(recpaths);
                        SetResult(results_list, i, StringUtil.MakePathList(recpaths));
                    }
                    else
                    {
                        // results[i] = strOutputPath;
                        SetResult(results_list, i, strOutputPath);
                    }
                }
                else if (String.Compare(strResultType, "advancexml_borrow_bibliosummary", true) == 0
                    || String.Compare(strResultType, "advancexml_overdue_bibliosummary", true) == 0
                    || String.Compare(strResultType, "advancexml_history_bibliosummary", true) == 0
                    )
                {
                    // 2011/1/27
                    continue;
                }
                // else if (String.Compare(strResultType, "summary", true) == 0)
                else if (IsResultType(strResultType, "summary") == true)
                {
                    // 2013/11/15
                    string strSummary = "";
#if NO
                    XmlDocument dom = new XmlDocument();
                    try
                    {
                        dom.LoadXml(strXml);
                    }
                    catch (Exception ex)
                    {
                        strSummary = "读者 XML 装入 DOM 出错: " + ex.Message;
                        results[i] = strSummary;
                        continue;
                    }
#endif
                    if (readerdom == null)
                    {
                        nRet = LibraryApplication.LoadToDom(strXml,
                            out readerdom,
                            out strError);
                        if (nRet == -1)
                        {
                            strSummary = "读者 XML 装入 DOM 出错: " + strError;
                            // results[i] = strSummary;
                            SetResult(results_list, i, strSummary);
                            goto CONTINUE;
                        }
                    }
                    strSummary = DomUtil.GetElementText(readerdom.DocumentElement, "name");
                    // results[i] = strSummary;
                    SetResult(results_list, i, strSummary);
                }
                // else if (String.Compare(strResultType, "advancexml", true) == 0)
                else if (IsResultType(strResultType, "advancexml") == true)
                {
                    // 2008/4/3 
                    string strOutputXml = "";
                    nRet = this.GetAdvanceReaderXml(
                        sessioninfo,
                        strResultTypeList,  // strResultType, BUG!!! 2012/4/8
                        strLibraryCode,
                        strXml,
                        out strOutputXml,
                        out strError);
                    if (nRet == -1)
                    {
                        strError = "GetAdvanceReaderXml()出错: " + strError;
                        goto ERROR1;
                    }
                    // results[i] = strOutputXml;
                    SetResult(results_list, i, strOutputXml);
                }
                // else if (String.Compare(strResultType, "html", true) == 0)
                else if (IsResultType(strResultType, "html") == true)
                {
                    string strReaderRecord = "";
                    // 将读者记录数据从XML格式转换为HTML格式
                    nRet = this.ConvertReaderXmlToHtml(
                        sessioninfo,
                        Path.Combine(this.CfgDir, "readerxml2html.cs"),
                        Path.Combine(this.CfgDir, "readerxml2html.cs.ref"),
                        strLibraryCode,
                        strXml,
                        strOutputPath,  // 2009/10/18 
                        operType,   // OperType.None,
                        saBorrowedItemBarcode,  // null,
                        strCurrentItemBarcode,
                        strResultType,
                        out strReaderRecord,
                        out strError);
                    if (nRet == -1)
                    {
                        strError = "ConvertReaderXmlToHtml()出错(脚本程序为" + this.CfgDir + "\\readerxml2html.cs" + "): " + strError;
                        goto ERROR1;
                    }
                    // test strReaderRecord = "<html><body><p>test</p></body></html>";
                    // results[i] = strReaderRecord;
                    SetResult(results_list, i, strReaderRecord);
                }
                // else if (String.Compare(strResultType, "text", true) == 0)
                else if (IsResultType(strResultType, "text") == true)
                {
                    string strReaderRecord = "";
                    // 将读者记录数据从XML格式转换为text格式
                    nRet = this.ConvertReaderXmlToHtml(
                        sessioninfo,
                        this.CfgDir + "\\readerxml2text.cs",
                        this.CfgDir + "\\readerxml2text.cs.ref",
                        strLibraryCode,
                        strXml,
                        strOutputPath,  // 2009/10/18 
                        OperType.None,
                        null,
                        "",
                        strResultType,
                        out strReaderRecord,
                        out strError);
                    if (nRet == -1)
                    {
                        strError = "ConvertReaderXmlToHtml()出错(脚本程序为" + this.CfgDir + "\\readerxml2html.cs" + "): " + strError;
                        goto ERROR1;
                    }
                    // results[i] = strReaderRecord;
                    SetResult(results_list, i, strReaderRecord);
                }
                else
                {
                    strError = "未知的结果类型 '" + strResultType + "'";
                    goto ERROR1;
                }

            CONTINUE:
                i++;
            }

            results_param = results_list.ToArray();
            return 0;
        ERROR1:
            return -1;
        }