コード例 #1
0
ファイル: MemberSkinProvider.cs プロジェクト: dkme/moooyo
        /// <summary>
        /// 添加用户皮肤
        /// </summary>
        /// <param name="memberId">创建者编号</param>
        /// <param name="userType">用户类型</param>
        /// <param name="personalityPicture">个性图片</param>
        /// <param name="personalityBackgroundPicture">个性背景图片</param>
        /// <returns></returns>
        public static MemberSkin AddMemberSkin(
            String memberId,
            Comm.UserType userType,
            String personalityPicture,
            String personalityBackgroundPicture)
        {
            //创建用户皮肤
            MemberSkin obj = CreateMemberSkin(memberId, userType, personalityPicture, personalityBackgroundPicture);
            if (obj.ID != "")
            {
                ////增加动态
                //BiZ.Member.Activity.ActivityController.AddActivity(
                //    memberId,
                //    BiZ.Member.Activity.ActivityType.AddInterest,
                //    BiZ.Member.Activity.ActivityController.GetActivityContent_AddInterest_Title(),
                //    BiZ.Member.Activity.ActivityController.GetActivityContent_AddInterest(obj.ID, title, content, iconpath),
                //    false);

                return obj;
            }
            else
            {
                //保存兴趣错误
                return null;
            }
        }
コード例 #2
0
ファイル: SVWSTC.cs プロジェクト: ufjl0683/Center
 public SVWSTC(Comm.Protocol protocol,string ip,int port)
 {
     this.protocol = protocol;
     new System.Threading.Thread(Communication_Task).Start();
     this.ip = ip;
     this.port = port;
 }
コード例 #3
0
ファイル: MFCC_AVI.cs プロジェクト: ufjl0683/Center
        void MFCC_AVI_OnTCReport(object tc, Comm.TextPackage txt)
        {
            if (txt.Text[0] == 0x4f && txt.Text[1] == 0x04) //avi 主動回報
               {
               int day, hour, min, sec;
               day = txt.Text[6];
               hour = txt.Text[7];
               min=txt.Text[8];
               sec = txt.Text[9];
              // System.DateTime dt = new DateTime(System.DateTime.Now.Year, System.DateTime.Now.Month, day, hour, min, sec);
              System.DateTime dt = new DateTime(System.DateTime.Now.Year, System.DateTime.Now.Month, System.DateTime.Now.Day, System.DateTime.Now.Hour, System.DateTime.Now.Minute, System.DateTime.Now.Second);
             //  System.DateTime dt = new DateTime(System.DateTime.Now.Year, System.DateTime.Now.Month,day, hour, min, sec);

               byte[] plate = new byte[6];
               System.Array.Copy(txt.Text, 10, plate,0 , 6);
               string plateStr =System.Text.UnicodeEncoding.Unicode.GetString( System.Text.Encoding.Convert(System.Text.Encoding.ASCII, System.Text.Encoding.Unicode, plate)).Trim();
               ConsoleServer.WriteLine(((Comm.TCBase)tc).DeviceName + "," + dt + "," + plateStr);
               string sql = string.Format("insert  into tblAviData1Min (devicename,timestamp,vehicle_plate) values('{0}','{1}','{2}')",
                   ((Comm.TCBase)tc).DeviceName, Comm.DB2.Db2.getTimeStampString(dt), plateStr);
               this.dbServer.SendSqlCmd(sql);
               try
               {
                   //if (!isInRobj)
                   //{
                     if(this.r_host_comm!=null)
                       this.r_host_comm.AddAviData(new RemoteInterface.MFCC.AVIPlateData(((Comm.TCBase)tc).DeviceName, dt, plateStr));
                   //}
               }
               catch (Exception ex)
               {
                   ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
               }
             //  finally

             }
             else  if (txt.Text[0] == 0x4f && txt.Text[1] == 0x00)
             {
                 try
                 {
                     ConsoleServer.WriteLine(((Comm.TCBase)tc).DeviceName + ",總流量接收!");
                     System.Data.DataSet ds = this.protocol.GetSendDsByTextPackage(txt,Comm.CmdType.CmdReport);
                     int day, hour, min,amount;
                     System.Data.DataRow r = ds.Tables[0].Rows[0];
                     day = System.Convert.ToInt32(r["day"]);
                     hour = System.Convert.ToInt32(r["hour"]);
                     min = System.Convert.ToInt32(r["minute"]);
                     amount = System.Convert.ToInt32(r["amount"]);
                     DateTime dt=new DateTime(DateTime.Now.Year,DateTime.Now.Month,day,hour,min,0);
                     string sql = string.Format("insert into tblAviRecognition (devicename,timestamp,volume) values('{0}','{1}',{2})",
                         ((Comm.TCBase)tc).DeviceName, Comm.DB2.Db2.getTimeStampString(dt), amount);
                     this.dbServer.SendSqlCmd(sql);
                 }
                 catch (Exception ex)
                 {
                     ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
                 }

             }
        }
コード例 #4
0
        public BluetoothConnect(ref Comm.BT.BTPort btport)
        {
            _btport = btport;
            InitializeComponent();
#if DEBUG
            txtBTAddress.Text = "0006660309E8";
#endif
        }
コード例 #5
0
ファイル: MFCC_WIS.cs プロジェクト: ufjl0683/Center
        void MFCC_WIS_OnTCReport(object tc, Comm.TextPackage txt)
        {
            // Comm.TCBase tcc = tc as Comm.TCBase;

             //if (txt.Text[0] == 0x5f && txt.Text[1] = 0xda)
             //{

             //}

             //throw new Exception("The method or operation is not implemented.");
        }
コード例 #6
0
ファイル: ImagePush.cs プロジェクト: dkme/moooyo
 public ImagePush(String ContentID, String MemberID, List<Content.Image> ImageList, String ImageContent, ImagePushCount ImagePushCount, DateTime CreatedTime, Comm.DeletedFlag DeleteFlag)
 {
     this.ContentID = ContentID;
     this.MemberID = MemberID;
     this.Creater = new BiZ.Creater.Creater(MemberID);
     this.ImageList = ImageList;
     this.ImageContent = ImageContent;
     this.ImagePushCount = ImagePushCount;
     this.CreatedTime = CreatedTime;
     this.DeleteFlag = DeleteFlag;
 }
コード例 #7
0
ファイル: FeaturedContent.cs プロジェクト: dkme/moooyo
 public FeaturedContent(String image, String content, String creator, Comm.UsedFlag usedFlag)
 {
     this.CreatedTime = DateTime.Now;
     this.Image = image;
     this.Content = content;
     if (creator != null && creator != "" && creator != "4eb0fde42101b0824e2b018f") //不等于管理员
         this.Creator = new Creater.Creater(creator);
     else
         this.Creator = null;
     this.UsedFlag = usedFlag;
 }
コード例 #8
0
        public BluetoothConnect(ref Comm.BT.BTPort btport)
        {
            PriceMarkdown.ResClass2 _resClass = PriceMarkdown.ResClass2.getInstance();
            _resClass.colorizeForm(this);

            _btport = btport;
            InitializeComponent();
            #if DEBUG
            txtBTAddress.Text = "000666025f1d";
            #endif
        }
コード例 #9
0
ファイル: Factory.cs プロジェクト: dkme/moooyo
 public ICanBeenComment getICanBeenComment(Comm.ContentType name)
 {
     ICanBeenComment iCanBeenComment = null;
     switch (name)
     {
         case Comm.ContentType.PublicContent: iCanBeenComment = new Content.PublicContent(); break;
         case Comm.ContentType.InterView: iCanBeenComment = new InterView.InterView(); break;
         default: break;
     }
     return iCanBeenComment;
 }
コード例 #10
0
ファイル: Form1.cs プロジェクト: hjgode/pricemarkdown
 void showLangSelect(ref SerialPort serConn, ref Comm.BT.BTPort btConn)
 {
     comport = serConn;
     btport = btConn;
     //if (bUseSocket)
     //    comport = null;
     //else
     //    btport = null;
     frmLanguage dlg = new frmLanguage(ref comport, ref btport);
     dlg.ShowDialog();
     dlg.Dispose();
 }
コード例 #11
0
ファイル: MFCC_SCM.cs プロジェクト: ufjl0683/Center
        void MFCC_SCM_OnTCReport(object tc, Comm.TextPackage txt)
        {
            //throw new Exception("The method or operation is not implemented.");

            Comm.TCBase  dev=(Comm.TCBase)tc;
            if (txt.Text[0] == 0x86 || txt.Text[0] == 0xa7 || txt.Text[0] == 0xae || txt.Text[0] == 0xaf && txt.Text[1] == 0x01)
            {
               // ConsoleServer.WriteLine("In Rms Report:0x" + Util.ToHexString(txt.Text[0]));
                System.Data.DataSet ds = this.protocol.GetSendDsByTextPackage(txt, Comm.CmdType.CmdReport);
                ds.AcceptChanges();
                this.notifier.NotifyAll(new NotifyEventObject(EventEnumType.MFCC_Report_Event,dev.DeviceName,ds));
            }
        }
コード例 #12
0
ファイル: SVWSTC.cs プロジェクト: ufjl0683/Center
        void dledev_OnReport(object sender, Comm.TextPackage txtObj)
        {
            // throw new Exception("The method or operation is not implemented.");

            try
            {
                if (txtObj.Text[0] == 0x10)
                {

                    System.Data.DataSet ds = protocol.GetSendDsByTextPackage(txtObj, Comm.CmdType.CmdReport);
                    string mesg = "";
                    for (int i = 1; i < ds.Tables[0].Columns.Count; i++)
                    {
                        mesg += ds.Tables[0].Columns[i].ColumnName + ":" + ds.Tables[0].Rows[0][ds.Tables[0].Columns[i].ColumnName].ToString() + "\t";
                    }
                    ConsoleServer.WriteLine(mesg);
                    SVWS_Status svws_status = new SVWS_Status(ds);
                    Program.mfcc_svws.stausmgr.AddSVWS_Status(svws_status);

                }
            }
            catch (Exception ex)
            {
                ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
            }

            if (txtObj.Text[0] == 0x11)
            {
                System.Data.DataSet ds = protocol.GetSendDsByTextPackage(txtObj, Comm.CmdType.CmdReport);
                string mesg = "";
                for (int i = 1; i < ds.Tables[0].Columns.Count; i++)
                {
                    mesg += ds.Tables[0].Columns[i].ColumnName + ":" + ds.Tables[0].Rows[0][ds.Tables[0].Columns[i].ColumnName].ToString() + "\t";
                }
                ConsoleServer.WriteLine(mesg);
                SVWS_Status svws_status = new SVWS_Status(ds);
                Program.mfcc_svws.stausmgr.AddSVWS_Status(svws_status);
            }
            else

                if (txtObj.Text[0] == 0x12)
                {
                    lock (dledev.GetStream())
                    {
                        byte[] data = dledev.PackData(0xffff, new byte[]{0x12,(byte)(DateTime.Now.Year%100),(byte)DateTime.Now.Month,(byte) DateTime.Now.Day,
                           (byte) DateTime.Now.Hour, (byte) DateTime.Now.Minute, (byte) DateTime.Now.Second}, (byte)txtObj.Seq);
                        dledev.GetStream().Write(data, 0, data.Length);
                    }
                }
        }
コード例 #13
0
ファイル: InvitationCode.cs プロジェクト: dkme/moooyo
 public InvitationCode(int inviteCode, String usedMember, String generatedMember, string generatedMemberId, Comm.UsedFlag usedFlag)
 {
     this.CreatedTime = DateTime.Now;
     this.InviteCode = inviteCode;
     if (usedMember != null && usedMember != "")
         this.UsedMember = new Creater.Creater(usedMember);
     else
         this.UsedMember = null;
     if (generatedMember != null && generatedMember != "" && generatedMember != "4eb0fde42101b0824e2b018f") //不等于管理员
         this.GeneratedMember = new Creater.Creater(generatedMember);
     else
         this.GeneratedMember = null;
     this.GeneratedMemberId = generatedMemberId;
     this.UsedFlag = usedFlag;
 }
コード例 #14
0
ファイル: CommentProvider.cs プロジェクト: dkme/moooyo
 /// <summary>
 /// 返回所有回复的集合的数量
 /// </summary>
 /// <param name="deleteFlag">删除状态</param>
 /// <returns>回复集合的数量</returns>
 public static long findAllCount(Comm.DeletedFlag deleteFlag)
 {
     try
     {
         QueryComplete qc = Query.EQ("DeleteFlag", deleteFlag);
         return MongoDBHelper.GetCount(Comment.GetCollectionName(), qc);
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }
コード例 #15
0
 /// <summary>
 /// 添加一条精选内容
 /// </summary>
 /// <param name="featuredContentId">精选内容编号</param>
 /// <param name="usedFlag">使用标记</param>
 /// <returns>精选内容对象</returns>
 public static CBB.ExceptionHelper.OperationResult AddFeaturedContent(String image, String content, String creator, Comm.UsedFlag usedFlag)
 {
     try
     {
         CBB.ExceptionHelper.OperationResult result = null;
         FeaturedContent featContent = new FeaturedContent(image, content, creator, usedFlag);
         result = Add(featContent);
         return result;
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }
コード例 #16
0
ファイル: CommentProvider.cs プロジェクト: dkme/moooyo
 /// <summary>
 /// 按回复对象编号返回回复集合
 /// </summary>
 /// <param name="contentID">回复对象编号</param>
 /// <param name="deleteFlag">删除状态</param>
 /// <param name="pageno">当前页数</param>
 /// <param name="pagesize">每页条数</param>
 /// <returns>回复集合</returns>
 public static IList<Comment> findForContent(String contentID, Comm.DeletedFlag deleteFlag, int pageno, int pagesize)
 {
     try
     {
         QueryComplete qc = Query.And(Query.EQ("CommentToID", contentID), Query.EQ("DeleteFlag", deleteFlag));
         MongoCursor<Comment> mc = MongoDBHelper.GetCursor<Comment>(Comment.GetCollectionName(), qc, new SortByDocument("UpdateTime", -1), pageno, pagesize);
         List<Comment> objs = new List<Comment>();
         objs.AddRange(mc);
         return objs;
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }
コード例 #17
0
ファイル: ImagePushProvider.cs プロジェクト: dkme/moooyo
 /// <summary>
 /// 返回所有的顶部图片推送集合
 /// </summary>
 /// <param name="deleteFlag">删除状态</param>
 /// <param name="pageno">当前页数</param>
 /// <param name="pagesize">每页条数</param>
 /// <returns>顶部图片推送集合</returns>
 public static List<ImagePush> findAll(Comm.DeletedFlag deleteFlag, int pageno, int pagesize)
 {
     try
     {
         QueryComplete qc = Query.EQ("DeleteFlag", deleteFlag);
         MongoCursor<ImagePush> mc = MongoDBHelper.GetCursor<ImagePush>(ImagePush.GetCollectionName(), qc, new SortByDocument("UpdateTime", -1), pageno, pagesize);
         List<ImagePush> objs = new List<ImagePush>();
         objs.AddRange(mc);
         return objs;
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }
コード例 #18
0
ファイル: frmPrint.cs プロジェクト: hjgode/pricemarkdown
        public frmPrint(ref Comm.BT.BTPort btPort, ref System.IO.Ports.SerialPort serPort, int iLang)
        {
            InitializeComponent();
            _iLang = iLang;
            _btPort = btPort;
            _serPort = serPort;

            res = ResClass2.getInstance();
            res.colorizeForm(this);

            lblOldPrice.Text = res._labelsText(ResClass2.frmPrintText.oldPrice, iLang);
            lblNewPrice.Text = res._labelsText(ResClass2.frmPrintText.newPrice, iLang);
            btnPrint.Text = res._labelsText(ResClass2.frmPrintText.printButton, iLang);

            varLabel = res._reducedText(iLang);// getVarLabel(iLang);

            lblCurrencyOld.Text = ResClass2.sCurrency[iLang];
            lblCurrencyNew.Text = ResClass2.sCurrency[iLang];
        }
コード例 #19
0
        /// <summary>
        /// Called every frame from Robot.update() if it's the current state (top of the stack)
        /// </summary>
        /// <param name="r">The robot to update</param>
        public override void update(Robot r)
        {
            bool finished = false;

            ////////////////////////////////////////////////////////////////////////////////////////
            // Initialize variables if necessary when first enter state
            ////////////////////////////////////////////////////////////////////////////////////////
            if (!initialized)
            {
                initialized = true;
                state       = BuildState.WAITING_FOR_INITIALIZATION;

                if (initialCommand.text.StartsWith(MessageBuildStart.TAG))
                {
                    MessageBuildStart msgData;
                    if (MessageBuildStart.TryParse(initialCommand.text, out msgData))
                    {
                        waitQueue = msgData.waitQueue;
                        xMax      = msgData.xMax;
                        xMin      = msgData.xMin;

                        r.pushState(new RobotStateQueue(new Queue <Vector2>(waitQueue), 1.5f));
                        state = BuildState.QUEUING;
                        r.pushState(new RobotStateSleep(2 * r.id));
                    }
                    else
                    {
                        Log.a(LogTag.ROBOT, "Failed to parse " + MessageBuildStart.TAG + " data.");
                        finished = true;
                    }
                }
                else
                {
                    Log.a(LogTag.ROBOT, "Failed to parse initial MessageBuildStart");
                    finished = true;
                }
            }

            ////////////////////////////////////////////////////////////////////////////////////////
            // Reset variables if robot is returning from another state
            ////////////////////////////////////////////////////////////////////////////////////////
            if (resume)
            {
                resume = false;

                switch (state) // resuming from this state
                {
                case BuildState.QUEUING:
                {
                    state = BuildState.FRONT_OF_QUEUE;
                    Comm.directMessage(r.id, Comm.SATELLITE, "build\nrequest_task");
                    break;
                }

                case BuildState.FINISHED:
                {
                    finished = true;
                    break;
                }

                default:
                {
                    break;
                }
                }
            }

            ////////////////////////////////////////////////////////////////////////////////////////
            // Update
            ////////////////////////////////////////////////////////////////////////////////////////

            ////////////////////////////////////////////////////////////////////////////////////////
            // Process messages: TODO
            ////////////////////////////////////////////////////////////////////////////////////////
            int count = r.unhandledMessages.Count;

            for (int i = 0; i < count; ++i)
            {
                bool        handledMessage = false;
                CommMessage msg            = r.unhandledMessages.Dequeue();

                // TODO: this if-block is more repugnant than someone kicking a puppy
                if (msg.text.StartsWith("build"))
                {
                    handledMessage = true;

                    if (msg.text.StartsWith(MessageBuildStart.TAG))
                    {
                        MessageBuildStart msgData;
                        if (MessageBuildStart.TryParse(msg.text, out msgData))
                        {
                            if (state == BuildState.WAITING_FOR_INITIALIZATION)
                            {
                                waitQueue = msgData.waitQueue;
                                xMax      = msgData.xMax;
                                xMin      = msgData.xMin;

                                r.pushState(new RobotStateQueue(new Queue <Vector2>(waitQueue), 1.5f));
                                state = BuildState.QUEUING;
                                r.pushState(new RobotStateSleep(2 * r.id));
                            }
                            else
                            {
                                Log.e(LogTag.ROBOT, "Received " + MessageBuildStart.TAG + " message outside of WAITING_FOR_INITIALIZATION state");
                            }
                        }
                        else
                        {
                            Log.a(LogTag.ROBOT, "Failed to parse " + MessageBuildStart.TAG + " data.");
                        }
                    }
                    else if (msg.text.StartsWith(MessageBuildTask.TAG))
                    {
                        MessageBuildTask msgData;
                        if (MessageBuildTask.TryParse(msg.text, out msgData))
                        {
                            if (state == BuildState.FRONT_OF_QUEUE)
                            {
                                perimeterMax   = new Vector2(xMax.x, msgData.resourcePlacement.y - 4);
                                perimeterMin   = new Vector2(xMin.x, msgData.resourcePlacement.y - 4);
                                perimeterBreak = new Vector2(msgData.resourcePlacement.x, perimeterMax.y);

                                Queue <Vector2> placementToEndPerimeter = new Queue <Vector2>();
                                placementToEndPerimeter.Enqueue(perimeterBreak);
                                placementToEndPerimeter.Enqueue(perimeterMin);

                                Queue <Vector2> startToPlacementPerimeter = new Queue <Vector2>();
                                startToPlacementPerimeter.Enqueue(perimeterMax);
                                startToPlacementPerimeter.Enqueue(perimeterBreak);

                                if (msgData.lastTask)
                                {
                                    r.pushState(new RobotStateMove(new Vector2(r.id * -1.5f, 31)));
                                    state = BuildState.FINISHED;
                                }
                                else
                                {
                                    r.pushState(new RobotStateQueue(new Queue <Vector2>(waitQueue), 2f));
                                    state = BuildState.QUEUING;
                                }

                                r.pushState(new RobotStateMove(xMin));
                                r.pushState(new RobotStateQueue(placementToEndPerimeter, 2f, 0.1f));
                                r.pushState(new RobotStatePlaceResource(msgData.resourcePlacement));
                                r.pushState(new RobotStateQueue(startToPlacementPerimeter, 2f, 0.1f));
                                r.pushState(new RobotStateSendMessage("build\nleft_cache", Comm.SATELLITE));
                                r.pushState(new RobotStateMove(xMax));
                                r.pushState(new RobotStateRetrieveResource(msgData.resourceOrigin));
                            }
                            else
                            {
                                Log.e(LogTag.ROBOT, "Received " + MessageConstructionTask.TAG + " message outside of FRONT_OF_QUEUE state");
                            }
                        }
                        else
                        {
                            Log.a(LogTag.ROBOT, "Failed to parse " + MessageConstructionTask.TAG + " data.");
                        }
                    }
                    else if (msg.text == "build/finished")
                    {
                        r.pushState(new RobotStateMove(new Vector2(r.id * -1.5f, 31)));
                        state = BuildState.FINISHED;
                    }
                    else
                    {
                        Log.a(LogTag.ROBOT, "Unknown build message:\n" + msg.text);
                    }
                }

                if (!handledMessage) // didn't process message, leave for next state
                {
                    r.unhandledMessages.Enqueue(msg);
                }
            }

            ////////////////////////////////////////////////////////////////////////////////////////
            // "Clean up" robot state
            ////////////////////////////////////////////////////////////////////////////////////////
            if (finished)
            {
                Log.d(LogTag.ROBOT, "Robot " + r.id + " has finished build (satellite).");

                // Pop state off the stack
                r.popState();
            }
        }
コード例 #20
0
ファイル: MFCC_VD.cs プロジェクト: ufjl0683/Center
        private string VD20SecToCsvStr(string devName, Comm.TC.VD_MinAvgData data)
        {
            //    RemoteInterface.MFCC.VD1MinCycleEventData Vd1Min = (RemoteInterface.MFCC.VD1MinCycleEventData)objEvent.EventObj;
            System.Data.DataSet ds = data.orgds;
            ds.AcceptChanges();
            String type = ds.Tables[0].Rows[0]["response_type"].ToString().Trim().ToUpper();
            String response_type = String.Empty;
            if (type == "0")
                response_type = "1";
            else
                response_type = "0";

            //string TIMESTAMP = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" +
            //                   ((ds.Tables[0].Rows[0]["day"].ToString().Length == 2) ? ds.Tables[0].Rows[0]["day"].ToString() : "0" + ds.Tables[0].Rows[0]["day"].ToString()) + " " +
            //                   ((ds.Tables[0].Rows[0]["hour"].ToString().Length == 2) ? ds.Tables[0].Rows[0]["hour"].ToString() : "0" + ds.Tables[0].Rows[0]["hour"].ToString()) + ":" +
            //                   ((ds.Tables[0].Rows[0]["minute"].ToString().Length == 2) ? ds.Tables[0].Rows[0]["minute"].ToString() : "0" + ds.Tables[0].Rows[0]["minute"].ToString()) + ":00";
            string TIMESTAMP = "TIMESTAMP('"+Comm.DB2.Db2.getTimeStampString(data.dateTime)+"')";
            int lane_count = data.orgVDLaneData.Length;// Convert.ToInt32(ds.Tables[0].Rows[0]["lane_count"]);
            String[,] myString = new String[14,7];

            for (int i = 0; i < lane_count; i++)
            {

                myString[0, i] = data.orgVDLaneData[i].small_car_volume.ToString();          // Convert.ToString(ds.Tables[1].Rows[i]["small_car_volume"]);
                myString[1, i] = data.orgVDLaneData[i].big_car_volume .ToString() ;    //Convert.ToString(ds.Tables[1].Rows[i]["big_car_volume"]);
                myString[2, i] = data.orgVDLaneData[i].connect_car_volume.ToString();//Convert.ToString(ds.Tables[1].Rows[i]["connect_car_volume"]);
                myString[3, i] = "-1";
                myString[4, i] = data.orgVDLaneData[i].small_car_speed.ToString(); //Convert.ToString(ds.Tables[1].Rows[i]["small_car_speed"]);
                myString[5, i] = data.orgVDLaneData[i].big_car_speed.ToString(); //Convert.ToString(ds.Tables[1].Rows[i]["big_car_speed"]);
                myString[6, i] = data.orgVDLaneData[i].connect_car_speed.ToString();//Convert.ToString(ds.Tables[1].Rows[i]["connect_car_speed"]);
                myString[7, i] = "-1";
                myString[8, i] = data.orgVDLaneData[i].small_car_length.ToString();  // Convert.ToString(ds.Tables[1].Rows[i]["small_car_length"]);
                myString[9, i] = data.orgVDLaneData[i].big_car_length.ToString(); //Convert.ToString(ds.Tables[1].Rows[i]["big_car_length"]);
                myString[10, i] = data.orgVDLaneData[i].connect_car_length.ToString();// Convert.ToString(ds.Tables[1].Rows[i]["connect_car_length"]);
                myString[11, i] = "-1";
                myString[12, i] =  data.orgVDLaneData[i].interval.ToString();//Convert.ToString(ds.Tables[1].Rows[i]["average_car_interval"]);
                myString[13, i] = data.orgVDLaneData[i].occupancy.ToString();//Convert.ToString(ds.Tables[1].Rows[i]["average_occupancy"]);
            }

            String second20 = "";
            second20 += "'"+devName + "'," + TIMESTAMP + ((data.IsValid)?",'V',":",'I'," )+ response_type + ",";
            for(int i=0;i<14;i++)
                for (int j = 0; j < 7; j++)
                {
                    if (myString[i, j] != null)
                        second20 += myString[i, j] + ",";
                    else
                        second20 += "-1,";
                }
                second20 = second20.Substring(0, second20.Length - 1);
                return second20;
        }
コード例 #21
0
ファイル: CommentProvider.cs プロジェクト: dkme/moooyo
 public static IList<Comment> GetMemberNameContentIDComment(String contentID, String memberLable, Comm.DeletedFlag deleteFlag, int pageNo, int pageSize)
 {
     try
     {
         QueryComplete qc = null;
         if (memberLable != "")
         {
             Regex regex;
             regex = new Regex(memberLable, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
             qc = Query.And(Query.EQ("CommentToID", contentID), Query.Matches("Content", regex), Query.EQ("DeleteFlag", deleteFlag));
         }
         else
         {
             qc = Query.And(Query.EQ("CommentToID", contentID), Query.EQ("DeleteFlag", deleteFlag));
         }
         MongoCursor<Comment> mc = MongoDBHelper.GetCursor<Comment>(
             Comment.GetCollectionName(),
             qc,
             new SortByDocument("UpdateTime", -1),
             pageNo,
             pageSize);
         List<Comment> objs = new List<Comment>();
         objs.AddRange(mc);
         return objs;
         }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }
コード例 #22
0
        /// <summary>
        /// Update the linkage status between the core systems and their data connections
        /// </summary>
        private void UpdateCommunicationsLinkages()
        {
            int EMSStatus = 0;



            //First, go through all of our communications links, and show them.
            bool AddedItems = false;

            MM_Communication_Linkage[] Comms = new List <MM_Communication_Linkage>(Data_Integration.Communications.Values).ToArray();
            foreach (MM_Communication_Linkage Comm in Comms)
            {
                if (Comm.CommStatus != null)
                {
                    Comm.UpdateStatus(ref EMSStatus);
                }
                else
                {
                    AddedItems = true;
                    ListViewGroup ThisGroup;
                    if (!Groups.TryGetValue(Comm.Group, out ThisGroup))
                    {
                        Groups.Add(Comm.Group, ThisGroup = lvComm.Groups.Add(Comm.Group, Comm.Group));
                    }

                    Comm.CommStatus             = lvComm.Items.Add(Comm.Name);
                    Comm.CommStatus.Group       = ThisGroup;
                    Comm.CommStatus.ToolTipText = Comm.SCADAName;
                    if (Comm.Name == "Overall")
                    {
                        Comm.CommStatus.Text = Comm.Group;
                    }
                    else if (Comm.Critical)
                    {
                        Comm.CommStatus.Font = new Font(Comm.CommStatus.Font, FontStyle.Bold | FontStyle.Underline);
                        Comm.CommStatus.Text = Comm.Name;
                    }
                    else
                    {
                        Comm.CommStatus.Text = Comm.Name;
                    }
                    Comm.CommStatus.ForeColor = Color.White;
                }
            }

            CommStatus.SetEMSStatus(EMSStatus);


            //Now, if we have new linkages, let's clear everything and redo.
            if (AddedItems)
            {
                using (Graphics g = Graphics.FromHwnd(lvComm.Handle))
                {
                    Size MaxSize = Size.Empty;
                    foreach (MM_Communication_Linkage Comm in Comms)
                    {
                        Size ThisSize = Size.Ceiling(g.MeasureString(Comm.CommStatus.Text, Comm.CommStatus.Font));
                        MaxSize.Width  = Math.Max(MaxSize.Width, ThisSize.Width);
                        MaxSize.Height = Math.Max(MaxSize.Height, ThisSize.Height);
                    }
                    lvComm.TileSize = new Size(MaxSize.Width + 5, MaxSize.Height + 5);
                }
            }

            this.lblServer.Text = "Server: " + MM_Server_Interface.ClientName;
        }
コード例 #23
0
ファイル: MFCC_VD.cs プロジェクト: ufjl0683/Center
 void MFCC_VD_OnFiveMinAvgData(object vdtc, Comm.TC.VD_MinAvgData data)
 {
     try
     {
         if (r_host_comm == null)
             return;
        // lock(this.r_host_comm)
             this.r_host_comm.setVDFiveMinData(data.devName, data.ToVD1MinCycleEventData());
     }
     catch (Exception ex)
     {
         ConsoleServer.WriteLine("HostException!"+ex.Message+ex.StackTrace);
     }
 }
コード例 #24
0
        public ActionResult Index(string userID, int cardID)
        {
            if (!db.Users.Any(s => s.Id == userID))
            {
                return(Json(Comm.ToJsonResult("UserNoFound", "用户不存在"), JsonRequestBehavior.AllowGet));
            }
            var card = db.Cards.FirstOrDefault(s => s.ID == cardID && s.Enable && s.EnterpriseID.HasValue);

            if (card == null)
            {
                return(Json(Comm.ToJsonResult("CardNoFound", "卡片不存在或卡片不是企业"), JsonRequestBehavior.AllowGet));
            }
            var ent    = db.Enterprises.FirstOrDefault(s => s.ID == card.EnterpriseID);
            var models = db.HomePageModulars
                         .Where(s => s.EnterpriseID == card.EnterpriseID)
                         .OrderBy(s => s.Sort)
                         .ToList();
            var modulars = models.Select(s =>
            {
                object item;
                switch (s.Type)
                {
                default:
                case HomePageModularType.Html:
                    item = new
                    {
                        Title   = s.Title,
                        Content = s.Content,
                        Type    = s.Type,
                    };
                    break;

                case HomePageModularType.Banner:
                case HomePageModularType.Images:
                    item = new
                    {
                        Title   = s.Title,
                        Content = s.Content.SplitToArray <string>(),
                        Type    = s.Type,
                    };
                    break;

                case HomePageModularType.Contact:
                    item = new
                    {
                        Title   = s.Title,
                        Content = new
                        {
                            Phone   = ent.PhoneNumber,
                            Email   = ent.Email,
                            Address = new
                            {
                                Name = $"{ent.Province}{ent.City}{ent.District}{ent.Address}",
                                Lat  = ent.Lat,
                                Lng  = ent.Lng
                            }
                        },
                        Type = s.Type
                    };
                    break;
                }
                return(item);
            });

            return(Json(Comm.ToJsonResult("Success", "成功", modulars), JsonRequestBehavior.AllowGet));
        }
コード例 #25
0
        public ActionResult GetCardInfo(int?pCardID, string userID)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(userID))
                {
                    return(Json(Comm.ToJsonResult("Error", "UserID为空"), JsonRequestBehavior.AllowGet));
                }
                var query = (from c in db.CardPersonals
                             where c.Enable
                             select c);
                if (pCardID.HasValue)
                {
                    query = query.Where(s => s.ID == pCardID);
                }
                else
                {
                    query = query.Where(s => s.UserID == userID);
                }

                var card = query.FirstOrDefault();

                if (card == null)
                {
                    var user = db.Users.FirstOrDefault(s => s.Id == userID);
                    if (user == null)
                    {
                        return(Json(Comm.ToJsonResult("UserNoFound", "用户不出在"), JsonRequestBehavior.AllowGet));
                    }
                    return(Json(Comm.ToJsonResult("PCardNoFound", "名片不存在", new
                    {
                        user.Avatar,
                        Name = user.NickName,
                        UserID = user.Id
                    }), JsonRequestBehavior.AllowGet));
                }
                pCardID = card.ID;
                if (card.UserID != userID)
                {
                    Bll.UserLogs.Add(new UserLog
                    {
                        UserID       = userID,
                        RelationID   = card.ID,
                        TargetUserID = card.UserID,
                        Type         = Common.Enums.UserLogType.CardPersonalRead
                    });
                }
                db   = new ApplicationDbContext();
                card = db.CardPersonals.FirstOrDefault(s => s.ID == card.ID);
                var vip       = db.Vips.FirstOrDefault(s => s.CardID == pCardID);
                var likeCount = db.UserLogs
                                .Count(s => s.Type == Common.Enums.UserLogType.CardPersonalLike &&
                                       s.RelationID == pCardID);
                var hadLike = db.UserLogs.Any(s => s.RelationID == pCardID &&
                                              s.Type == Common.Enums.UserLogType.CardPersonalLike &&
                                              s.UserID == userID);
                //获取最近访问的12个人头像
                var leastUsers = (from l in db.UserLogs
                                  from u in db.Users
                                  where l.Type == Common.Enums.UserLogType.CardPersonalRead &&
                                  l.RelationID == card.ID &&
                                  u.Id == l.UserID
                                  select new
                {
                    UserID = u.Id,
                    u.Avatar,
                    l.CreateDateTime
                }).GroupBy(s => new { s.UserID, s.Avatar })
                                 .Select(s => new
                {
                    s.Key.UserID,
                    s.Key.Avatar,
                    CreateDateTime = s.Max(x => x.CreateDateTime)
                })
                                 .OrderByDescending(s => s.CreateDateTime)
                                 .Take(12)
                                 .ToList();
                var notifyCount = db.WeChatMiniNotifyForms.Count(s => s.UserID == userID && s.EndDateTime > DateTime.Now);
                var data        = new
                {
                    card.Name,
                    card.Avatar,
                    card.Position,
                    Phone = card.PhoneNumber,
                    card.Mobile,
                    card.Email,
                    card.WeChatCode,
                    card.Remark,
                    Video = Url.ContentNullEmpty(card.Video),
                    card.Voice,
                    VideoThumbnail = string.IsNullOrWhiteSpace(card.Video) ? null : Comm.ResizeImage(card.Video),
                    card.Info,
                    card.Industry,
                    Images         = card.Images.SplitToArray <string>() ?? new List <string>(),
                    PCardID        = card.ID,
                    EnterpriseName = card.Enterprise,
                    card.Address,
                    card.City,
                    card.District,
                    card.Province,
                    FullAddress      = $"{card.Province}{card.City}{card.District}{card.Address}",
                    Lat              = card.Lat,
                    Lng              = card.Lng,
                    Poster           = Comm.ResizeImage(card.Poster),
                    WeChatMiniQrCode = Comm.ResizeImage(card.WeChatMiniQrCode),
                    Age              = card.Birthday.GetAgeForBirthday(),
                    card.Gender,
                    Birthday    = card.Birthday?.ToString("yyyy-MM-dd"),
                    Code        = vip.Code,
                    Type        = vip.Type,
                    Viewers     = leastUsers.Select(s => s.Avatar).ToList(),
                    LikeCount   = likeCount,
                    HadLike     = hadLike,
                    NotifyCount = notifyCount,
                    ViewCount   = card.View
                };

                return(Json(Comm.ToJsonResult("Success", "成功", data), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(Comm.ToJsonResult("Error", ex.Message), JsonRequestBehavior.AllowGet));
            }
        }
コード例 #26
0
    private KFB_BASEBALL GetKFB_BASEBALL(string s_aCBXH)
    {
        KFB_BASEBALL mo_KFB_BASEBALL = new KFB_BASEBALL();

        mo_KFB_BASEBALL.N_RF_LOCK_V       = 0;
        mo_KFB_BASEBALL.N_RF_LOCK_H       = 0;
        mo_KFB_BASEBALL.N_DX_LOCK_V       = 0;
        mo_KFB_BASEBALL.N_DX_LOCK_H       = 0;
        mo_KFB_BASEBALL.N_DY_LOCK_V       = 0;
        mo_KFB_BASEBALL.N_DY_LOCK_H       = 0;
        mo_KFB_BASEBALL.N_SY_LOCK_V       = 0;
        mo_KFB_BASEBALL.N_SY_LOCK_H       = 0;
        mo_KFB_BASEBALL.N_DS_LOCK_V       = 0;
        mo_KFB_BASEBALL.N_DS_LOCK_H       = 0;
        mo_KFB_BASEBALL.N_VISIT_RESULT    = 0;
        mo_KFB_BASEBALL.N_HOME_RESULT     = 0;
        mo_KFB_BASEBALL.N_REMARK          = "";
        mo_KFB_BASEBALL.N_SF9J            = 0; //0:打滿九局 1:未滿九局
        mo_KFB_BASEBALL.N_SFDS            = 0; //新比賽是否移至單式0:否 1:是
        mo_KFB_BASEBALL.N_SFGP            = 0; //0:不跟盤 1:跟盤
        mo_KFB_BASEBALL.N_UP_VISIT_RESULT = 0; //上半場客隊結果比賽結果
        mo_KFB_BASEBALL.N_UP_HOME_RESULT  = 0; //上半場主隊結果比賽結果
        mo_KFB_BASEBALL.N_SFXZ            = 0; //會員是否下注,0:關閉會員下注 1:開放會員下注(走地) 2:開放會員下注(單式)
        mo_KFB_BASEBALL.N_XZZT            = 0; //0:移至未開賽(單式or走地) 1:移至已開賽
        mo_KFB_BASEBALL.N_LOCK            = 0; //0:不鎖定 1:強制鎖定
        mo_KFB_BASEBALL.N_SAMETEAM        = hidTeam.Value;
        GameCalculationDB o_KFB_BASEBALL_BLL = new GameCalculationDB();

        if (this.hidMode.Value.Equals("Modify"))
        {
            mo_KFB_BASEBALL = o_KFB_BASEBALL_BLL.GetModel(Convert.ToInt32(this.hidN_ID.Value));
        }
        if (!this.hidN_ID.Value.Equals("-1"))
        {
            mo_KFB_BASEBALL.N_ID = Convert.ToInt32(this.hidN_ID.Value);
        }
        else
        {
            mo_KFB_BASEBALL.N_ID = Convert.ToInt32(Comm.GetNO());
        }
        mo_KFB_BASEBALL.N_LX       = ms_TYPE;
        mo_KFB_BASEBALL.N_CBXH     = Convert.ToInt32(s_aCBXH);
        mo_KFB_BASEBALL.N_ZWDATE   = Convert.ToDateTime(this.drpZWYear.Value + "/" + this.drpZWMonth.Value + "/" + this.drpZWDay.Value);
        mo_KFB_BASEBALL.N_GAMEDATE = Convert.ToDateTime(this.drpBSYear.Value + "/" + this.drpBSMonth.Value + "/" + this.drpBSDay.Value).AddHours(double.Parse(this.drpBSHour.Value)).AddMinutes(double.Parse(this.drpBSMinute.Value));
        mo_KFB_BASEBALL.N_LMNO     = Convert.ToInt32(Request.Form["hidLM"]);
        mo_KFB_BASEBALL.N_VISIT    = Convert.ToInt32(Request.Form["hidVisit"]);
        mo_KFB_BASEBALL.N_HOME     = Convert.ToInt32(Request.Form["hidHome"]);
        if (this.rdoVisit.Checked)
        {
            mo_KFB_BASEBALL.N_VH = mo_KFB_BASEBALL.N_VISIT;
        }
        else if (this.rdoHome.Checked)
        {
            mo_KFB_BASEBALL.N_VH = mo_KFB_BASEBALL.N_HOME;
        }
        else
        {
            mo_KFB_BASEBALL.N_VH = 0;
        }
        mo_KFB_BASEBALL.N_SFZD      = Convert.ToInt32(this.rdoZD.SelectedValue);//0:不開走地 1:開走地 2:走地中
        mo_KFB_BASEBALL.N_VISIT_NO  = Convert.ToInt32(this.txtVisitNo.Text);
        mo_KFB_BASEBALL.N_HOME_NO   = Convert.ToInt32(this.txtHomeNo.Text);
        mo_KFB_BASEBALL.N_TSA       = this.txtVisitTSNo.Text;
        mo_KFB_BASEBALL.N_TSB       = this.txtHomeTSNo.Text;
        mo_KFB_BASEBALL.N_VISIT_JZF = Convert.ToInt32(this.txtVisitJZF.Text);
        mo_KFB_BASEBALL.N_HOME_JZF  = Convert.ToInt32(this.txtHomeJZF.Text);
        mo_KFB_BASEBALL.N_SFJZF     = Convert.ToInt32(this.rdoOpenJZF.SelectedValue);
        mo_KFB_BASEBALL.N_ZBXH      = Convert.ToInt32(this.drpZBName.SelectedValue);
        mo_KFB_BASEBALL.N_HYDZSX    = Convert.ToDecimal(this.txtDZSX.Text);
        mo_KFB_BASEBALL.N_HYDCSX    = Convert.ToDecimal(this.txtDCSX.Text);
        mo_KFB_BASEBALL.N_RFFS      = Convert.ToDecimal(this.drpRFFS.Value);
        mo_KFB_BASEBALL.N_RFLX      = Convert.ToInt32(this.drpRFLX.Value);
        mo_KFB_BASEBALL.N_RFBL      = Convert.ToInt32(this.txtRFBL.Value);
        mo_KFB_BASEBALL.N_LRFPL     = Convert.ToDecimal(this.txtLRFPL.Value);
        mo_KFB_BASEBALL.N_RRFPL     = Convert.ToDecimal(this.txtRRFPL.Value);
        mo_KFB_BASEBALL.N_LRFCJ     = Convert.ToDecimal(this.drpLRFCJ.Value);
        mo_KFB_BASEBALL.N_RRFCJ     = Convert.ToDecimal(this.drpRRFCJ.Value);
        mo_KFB_BASEBALL.N_LRFSX     = Convert.ToDecimal(this.txtLRFSX.Value);
        mo_KFB_BASEBALL.N_RRFSX     = Convert.ToDecimal(this.txtRRFSX.Value);
        mo_KFB_BASEBALL.N_RFCJJE    = Convert.ToDecimal(this.txtRFCJJE.Value);
        mo_KFB_BASEBALL.N_RFCJFS    = Convert.ToInt32(this.drpRFCJFS.Value);
        if (this.drpRFCJFS.Value.Equals("0"))
        {
            mo_KFB_BASEBALL.N_RFCJPL = Convert.ToDecimal(this.drpRFCJPL.Value);
        }
        else
        {
            mo_KFB_BASEBALL.N_RFCJPL = Convert.ToDecimal(this.drpRFCJPL1.Value);
        }
        mo_KFB_BASEBALL.N_DXFS   = Convert.ToDecimal(this.drpDXFS.Value);
        mo_KFB_BASEBALL.N_DXLX   = Convert.ToInt32(this.drpDXLX.Value);
        mo_KFB_BASEBALL.N_DXBL   = Convert.ToInt32(this.txtDXBL.Value);
        mo_KFB_BASEBALL.N_DXDPL  = Convert.ToDecimal(this.txtDXDPL.Value);
        mo_KFB_BASEBALL.N_DXXPL  = Convert.ToDecimal(this.txtDXXPL.Value);
        mo_KFB_BASEBALL.N_DXDCJ  = Convert.ToDecimal(this.drpDXDCJ.Value);
        mo_KFB_BASEBALL.N_DXXCJ  = Convert.ToDecimal(this.drpDXXCJ.Value);
        mo_KFB_BASEBALL.N_DXDCSX = 0;
        mo_KFB_BASEBALL.N_LDXSX  = Convert.ToDecimal(this.txtLDXSX.Value);
        mo_KFB_BASEBALL.N_RDXSX  = Convert.ToDecimal(this.txtRDXSX.Value);
        mo_KFB_BASEBALL.N_DXCJ   = Convert.ToDecimal(this.txtDXCJ.Value);
        mo_KFB_BASEBALL.N_DXCJPL = Convert.ToDecimal(this.drpDXCJPL.Value);
        if ((this.chkLet.Value.Equals("0") && this.chkLet.Checked) || (this.chkLet.Value.Equals("1") && !this.chkLet.Checked))
        {
            mo_KFB_BASEBALL.N_LDYPL = Convert.ToDecimal(this.txtRDYPL.Value);
            mo_KFB_BASEBALL.N_RDYPL = Convert.ToDecimal(this.txtLDYPL.Value);
        }
        else
        {
            mo_KFB_BASEBALL.N_LDYPL = Convert.ToDecimal(this.txtLDYPL.Value);
            mo_KFB_BASEBALL.N_RDYPL = Convert.ToDecimal(this.txtRDYPL.Value);
        }
        mo_KFB_BASEBALL.N_LDYCJ  = Convert.ToDecimal(this.drpLDYCJ.Value);
        mo_KFB_BASEBALL.N_RDYCJ  = Convert.ToDecimal(this.drpRDYCJ.Value);
        mo_KFB_BASEBALL.N_LDYSX  = Convert.ToDecimal(this.txtLDYSX.Value);
        mo_KFB_BASEBALL.N_RDYSX  = Convert.ToDecimal(this.txtRDYSX.Value);
        mo_KFB_BASEBALL.N_DYCJ   = Convert.ToDecimal(this.txtDYCJ.Value);
        mo_KFB_BASEBALL.N_DYCJPL = Convert.ToDecimal(this.drpDYCJPL.Value);
        //if ((this.chkLet.Value.Equals("0") && this.chkLet.Checked) || (this.chkLet.Value.Equals("1") && !this.chkLet.Checked))
        //{
        //    mo_KFB_BASEBALL.N_LSYPL = Convert.ToDecimal(this.txtRSYPL.Value);
        //    mo_KFB_BASEBALL.N_RSYPL = Convert.ToDecimal(this.txtLSYPL.Value);
        //}
        //else
        //{
        //    mo_KFB_BASEBALL.N_LSYPL = Convert.ToDecimal(this.txtLSYPL.Value);
        //    mo_KFB_BASEBALL.N_RSYPL = Convert.ToDecimal(this.txtRSYPL.Value);
        //}
        //mo_KFB_BASEBALL.N_LSYCJ = Convert.ToDecimal(this.drpLSYCJ.Value);
        //mo_KFB_BASEBALL.N_RSYCJ = Convert.ToDecimal(this.drpRSYCJ.Value);
        //mo_KFB_BASEBALL.N_LSYSX = Convert.ToDecimal(this.txtLSYSX.Value);
        //mo_KFB_BASEBALL.N_RSYSX = Convert.ToDecimal(this.txtRSYSX.Value);
        //mo_KFB_BASEBALL.N_SYCJ = Convert.ToDecimal(this.txtSYCJ.Value);
        //mo_KFB_BASEBALL.N_SYCJPL = Convert.ToDecimal(this.drpSYCJPL.Value);
        mo_KFB_BASEBALL.N_LSYPL  = 0;
        mo_KFB_BASEBALL.N_RSYPL  = 0;
        mo_KFB_BASEBALL.N_LSYCJ  = 0;
        mo_KFB_BASEBALL.N_RSYCJ  = 0;
        mo_KFB_BASEBALL.N_LSYSX  = 0;
        mo_KFB_BASEBALL.N_RSYSX  = 0;
        mo_KFB_BASEBALL.N_SYCJ   = 0;
        mo_KFB_BASEBALL.N_SYCJPL = 0;

        mo_KFB_BASEBALL.N_DSDPL   = Convert.ToDecimal(this.txtDSDPL.Value);
        mo_KFB_BASEBALL.N_DSSPL   = Convert.ToDecimal(this.txtDSSPL.Value);
        mo_KFB_BASEBALL.N_DSDCJ   = Convert.ToDecimal(this.drpDSDCJ.Value);
        mo_KFB_BASEBALL.N_DSSCJ   = Convert.ToDecimal(this.drpDSSCJ.Value);
        mo_KFB_BASEBALL.N_DSDCSX  = 0;
        mo_KFB_BASEBALL.N_LDSSX   = Convert.ToDecimal(this.txtLDSSX.Value);
        mo_KFB_BASEBALL.N_RDSSX   = Convert.ToDecimal(this.txtRDSSX.Value);
        mo_KFB_BASEBALL.N_DSCJ    = Convert.ToDecimal(this.txtDSCJ.Value);
        mo_KFB_BASEBALL.N_DSCJPL  = Convert.ToDecimal(this.drpDSCJPL.Value);
        mo_KFB_BASEBALL.N_LET     = this.chkLet.Checked ? 1 : 0;     //讓分互換
        mo_KFB_BASEBALL.N_RF_OPEN = this.chkRFClose.Checked ? 1 : 0; //讓分關閉
        mo_KFB_BASEBALL.N_DX_OPEN = this.chkDXClose.Checked ? 1 : 0;
        mo_KFB_BASEBALL.N_DY_OPEN = this.chkDYClose.Checked ? 1 : 0;
        mo_KFB_BASEBALL.N_SY_OPEN = 0;
        mo_KFB_BASEBALL.N_DS_OPEN = this.chkDSClose.Checked ? 1 : 0;

        mo_KFB_BASEBALL.N_RQ_OPEN  = this.chkRQClose.Checked ? 1 : 0;
        mo_KFB_BASEBALL.N_BD_OPEN  = this.chkBDClose.Checked ? 1 : 0;
        mo_KFB_BASEBALL.N_BQC_OPEN = this.chkBQCClose.Checked ? 1 : 0;


        mo_KFB_BASEBALL.N_RF_GG = this.chkRFGGClose.Checked ? 1 : 0;
        mo_KFB_BASEBALL.N_DX_GG = this.chkDXGGClose.Checked ? 1 : 0;
        mo_KFB_BASEBALL.N_DY_GG = this.chkDYGGClose.Checked ? 1 : 0;
        mo_KFB_BASEBALL.N_SY_GG = 0;
        mo_KFB_BASEBALL.N_DS_GG = this.chkDSGGClose.Checked ? 1 : 0;

        mo_KFB_BASEBALL.N_BDGPL00 = Convert.ToDecimal(this.txt00.Text);
        mo_KFB_BASEBALL.N_BDGPL11 = Convert.ToDecimal(this.txt11.Text);
        mo_KFB_BASEBALL.N_BDGPL22 = Convert.ToDecimal(this.txt22.Text);
        mo_KFB_BASEBALL.N_BDGPL33 = Convert.ToDecimal(this.txt33.Text);
        mo_KFB_BASEBALL.N_BDGPL44 = Convert.ToDecimal(this.txt44.Text);
        mo_KFB_BASEBALL.N_BDKPL10 = Convert.ToDecimal(this.txtkc10.Text);
        mo_KFB_BASEBALL.N_BDKPL20 = Convert.ToDecimal(this.txtkc20.Text);
        mo_KFB_BASEBALL.N_BDKPL21 = Convert.ToDecimal(this.txtkc21.Text);
        mo_KFB_BASEBALL.N_BDKPL30 = Convert.ToDecimal(this.txtkc30.Text);
        mo_KFB_BASEBALL.N_BDKPL31 = Convert.ToDecimal(this.txtkc31.Text);
        mo_KFB_BASEBALL.N_BDKPL32 = Convert.ToDecimal(this.txtkc32.Text);
        mo_KFB_BASEBALL.N_BDKPL40 = Convert.ToDecimal(this.txtkc40.Text);
        mo_KFB_BASEBALL.N_BDKPL41 = Convert.ToDecimal(this.txtkc41.Text);
        mo_KFB_BASEBALL.N_BDKPL42 = Convert.ToDecimal(this.txtkc42.Text);
        mo_KFB_BASEBALL.N_BDKPL43 = Convert.ToDecimal(this.txtkc43.Text);
        mo_KFB_BASEBALL.N_BDKPL5  = Convert.ToDecimal(this.txtkc5.Text);
        mo_KFB_BASEBALL.N_BDZPL10 = Convert.ToDecimal(this.txtzc10.Text);
        mo_KFB_BASEBALL.N_BDZPL20 = Convert.ToDecimal(this.txtzc20.Text);
        mo_KFB_BASEBALL.N_BDZPL21 = Convert.ToDecimal(this.txtzc21.Text);
        mo_KFB_BASEBALL.N_BDZPL30 = Convert.ToDecimal(this.txtzc30.Text);
        mo_KFB_BASEBALL.N_BDZPL31 = Convert.ToDecimal(this.txtzc31.Text);
        mo_KFB_BASEBALL.N_BDZPL32 = Convert.ToDecimal(this.txtzc32.Text);
        mo_KFB_BASEBALL.N_BDZPL40 = Convert.ToDecimal(this.txtzc40.Text);
        mo_KFB_BASEBALL.N_BDZPL41 = Convert.ToDecimal(this.txtzc41.Text);
        mo_KFB_BASEBALL.N_BDZPL42 = Convert.ToDecimal(this.txtzc42.Text);
        mo_KFB_BASEBALL.N_BDZPL43 = Convert.ToDecimal(this.txtzc43.Text);
        mo_KFB_BASEBALL.N_BDZPL5  = Convert.ToDecimal(this.txtzc5.Text);
        mo_KFB_BASEBALL.N_BDSX    = Convert.ToDecimal(this.txtbdsx.Text);

        mo_KFB_BASEBALL.N_BQCHH = Convert.ToDecimal(this.txtbqchh.Text);
        mo_KFB_BASEBALL.N_BQCHK = Convert.ToDecimal(this.txtbqchk.Text);
        mo_KFB_BASEBALL.N_BQCHZ = Convert.ToDecimal(this.txtbqchz.Text);
        mo_KFB_BASEBALL.N_BQCKH = Convert.ToDecimal(this.txtbqckh.Text);
        mo_KFB_BASEBALL.N_BQCKK = Convert.ToDecimal(this.txtbqckk.Text);
        mo_KFB_BASEBALL.N_BQCKZ = Convert.ToDecimal(this.txtbqckz.Text);
        mo_KFB_BASEBALL.N_BQCZH = Convert.ToDecimal(this.txtbqczh.Text);
        mo_KFB_BASEBALL.N_BQCZK = Convert.ToDecimal(this.txtbqczk.Text);
        mo_KFB_BASEBALL.N_BQCZZ = Convert.ToDecimal(this.txtbqczz.Text);
        mo_KFB_BASEBALL.N_BQCSX = Convert.ToDecimal(this.txtbqcsx.Text);

        mo_KFB_BASEBALL.N_RQSPL01 = Convert.ToDecimal(this.txtrqs01.Text);
        mo_KFB_BASEBALL.N_RQSPL23 = Convert.ToDecimal(this.txtrqs23.Text);
        mo_KFB_BASEBALL.N_RQSPL46 = Convert.ToDecimal(this.txtrqs46.Text);
        mo_KFB_BASEBALL.N_RQSPL7  = Convert.ToDecimal(this.txtrqs7.Text);
        mo_KFB_BASEBALL.N_RQSSX   = Convert.ToDecimal(this.txtrqssx.Text);

        mo_KFB_BASEBALL.N_HJPL   = Convert.ToDecimal(this.txtN_HJPL.Value);
        mo_KFB_BASEBALL.N_HJGGCJ = Convert.ToDecimal(this.drpN_HJGGCJ.Value);
        mo_KFB_BASEBALL.N_HJSX   = Convert.ToDecimal(this.txtN_HJSX.Value);

        return(mo_KFB_BASEBALL);
    }
コード例 #27
0
ファイル: ZcDetail3.aspx.cs プロジェクト: sinyuewh/CJZC2007
    //绑定当前资产-处置申报情况(包括处置方式)
    private void BindData()
    {
        if (Request["id"] != null)
        {
            string id  = Request["id"];
            U_ZCBU zc1 = new U_ZCBU();

            //////////////////////////////////////////
            Hashtable ht = zc1.GetCurrentZcCZbyID(id);
            if (ht.Count > 0)
            {
                this.danwei.Text = ht["danwei"].ToString();
                if (ht["depart"] != null)
                {
                    this.depart.Text = ht["depart"].ToString();
                }
                if (ht["zeren"] != null)
                {
                    this.zeren.Text = ht["zeren"].ToString();
                }
                if (ht["zcstatus"] != null)
                {
                    this.status.Text = ht["zcstatus"].ToString();
                }
                if (ht["statustext"] != null)
                {
                    this.statusText.Text = ht["statustext"].ToString();
                }
                if (this.statusText.Text == "")
                {
                    this.statusText.Text = "阅卷";
                }
                if (ht["xmsbh"] != null)
                {
                    this.xmsbh.Text = ht["xmsbh"].ToString();
                }

                //根据权限显示信息
                int status1 = 0;
                if (this.status.Text != "")
                {
                    status1 = Int32.Parse(this.status.Text);
                }

                string[] arr1 = new string[] { "zclx", "zcse", "xmbj", "fsxzly", "djyj", "zcczid" };
                for (int i = 0; i < arr1.Length; i++)
                {
                    if (ht[arr1[i]] != null)
                    {
                        Util.SetControlValue(this.zclx.Parent.FindControl(arr1[i]), ht[arr1[i]].ToString());
                        Util.SetControlValue(this.zclx.Parent.FindControl(arr1[i] + "_1"), Util.ChangeToShow(ht[arr1[i]].ToString()));
                    }
                    if (this.owner && status1 == (int)SP.开始审批)
                    {
                        this.zclx.Parent.FindControl(arr1[i] + "_1").Visible = false;
                    }
                    else
                    {
                        this.zclx.Parent.FindControl(arr1[i]).Visible = false;
                    }
                    if (Comm.IsRole("系统管理员"))
                    {
                        this.zclx.Parent.FindControl(arr1[i]).Visible        = true;
                        this.zclx.Parent.FindControl(arr1[i] + "_1").Visible = false;
                    }
                }
                ////////////////////////////////////////////

                this.zclx.Parent.FindControl("zcczid").Visible = true;
                this.BindZCCZDetail(zc1);
            }

            zc1.Close();
            this.SetButton();   //设置按钮的权限
        }
    }
コード例 #28
0
ファイル: Tds70.cs プロジェクト: rinaahmed/mono
        private void WriteParameterInfo(TdsMetaParameter param)
        {
            /*
             * Ms.net send non-nullable datatypes as nullable and allows setting null values
             * to int/float etc.. So, using Nullable form of type for all data
             */
            param.IsNullable = true;
            TdsColumnType colType = param.GetMetaType();

            param.IsNullable = false;

            bool partLenType = false;
            int  size        = param.Size;

            if (size < 1)
            {
                if (size < 0)
                {
                    partLenType = true;
                }
                size = param.GetActualSize();
            }

            /*
             * If the value is null, not setting the size to 0 will cause varchar
             * fields to get inserted as an empty string rather than an null.
             */
            if (param.Value == null || param.Value == DBNull.Value)
            {
                size = 0;
            }

            // Change colType according to the following table

            /*
             * Original Type	Maxlen		New Type
             *
             * NVarChar		4000 UCS2	NText
             * BigVarChar		8000 ASCII	Text
             * BigVarBinary		8000 bytes	Image
             *
             */
            TdsColumnType origColType = colType;

            if (colType == TdsColumnType.BigNVarChar)
            {
                // param.GetActualSize() returns len*2
                if (size == param.Size)
                {
                    size <<= 1;
                }
                if ((size >> 1) > 4000)
                {
                    colType = TdsColumnType.NText;
                }
            }
            else if (colType == TdsColumnType.BigVarChar)
            {
                if (size > 8000)
                {
                    colType = TdsColumnType.Text;
                }
            }
            else if (colType == TdsColumnType.BigVarBinary)
            {
                if (size > 8000)
                {
                    colType = TdsColumnType.Image;
                }
            }
            // Calculation of TypeInfo field

            /*
             * orig size value		TypeInfo field
             *
             * >= 0 <= Maxlen		origColType + content len
             * > Maxlen		NewType as per above table + content len
             * -1		origColType + USHORTMAXLEN (0xFFFF) + content len (TDS 9)
             *
             */
            // Write updated colType, iff partLenType == false
            if (TdsVersion > TdsVersion.tds81 && partLenType)
            {
                Comm.Append((byte)origColType);
                Comm.Append((short)-1);
            }
            else if (ServerTdsVersion > TdsVersion.tds70 &&
                     origColType == TdsColumnType.Decimal)
            {
                Comm.Append((byte)TdsColumnType.Numeric);
            }
            else
            {
                Comm.Append((byte)colType);
            }

            if (IsLargeType(colType))
            {
                Comm.Append((short)size);                  // Parameter size passed in SqlParameter
            }
            else if (IsBlobType(colType))
            {
                Comm.Append(size);                  // Parameter size passed in SqlParameter
            }
            else
            {
                Comm.Append((byte)size);
            }

            // Precision and Scale are non-zero for only decimal/numeric
            if (param.TypeName == "decimal" || param.TypeName == "numeric")
            {
                Comm.Append((param.Precision != 0) ? param.Precision : Precision);
                Comm.Append(param.Scale);
                // Convert the decimal value according to Scale
                if (param.Value != null && param.Value != DBNull.Value &&
                    ((decimal)param.Value) != Decimal.MaxValue &&
                    ((decimal)param.Value) != Decimal.MinValue &&
                    ((decimal)param.Value) != long.MaxValue &&
                    ((decimal)param.Value) != long.MinValue &&
                    ((decimal)param.Value) != ulong.MaxValue &&
                    ((decimal)param.Value) != ulong.MinValue)
                {
                    long expo = (long)new Decimal(System.Math.Pow(10, (double)param.Scale));
                    long pVal = (long)(((decimal)param.Value) * expo);
                    param.Value = pVal;
                }
            }


            /* VARADHAN: TDS 8 Debugging */

            /*
             * if (Collation != null) {
             *      Console.WriteLine ("Collation is not null");
             *      Console.WriteLine ("Column Type: {0}", colType);
             *      Console.WriteLine ("Collation bytes: {0} {1} {2} {3} {4}", Collation[0], Collation[1], Collation[2],
             *                         Collation[3], Collation[4]);
             * } else {
             *      Console.WriteLine ("Collation is null");
             * }
             */

            // Tds > 7.0 uses collation
            if (Collation != null &&
                (colType == TdsColumnType.BigChar || colType == TdsColumnType.BigNVarChar ||
                 colType == TdsColumnType.BigVarChar || colType == TdsColumnType.NChar ||
                 colType == TdsColumnType.NVarChar || colType == TdsColumnType.Text ||
                 colType == TdsColumnType.NText))
            {
                Comm.Append(Collation);
            }

            // LAMESPEC: size should be 0xFFFF for any bigvarchar, bignvarchar and bigvarbinary
            // types if param value is NULL
            if ((colType == TdsColumnType.BigVarChar ||
                 colType == TdsColumnType.BigNVarChar ||
                 colType == TdsColumnType.BigVarBinary ||
                 colType == TdsColumnType.Image) &&
                (param.Value == null || param.Value == DBNull.Value))
            {
                size = -1;
            }
            else
            {
                size = param.GetActualSize();
            }

            if (IsLargeType(colType))
            {
                Comm.Append((short)size);
            }
            else if (IsBlobType(colType))
            {
                Comm.Append(size);
            }
            else
            {
                Comm.Append((byte)size);
            }

            if (size > 0)
            {
                switch (param.TypeName)
                {
                case "money": {
                    // 4 == SqlMoney::MoneyFormat.NumberDecimalDigits
                    Decimal val = Decimal.Round((decimal)param.Value, 4);
                    int[]   arr = Decimal.GetBits(val);

                    if (val >= 0)
                    {
                        Comm.Append(arr[1]);
                        Comm.Append(arr[0]);
                    }
                    else
                    {
                        Comm.Append(~arr[1]);
                        Comm.Append(~arr[0] + 1);
                    }
                    break;
                }

                case "smallmoney": {
                    // 4 == SqlMoney::MoneyFormat.NumberDecimalDigits
                    Decimal val = Decimal.Round((decimal)param.Value, 4);
                    if (val < SMALLMONEY_MIN || val > SMALLMONEY_MAX)
                    {
                        throw new OverflowException(string.Format(
                                                        CultureInfo.InvariantCulture,
                                                        "Value '{0}' is not valid for SmallMoney."
                                                        + "  Must be between {1:N4} and {2:N4}.",
#if NET_2_0
                                                        val,
#else
                                                        val.ToString(CultureInfo.CurrentCulture),
#endif
                                                        SMALLMONEY_MIN, SMALLMONEY_MAX));
                    }

                    int[] arr  = Decimal.GetBits(val);
                    int   sign = (val > 0 ? 1: -1);
                    Comm.Append(sign * arr[0]);
                    break;
                }

                case "datetime":
                    Comm.Append((DateTime)param.Value, 8);
                    break;

                case "smalldatetime":
                    Comm.Append((DateTime)param.Value, 4);
                    break;

                case "varchar":
                case "nvarchar":
                case "char":
                case "nchar":
                case "text":
                case "ntext":
                    byte [] tmp = param.GetBytes();
                    Comm.Append(tmp);
                    break;

                case "uniqueidentifier":
                    Comm.Append(((Guid)param.Value).ToByteArray());
                    break;

                default:
                    Comm.Append(param.Value);
                    break;
                }
            }
            return;
        }
コード例 #29
0
    //删除邮件
    protected void Button1_Click(object sender, EventArgs e)
    {
        ZX_Email1BU emal1 = new ZX_Email1BU();
        string      id    = Request.QueryString["id"];
        DataSet     ds1   = emal1.GetSendMail(id);
        string      file1 = ds1.Tables[0].Rows[0]["file1"].ToString();

        if (file1 != "" && file1 != null)
        {
            ZX_EmailBu email1 = new ZX_EmailBu();
            bool       Cunzai = email1.IfCzFile(file1, "1");
            if (Cunzai == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file1));
            }
            email1.Dispose();
        }
        string file2 = ds1.Tables[0].Rows[0]["file2"].ToString();

        if (file2 != "" && file2 != null)
        {
            ZX_EmailBu email2  = new ZX_EmailBu();
            bool       Cunzai2 = email2.IfCzFile(file2, "2");
            if (Cunzai2 == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file2));
            }
            email2.Dispose();
        }
        string file3 = ds1.Tables[0].Rows[0]["file3"].ToString();

        if (file3 != "" && file3 != null)
        {
            ZX_EmailBu email3  = new ZX_EmailBu();
            bool       Cunzai3 = email3.IfCzFile(file3, "3");
            if (Cunzai3 == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file3));
            }
            email3.Dispose();
        }
        string file4 = ds1.Tables[0].Rows[0]["file4"].ToString();

        if (file4 != "" && file4 != null)
        {
            ZX_EmailBu email4  = new ZX_EmailBu();
            bool       Cunzai4 = email4.IfCzFile(file4, "4");
            if (Cunzai4 == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file4));
            }
            email4.Dispose();
        }
        string file5 = ds1.Tables[0].Rows[0]["file5"].ToString();

        if (file5 != "" && file5 != null)
        {
            ZX_EmailBu email5  = new ZX_EmailBu();
            bool       Cunzai5 = email5.IfCzFile(file5, "5");
            if (Cunzai5 == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file5));
            }
            email5.Dispose();
        }
        emal1.DelMail(id);
        emal1.Close();
        Comm.ShowInfo("操作提示:删除留言数据成功!", Application["root"] + "/info/SendMail.aspx");
    }
コード例 #30
0
ファイル: Tds70.cs プロジェクト: rinaahmed/mono
        public override bool Connect(TdsConnectionParameters connectionParameters)
        {
            if (IsConnected)
            {
                throw new InvalidOperationException("The connection is already open.");
            }

            connectionParms = connectionParameters;

            SetLanguage(connectionParameters.Language);
            SetCharset("utf-8");

            byte[] empty   = new byte[0];
            short  authLen = 0;
            byte   pad     = (byte)0;

            byte[] domainMagic = { 6,    0x7d, 0x0f, 0xfd, 0xff,  0x0,  0x0, 0x0,
                                   0x0,  0xe0, 0x83,  0x0,  0x0,
                                   0x68, 0x01, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00 };
            byte[] sqlserverMagic = { 6,    0x0,  0x0, 0x0,
                                      0x0,  0x0,  0x0, 0x0,
                                      0x0, 0xe0, 0x03, 0x0,
                                      0x0,  0x0,  0x0, 0x0,0x0, 0x0,
                                      0x0,  0x0, 0x0 };
            byte[] magic = null;

            if (connectionParameters.DomainLogin)
            {
                magic = domainMagic;
            }
            else
            {
                magic = sqlserverMagic;
            }

            string username = connectionParameters.User;
            string domain   = null;

            int idx = username.IndexOf("\\");

            if (idx != -1)
            {
                domain   = username.Substring(0, idx);
                username = username.Substring(idx + 1);

                connectionParameters.DefaultDomain = domain;
                connectionParameters.User          = username;
            }
            else
            {
                domain = Environment.UserDomainName;
                connectionParameters.DefaultDomain = domain;
            }

            short partialPacketSize = (short)(86 + (
                                                  connectionParameters.Hostname.Length +
                                                  connectionParameters.ApplicationName.Length +
                                                  DataSource.Length +
                                                  connectionParameters.LibraryName.Length +
                                                  Language.Length +
                                                  connectionParameters.Database.Length +
                                                  connectionParameters.AttachDBFileName.Length) * 2);

            if (connectionParameters.DomainLogin)
            {
                authLen = ((short)(32 + (connectionParameters.Hostname.Length +
                                         domain.Length)));
                partialPacketSize += authLen;
            }
            else
            {
                partialPacketSize += ((short)((username.Length + connectionParameters.Password.Length) * 2));
            }

            int totalPacketSize = partialPacketSize;

            Comm.StartPacket(TdsPacketType.Logon70);

            Comm.Append(totalPacketSize);

            //Comm.Append (empty, 3, pad);
            //byte[] version = {0x00, 0x0, 0x0, 0x71};
            //Console.WriteLine ("Version: {0}", ClientVersion[3]);
            Comm.Append(ClientVersion);              // TDS Version 7
            Comm.Append((int)this.PacketSize);       // Set the Block Size
            Comm.Append(empty, 3, pad);
            Comm.Append(magic);

            short curPos = 86;

            // Hostname
            Comm.Append(curPos);
            Comm.Append((short)connectionParameters.Hostname.Length);
            curPos += (short)(connectionParameters.Hostname.Length * 2);

            if (connectionParameters.DomainLogin)
            {
                Comm.Append((short)0);
                Comm.Append((short)0);
                Comm.Append((short)0);
                Comm.Append((short)0);
            }
            else
            {
                // Username
                Comm.Append(curPos);
                Comm.Append((short)username.Length);
                curPos += ((short)(username.Length * 2));

                // Password
                Comm.Append(curPos);
                Comm.Append((short)connectionParameters.Password.Length);
                curPos += (short)(connectionParameters.Password.Length * 2);
            }

            // AppName
            Comm.Append(curPos);
            Comm.Append((short)connectionParameters.ApplicationName.Length);
            curPos += (short)(connectionParameters.ApplicationName.Length * 2);

            // Server Name
            Comm.Append(curPos);
            Comm.Append((short)DataSource.Length);
            curPos += (short)(DataSource.Length * 2);

            // Unknown
            Comm.Append((short)curPos);
            Comm.Append((short)0);

            // Library Name
            Comm.Append(curPos);
            Comm.Append((short)connectionParameters.LibraryName.Length);
            curPos += (short)(connectionParameters.LibraryName.Length * 2);

            // Language
            Comm.Append(curPos);
            Comm.Append((short)Language.Length);
            curPos += (short)(Language.Length * 2);

            // Database
            Comm.Append(curPos);
            Comm.Append((short)connectionParameters.Database.Length);
            curPos += (short)(connectionParameters.Database.Length * 2);

            // MAC Address
            Comm.Append((byte)0);
            Comm.Append((byte)0);
            Comm.Append((byte)0);
            Comm.Append((byte)0);
            Comm.Append((byte)0);
            Comm.Append((byte)0);

            // Authentication Stuff
            Comm.Append((short)curPos);
            if (connectionParameters.DomainLogin)
            {
                Comm.Append((short)authLen);
                curPos += (short)authLen;
            }
            else
            {
                Comm.Append((short)0);
            }

            // Unknown
            Comm.Append(curPos);
            Comm.Append((short)(connectionParameters.AttachDBFileName.Length));
            curPos += (short)(connectionParameters.AttachDBFileName.Length * 2);

            // Connection Parameters
            Comm.Append(connectionParameters.Hostname);
            if (!connectionParameters.DomainLogin)
            {
                // SQL Server Authentication
                Comm.Append(connectionParameters.User);
                string scrambledPwd = EncryptPassword(connectionParameters.Password);
                Comm.Append(scrambledPwd);
            }
            Comm.Append(connectionParameters.ApplicationName);
            Comm.Append(DataSource);
            Comm.Append(connectionParameters.LibraryName);
            Comm.Append(Language);
            Comm.Append(connectionParameters.Database);

            if (connectionParameters.DomainLogin)
            {
                // the rest of the packet is NTLMSSP authentication
                Type1Message msg = new Type1Message();
                msg.Domain = domain;
                msg.Host   = connectionParameters.Hostname;
                msg.Flags  = NtlmFlags.NegotiateUnicode |
                             NtlmFlags.NegotiateNtlm |
                             NtlmFlags.NegotiateDomainSupplied |
                             NtlmFlags.NegotiateWorkstationSupplied |
                             NtlmFlags.NegotiateAlwaysSign;            // 0xb201
                Comm.Append(msg.GetBytes());
            }

            Comm.Append(connectionParameters.AttachDBFileName);
            Comm.SendPacket();
            MoreResults = true;
            SkipToEnd();

            return(IsConnected);
        }
コード例 #31
0
ファイル: Tds70.cs プロジェクト: rinaahmed/mono
        protected override void ProcessColumnInfo()
        {
            int numColumns = Comm.GetTdsShort();

            for (int i = 0; i < numColumns; i += 1)
            {
                byte[] flagData = new byte[4];
                for (int j = 0; j < 4; j += 1)
                {
                    flagData[j] = Comm.GetByte();
                }

                bool nullable = (flagData[2] & 0x01) > 0;
                //bool caseSensitive = (flagData[2] & 0x02) > 0;
                bool writable      = (flagData[2] & 0x0c) > 0;
                bool autoIncrement = (flagData[2] & 0x10) > 0;
                bool isIdentity    = (flagData[2] & 0x10) > 0;

                TdsColumnType columnType = (TdsColumnType)((Comm.GetByte() & 0xff));

                byte xColumnType = 0;
                if (IsLargeType(columnType))
                {
                    xColumnType = (byte)columnType;
                    if (columnType != TdsColumnType.NChar)
                    {
                        columnType -= 128;
                    }
                }

                int    columnSize;
                string tableName = null;

                if (IsBlobType(columnType))
                {
                    columnSize = Comm.GetTdsInt();
                    tableName  = Comm.GetString(Comm.GetTdsShort());
                }
                else if (IsFixedSizeColumn(columnType))
                {
                    columnSize = LookupBufferSize(columnType);
                }
                else if (IsLargeType((TdsColumnType)xColumnType))
                {
                    columnSize = Comm.GetTdsShort();
                }
                else
                {
                    columnSize = Comm.GetByte() & 0xff;
                }

                if (IsWideType((TdsColumnType)columnType))
                {
                    columnSize /= 2;
                }

                byte precision = 0;
                byte scale     = 0;

                if (columnType == TdsColumnType.Decimal || columnType == TdsColumnType.Numeric)
                {
                    precision = Comm.GetByte();
                    scale     = Comm.GetByte();
                }
                else
                {
                    precision = GetPrecision(columnType, columnSize);
                    scale     = GetScale(columnType, columnSize);
                }

                string columnName = Comm.GetString(Comm.GetByte());

                TdsDataColumn col = new TdsDataColumn();
                Columns.Add(col);
#if NET_2_0
                col.ColumnType       = columnType;
                col.ColumnName       = columnName;
                col.IsAutoIncrement  = autoIncrement;
                col.IsIdentity       = isIdentity;
                col.ColumnSize       = columnSize;
                col.NumericPrecision = precision;
                col.NumericScale     = scale;
                col.IsReadOnly       = !writable;
                col.AllowDBNull      = nullable;
                col.BaseTableName    = tableName;
                col.DataTypeName     = Enum.GetName(typeof(TdsColumnType), xColumnType);
#else
                col ["ColumnType"]       = columnType;
                col ["ColumnName"]       = columnName;
                col ["IsAutoIncrement"]  = autoIncrement;
                col ["IsIdentity"]       = isIdentity;
                col ["ColumnSize"]       = columnSize;
                col ["NumericPrecision"] = precision;
                col ["NumericScale"]     = scale;
                col ["IsReadOnly"]       = !writable;
                col ["AllowDBNull"]      = nullable;
                col ["BaseTableName"]    = tableName;
                col ["DataTypeName"]     = Enum.GetName(typeof(TdsColumnType), xColumnType);
#endif
            }
        }
コード例 #32
0
        public void DeleteComm(int id)
        {
            Comm commToDelete = _repo.Query <Comm>().Where(c => c.Id == id).FirstOrDefault();

            _repo.Delete(commToDelete);
        }
コード例 #33
0
ファイル: SensorBase.cs プロジェクト: ufjl0683/Center
 void OnReceiveText(object sender, Comm.TextPackage txtObj)
 {
     try
     {
         this.IsConnected= DateTime.Now.Subtract(lastReceiveTime) < TimeSpan.FromMinutes(1);
         lastReceiveTime = DateTime.Now;
         sensorDev_OnReceiveText(sender, txtObj);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message + "," + ex.StackTrace);
     }
 }
コード例 #34
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="messageLog"></param>
 private void AssertMessage()
 {
     Comm.SpecAssertMessage(Repo.Message.MsgCodeList, MessageCode.Code1013, false);
     Comm.SpecAssertMessage(Repo.Message.MsgCodeList, MessageCode.Code1014, false);
 }
コード例 #35
0
ファイル: MemberSkinProvider.cs プロジェクト: dkme/moooyo
 /// <summary>
 /// 创建用户皮肤
 /// </summary>
 /// <param name="memberId">创建者</param>
 /// <param name="userType">创建者类别</param>
 /// <param name="personalityPicture">个性图片</param>
 /// <param name="personalityBackgroundPicture">个性背景图片</param>
 /// <returns>用户皮肤对象</returns>
 private static MemberSkin CreateMemberSkin(
     String memberId,
     Comm.UserType userType,
     String personalityPicture,
     String personalityBackgroundPicture)
 {
     MemberSkin obj = new MemberSkin();
     obj.Creater = memberId;
     obj.UserType = userType;
     obj.PersonalityPicture = personalityPicture;
     obj.PersonalityBackgroundPicture = personalityBackgroundPicture;
     obj.CreatedTime = DateTime.Now;
     obj.Random = new Random().NextDouble();
     try
     {
         MongoDatabase md = MongoDBHelper.MongoDB;
         MongoCollection<MemberSkin> mc = md.GetCollection<MemberSkin>(MemberSkin.GetCollectionName());
         mc.Save(obj);
         return obj;
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }
コード例 #36
0
 private void CheckChannelVerifyPeriod()
 {
     Comm.SpecAssertMessage(Repo.Message.MsgCodeList, MessageCode.Code1014, true);
 }
コード例 #37
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Query_Click(object sender, EventArgs e)
        {
            if (SelectedTag.Count <= 0)
            {
                MessageBox.Show(lbl_message[2]);
                return;
            }
            this.pl_CalendarAndTime.Visible  = false;
            this.pl_CalendarAndTime2.Visible = false;
            long startTime     = ConvertDateTimeInt(DateTime.Parse(this.StartTime.Text));
            long endTime       = ConvertDateTimeInt(DateTime.Parse(this.EndTime.Text));
            long longStartTime = Comm.ConvertDateTimeInt(DateTime.Parse(this.StartTime.Text));
            var  count         = ConvertDateTimeInt(DateTime.Parse(this.EndTime.Text)) - ConvertDateTimeInt(DateTime.Parse(this.StartTime.Text));

            if (startTime > endTime)
            {
                //开始和结束时间位置互换
                string sTime = this.StartTime.Text;
                string eTime = this.EndTime.Text;
                this.StartTime.Text = DateTime.Parse(eTime).ToString("yyyy-MM-dd HH:mm:ss");
                this.EndTime.Text   = DateTime.Parse(sTime).ToString("yyyy-MM-dd HH:mm:ss");
                this.radCalendar_start.SelectedDate = DateTime.Parse(eTime);
                this.radCalendar_end.SelectedDate   = DateTime.Parse(sTime);
                this.radCalendar_start.FocusedDate  = DateTime.Parse(eTime);
                this.radCalendar_end.FocusedDate    = DateTime.Parse(sTime);
                this.radTimePicker1.Value           = Convert.ToDateTime(eTime);
                this.radTimePicker2.Value           = Convert.ToDateTime(sTime);
                //时间获取并转换
                startTime     = ConvertDateTimeInt(DateTime.Parse(this.StartTime.Text));
                endTime       = ConvertDateTimeInt(DateTime.Parse(this.EndTime.Text));
                longStartTime = Comm.ConvertDateTimeInt(DateTime.Parse(this.StartTime.Text));
                count         = ConvertDateTimeInt(DateTime.Parse(this.EndTime.Text)) - ConvertDateTimeInt(DateTime.Parse(this.StartTime.Text));
            }
            QueryStartTime = startTime;
            QueryEndTime   = endTime;
            //查询时间不能相同
            if (QueryStartTime == QueryEndTime)
            {
                MessageBox.Show(lbl_message[0]);
                return;
            }
            //查询时间不能超过3天
            if ((QueryEndTime - QueryStartTime) > 259200)
            {
                MessageBox.Show(lbl_message[1]);
                return;
            }
            rpnl_load.Visible = true;
            if (!backgroundWorker_historydata.IsBusy)
            {
                this.Cursor = Cursors.WaitCursor;//等待
                //初始化曲线图
                historyDataShow1.SetChart(longStartTime, count);
                historyDataShow2.SetChart(longStartTime, count);
                historyDataShow3.SetChart(longStartTime, count);
                historyDataShow4.SetChart(longStartTime, count);
                //初始化井深
                historyDataDepthShow1.setDepth(longStartTime, (int)count);
                backgroundWorker_historydata.RunWorkerAsync();
            }
        }
コード例 #38
0
 public ActionResult EditCardInfo(PersonalCardViewModels model)
 {
     try
     {
         var pCard = db.CardPersonals.FirstOrDefault(s => s.ID == model.PCardID && s.UserID == model.UserID);
         if (pCard == null)
         {
             return(Json(Comm.ToJsonResult("Error", "名片不存在")));
         }
         //if (!ModelState.IsValid)
         //{
         //    return Json(Comm.ToJsonResult("Error", ModelState.FirstErrorMessage()));
         //}
         if (model.Name != null)
         {
             if (!string.IsNullOrWhiteSpace(model.Name.Trim()))
             {
                 pCard.Name = model.Name;
             }
             else
             {
                 return(Json(Comm.ToJsonResult("Error", "名字不能空")));
             }
         }
         if (model.Email != null)
         {
             if (string.IsNullOrWhiteSpace(model.Email))
             {
                 pCard.Email = null;
             }
             else if (Reg.IsEmail(model.Email))
             {
                 pCard.Email = model.Email;
             }
             else
             {
                 return(Json(Comm.ToJsonResult("Error", "邮箱格式不正确")));
             }
         }
         if (model.Mobile != null)
         {
             if (string.IsNullOrWhiteSpace(model.Mobile))
             {
                 pCard.Mobile = null;
             }
             else if (Reg.IsMobile(model.Mobile))
             {
                 pCard.Mobile = model.Mobile;
             }
             else
             {
                 return(Json(Comm.ToJsonResult("Error", "手机号格式不正确")));
             }
         }
         if (model.Phone != null)
         {
             if (string.IsNullOrWhiteSpace(model.Phone))
             {
                 pCard.PhoneNumber = null;
             }
             else if (Reg.IsPhone(model.Phone))
             {
                 pCard.PhoneNumber = model.Phone;
             }
             else
             {
                 return(Json(Comm.ToJsonResult("Error", "座机号格式不正确")));
             }
         }
         if (model.Position != null)
         {
             pCard.Position = model.Position.Trim();
         }
         if (model.Remark != null)
         {
             pCard.Remark = model.Remark.Trim();
         }
         if (model.WeChatCode != null)
         {
             pCard.WeChatCode = model.WeChatCode.Trim();
         }
         if (model.Avatar != null)
         {
             pCard.Avatar = model.Avatar.Trim();
         }
         if (model.Images != null)
         {
             pCard.Images = string.Join(",", model.Images);
         }
         if (model.Video != null)
         {
             pCard.Video = model.Video.Trim();
         }
         if (model.Voice != null)
         {
             pCard.Voice = model.Voice.Trim();
         }
         if (model.Info != null)
         {
             pCard.Info = model.Info.Trim();
         }
         if (model.Industry != null)
         {
             pCard.Industry = model.Industry.Trim();
         }
         if (model.Birthday != null)
         {
             if (string.IsNullOrWhiteSpace(model.Birthday))
             {
                 pCard.Birthday = null;
             }
             else
             {
                 DateTime birthday;
                 if (DateTime.TryParse(model.Birthday, out birthday))
                 {
                     pCard.Birthday = birthday;
                 }
                 else
                 {
                     Json(Comm.ToJsonResult("Error", "生日的格式不正确"));
                 }
             }
         }
         if (model.Gender.HasValue)
         {
             pCard.Gender = model.Gender.Value;
         }
         if (model.Address != null)
         {
             pCard.Address = model.Address.Trim();
         }
         if (model.City != null)
         {
             pCard.City = model.City.Trim();
         }
         if (model.Province != null)
         {
             pCard.Province = model.Province.Trim();
         }
         if (model.District != null)
         {
             pCard.District = model.District.Trim();
         }
         if (model.EnterpriseName != null)
         {
             pCard.Enterprise = model.EnterpriseName.Trim();
         }
         if (model.Lat != null)
         {
             if (string.IsNullOrWhiteSpace(model.Lat))
             {
                 pCard.Lat = null;
             }
             else
             {
                 double temp;
                 if (double.TryParse(model.Lat, out temp))
                 {
                     pCard.Lat = temp;
                 }
                 else
                 {
                     Json(Comm.ToJsonResult("Error", "纬度格式不正确"));
                 }
             }
         }
         if (model.Lng != null)
         {
             if (string.IsNullOrWhiteSpace(model.Lng))
             {
                 pCard.Lng = null;
             }
             else
             {
                 double temp;
                 if (double.TryParse(model.Lng, out temp))
                 {
                     pCard.Lng = temp;
                 }
                 else
                 {
                     Json(Comm.ToJsonResult("Error", "纬度格式不正确"));
                 }
             }
         }
         db.SaveChanges();
         return(Json(Comm.ToJsonResult("Success", "成功"), JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(Comm.ToJsonResult("Error500", ex.Message), JsonRequestBehavior.AllowGet));
     }
 }
コード例 #39
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="expectData"></param>
 /// <param name="actualData"></param>
 /// <param name="messageLog"></param>
 private void AssertCorrectData(CollectionTypeSet expectData, CollectionTypeSet actualData, bool isCheckInput = true)
 {
     Comm.CheckInputValueIsNull(actualData);
     AssertSet(expectData, actualData);
     AssertMessage();
 }
コード例 #40
0
        private void backgroundWorker_historydata_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                PostError = false;
                if (SelectedTag.Count == 0)
                {
                    CursorsDefault();
                    return;
                }
                QueryHistory model = new QueryHistory();
                model.startTime = QueryStartTime;
                model.endTime   = QueryEndTime;
                model.DrillId   = AppDrill.DrillID;
                model.DepthTag  = depth;
                List <string> tag = new List <string>();
                foreach (var item in HistoryDataForm.SelectedTag)
                {
                    tag.Add(item.Tag);
                }
                model.Tag = tag;
                PostData  = null;
                PostData  = new JavaScriptSerializer().Serialize(model);

                var QueryData = Comm.HttpPost(PostUrl, PostData);
                if (!string.IsNullOrEmpty(QueryData))
                {
                    JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
                    jsSerializer.MaxJsonLength = Int32.MaxValue;
                    dataList   = jsSerializer.Deserialize <getHistoryData>(QueryData); //反序列化
                    Depthdatas = new List <HistoryDepthData>();
                    Depthdatas = dataList.Depthdatas;
                    foreach (var item in dataList.datas)
                    {
                        var      IndexModel = SelectedTag.Where(o => o.Tag == item.Tag).FirstOrDefault();
                        DateTime d4         = DateTime.Now;
                        if (IndexModel != null)
                        {
                            switch (IndexModel.index)
                            {
                            case 1:
                                historyDataShow1.upChart(item.Datas, 1, item.Tag);
                                break;

                            case 2:
                                historyDataShow2.upChart(item.Datas, 2, item.Tag);
                                break;

                            case 3:
                                historyDataShow3.upChart(item.Datas, 3, item.Tag);
                                break;

                            case 4:
                                historyDataShow4.upChart(item.Datas, 4, item.Tag);
                                break;
                            }
                        }
                    }
                }
            }
            catch
            {
                PostError = true;
            }
        }
コード例 #41
0
 private void CheckIsOverlap()
 {
     Comm.SpecAssertMessage(Repo.Message.MsgCodeList, MessageCode.Code1013, true);
 }
コード例 #42
0
ファイル: Frm_Product.cs プロジェクト: wenfeifei/WinForm-
 //读取拼音码
 private void txtProductName_TextChanged(object sender, EventArgs e)
 {
     txtSpellingCode.Text = Comm.HZToSpell(txtProductName.Text.Trim());
 }
コード例 #43
0
ファイル: TesterProtocol.cs プロジェクト: xiangxud/Projects
 /// <summary>
 /// Overloaded constructor
 /// </summary>
 public TesterProtocol(string strPortName, byte[] ucaKey)
 {
     byte[] Client = { 84, 69, 83, 84, 69, 82, 32 };
     mPort          = new SerialDirect(strPortName, 14, ucaKey, Client);
     mPort.pVersion = 14;
 }
コード例 #44
0
ファイル: MFCC_BS.cs プロジェクト: ufjl0683/Center
        void MFCC_BS_On_DegreeChange(Comm.TC.BSTC tc, DateTime dt, DataSet ds)
        {
            try
            {
                int sink = System.Convert.ToInt32(ds.Tables[0].Rows[0]["bs_sink"]);
                int shift = System.Convert.ToInt32(ds.Tables[0].Rows[0]["bs_shift"]);
                int degree = System.Convert.ToInt32(ds.Tables[0].Rows[0]["bs_degree"]);
                int day, hour, min;
                int response_type = System.Convert.ToInt32(ds.Tables[0].Rows[0]["response_type"]);
                day = System.Convert.ToInt32(ds.Tables[0].Rows[0]["day"]);
                hour = System.Convert.ToInt32(ds.Tables[0].Rows[0]["hour"]);
                min = System.Convert.ToInt32(ds.Tables[0].Rows[0]["minute"]);
                System.DateTime dtt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, day,hour, min, 0);

                string sql = "insert into tblEventBS (DeviceName,TimeStamp,DataType,BS_SHIFT,BS_SINK,BS_Degree) values('{0}','{1}',{2},{3},{4},{5})";
                dbServer.SendSqlCmd(string.Format(sql,tc.DeviceName,DbCmdServer.getTimeStampString(dtt),response_type,shift,sink,degree));
                this.r_host_comm.setBS_EventData(tc.DeviceName,dtt,0,shift,sink,degree);
            }
            catch (Exception ex)
            {
                ConsoleServer.WriteLine("Host err:" + ex.Message);
            }
        }
コード例 #45
0
ファイル: MFCC_VD.cs プロジェクト: ufjl0683/Center
        void MFCC_VD_On20SecEvent(object vdtc, Comm.TC.VD_MinAvgData data)
        {
            Comm.TC.VDTC tc = (Comm.TC.VDTC)vdtc;

            ConsoleServer.WriteLine(tc.DeviceName + "," + data.dateTime + ",20SecEvent!");

            lock (fileLockObj)
            {
                string path = Comm.Util.CPath(System.AppDomain.CurrentDomain.BaseDirectory +string.Format( @"\Vd20Sec\{0:00}{1:00}{2:00}", data.year, data.month, data.day)) ;
                if (!System.IO.File.Exists(path))
                    System.IO.Directory.CreateDirectory(Comm.Util.CPath(path));

                System.IO.StreamWriter wr = System.IO.File.AppendText(Comm.Util.CPath(path + "\\" + string.Format("{0}.txt", tc.DeviceName)));
               // wr.WriteLine(tc.DeviceName+","+data.dateTime+",20SecEvent!");

                wr.WriteLine(VD20SecToCsvStr(tc.DeviceName, data));
                wr.Flush();
                wr.Close();
                wr.Dispose();
            }

            //throw new Exception("The method or operation is not implemented.");
        }
コード例 #46
0
    protected void btdel_Click(object sender, EventArgs e)
    {
        KFB_ZHGL   mo_zhgl = new KFB_ZHGL();
        LinkButton btn     = (LinkButton)sender;
        int        i_Index = ((GridViewRow)(btn.Parent.Parent)).RowIndex;

        string s_NID = "";

        s_NID   = ((GridView)(btn.Parent.Parent.Parent.Parent)).Rows[i_Index].Cells[0].Text.ToString().Trim();
        mo_zhgl = objAgentManageDB.GetModel(s_NID);

        //判断是否有注單
        int i_Count = objAgentManageDB.GetZD(s_NID, Comm.GetZHCol(mo_zhgl.N_HYDJ.ToString()));

        if (i_Count > 0)
        {
            this.ShowMsg("本賬號已有注單,無法删除!");
            return;
        }

        int i_HYCount = objAgentManageDB.GetHYZD(s_NID, Comm.GetZHCol(mo_zhgl.N_HYDJ.ToString()));

        if (i_HYCount > 0)
        {
            this.ShowMsg("本賬號下級會員已有注單,無法删除!");
            return;
        }

        int i_oCount = objAgentManageDB.GetOZD(s_NID, Comm.GetZHCol(mo_zhgl.N_HYDJ.ToString()));

        if (i_oCount > 0)
        {
            this.ShowMsg("本賬號已有歷史注單,無法删除!");
            return;
        }

        int i_oHYCount = objAgentManageDB.GetOHYZD(s_NID, Comm.GetZHCol(mo_zhgl.N_HYDJ.ToString()));

        if (i_oHYCount > 0)
        {
            this.ShowMsg("本賬號下級會員已有歷史注單,無法删除!");
            return;
        }

        try
        {
            //判斷是否存在
            bool chuser = objAgentManageDB.Exists(s_NID);
            if (!chuser)
            {
                this.ShowMsg("該會員已被刪除!");
            }
            else//存在則修改
            {
                #region "修改上级剩余额度"
                objAgentManageDB.UpSJED(mo_zhgl);

                #endregion
                //o_KFB_ZHGL.Delete(strparid, Convert.ToInt32(strlvl));
                objAgentManageDB.DeleteAll(s_NID, Comm.GetZHCol(mo_zhgl.N_HYDJ.ToString()));

                SetGrid(this.drzdl.SelectedValue);
            }
        }
        catch (Exception ex)
        {
            this.WriteLog("用户名=" + mUserID + ex.ToString());
            this.ShowMsg("删除失败");
        }
    }
コード例 #47
0
ファイル: MFCC_VD.cs プロジェクト: ufjl0683/Center
        //public override void loadTC_AndBuildManaer()
        //{
        ////    try
        ////    {
        ////        //System.Data.Odbc.OdbcDataReader rd;
        ////        //System.Data.Odbc.OdbcConnection cn = new System.Data.Odbc.OdbcConnection(Comm.DB2.Db2.db2ConnectionStr);
        ////        //rd = Comm.DB2.Db2.getDeviceConfigReader(cn, this.mfccid);
        ////        //while (rd.Read())
        ////        //{
        ////        //    byte[] hw_status = new byte[4];
        ////        //    for (int i = 0; i < 4; i++)
        ////        //        hw_status[i] = System.Convert.ToByte(rd[3 + i]);
        ////        //    Comm.TC.VDTC tc = new Comm.TC.VDTC(protocol, rd[0].ToString().Trim(), rd[1].ToString(), (int)rd[2], 0xffff, hw_status);
        ////        //    ConsoleServer.WriteLine(string.Format("load tc:{0} ip:{1} port:{2}", rd[0], rd[1], rd[2]));
        ////        //    tcAry.Add(tc);
        ////        //}
        ////        //rd.Close();
        ////        //cn.Close();
        //        Comm.TC.VDTC tc=new Comm.TC.VDTC(protocol,"VD231","192.168.22.231",1001,0xffff,new byte[]{0,0,0,0});
        //        tc.OnRealTimeData += new Comm.TC.OnRealTimeEventHandler(tc_OnRealTimeData);
        //        tc.OnTriggerEvent += new Comm.TC.OnTriggerEventHandler(tc_OnTriggerEvent);
        //     //   tc.OnHwStatusChanged += new HWStatusChangeHandler(tc_OnHwStatusChanged);
        //      //  tc.OnConnectStatusChanged += new ConnectStatusChangeHandler(tc_OnConnectStatusChanged);
        //        tc.On1MinTrafficData += new Comm.TC.On1MinEventDataHandler(tc_On1MinTrafficData);
        //        tcAry.Add(tc);
        //        this.manager = new TC_Manager(tcAry);
        //    //}
        //    //catch (Exception ex)
        //    //{
        //    //    ConsoleServer.WriteLine(ex.Message);
        //    //}
        //}
        void tc_On1MinTrafficData(object vdtc, Comm.TC.VD_MinAvgData data)
        {
            //throw new Exception("The method or operation is not implemented.");

            //this.InDbQueue.Enqueue(data);

            //lock (this.InDbQueue)
            //{
            //    System.Threading.Monitor.PulseAll(InDbQueue);
            //}
            try
            {
            //   this.ToDb(data.getExecuteSql());

                if (data.IsValid)
                    dbServer.SendSqlCmd(data.getExecuteSql());
                else
                {
                    if (r_host_comm != null)
                    r_host_comm.DoVD_InteropData((vdtc as TCBase).DeviceName, data.dateTime);
                }

                RemoteInterface.MFCC.VD1MinCycleEventData vd1min;

                //if (((TCBase)vdtc).DeviceName == "VD-N1-S-149.5")
                //{
                   vd1min = data.ToVD1MinCycleEventData();
                //}
                //else
                //{
                //   vd1min = data.ToVD1MinCycleEventData();
                //}

                // remove on 2013-3-17
                //this.notifier.NotifyAll(new NotifyEventObject(EventEnumType.VD_1min_Cycle_Event, ((TCBase)vdtc).DeviceName, vd1min));
            }
            catch (Exception ex)
            {
                ConsoleServer.WriteLine((vdtc as TCBase).DeviceName+":"+ex.Message + ex.StackTrace);
            }
        }
コード例 #48
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Request["nid"] != null)
        {
            string   strnid  = this.Request["nid"].ToString();
            KFB_PTZD mo_PTZD = objReportDB.GetModel(strnid);
            string   strmes  = "";
            if (mo_PTZD.N_QR.ToString().Equals("1"))
            {
                strmes = "PS:確認時間已過,會員下注已經成功!";
            }
            else
            {
                if (this.Request["status"].Equals("0"))
                {
                    //o_PTZD.COZDQR(strnid,"1", "0");
                    if (mo_PTZD != null)                           //如果注单存在  做删单操作
                    {
                        string  strdel = mo_PTZD.N_DEL.ToString(); //注单时候删除标识位  0或者“”为未删除   1表示已经删除
                        decimal n_xzje = (decimal)mo_PTZD.N_XZJE;
                        objReportDB.Delete(strnid);
                        //KingOfBall.BLL.KFB_COUNT_BLL count = new KingOfBall.BLL.KFB_COUNT_BLL();
                        //int no = count.GetNo();
                        //count.InsertBillLog(no, mo_PTZD.N_HYDH, mo_PTZD.N_XZDH, mo_PTZD.N_QSBH.Value.ToString(), n_xzje, 0, 0, DateTime.Now, "6");
                        if (!n_xzje.Equals(0) && strdel != "1")//下注金额不等于0并且该注单未被删除,此时需要恢复会员的额度
                        {
                            objReportDB.HuiFuHYYE(mo_PTZD.N_HYDH, n_xzje / 10000);
                        }
                    }
                }
                else
                {
                    objReportDB.ZDQR(strnid, "1");
                }
                // strmes = "操作成功!";
                strmes = "";
            }
            //if (mo_PTZD == null)// && mo_PTZD.N_QR.ToString().Equals("1"))
            //{
            //    strmes = "PS:確認時間已過,該筆注單已被刪除!";
            //}
            //else
            //{
            //    o_PTZD.ZDQR(strnid, "1");
            //}
            this.Response.Write(strmes);
            this.Response.Flush();
            this.Response.End();;
        }
        if (this.Request["time"] != null && this.Request["type"] != null)
        {
            string strreturn = "";
            string strtime   = this.Request["time"].ToString();
            string strtype   = this.Request["type"].ToString();
            if (strtime.Equals(""))
            {
                strtime = this.objReportDB.GetSystemTime().ToString("yyyy/MM/dd HH:mm:ss");
            }
            strtype = strtype.Replace("ch", "b_");
            string  strbslx = "'l_zdrf','l_zddx','l_zddy','l_zdhj','l_zdds','l_zdye'";
            DataSet ds      = objReportDB.GetZDQuick(strtime.Replace('-', '/'), strtype, strbslx);
            // DataSet ds = o_PTZD.GetQuick("2008/01/01 12:00:00", strtype);
            XmlDocument CreateXml = new XmlDocument();
            XmlNode     xmlNode   = CreateXml.CreateNode(XmlNodeType.XmlDeclaration, "", "");
            CreateXml.AppendChild(xmlNode);

            XmlElement xmlRoot = CreateXml.CreateElement("", "ZDTB", "");
            CreateXml.AppendChild(xmlRoot);

            XmlElement xmlTime = CreateXml.CreateElement("", "Time", "");
            //XmlText xmlTimeText = CreateXml.CreateTextNode(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss").Replace('-', '/'));
            XmlText xmlTimeText = CreateXml.CreateTextNode(strtime.Replace('-', '/'));
            xmlTime.AppendChild(xmlTimeText);
            CreateXml.ChildNodes[1].AppendChild(xmlTime);

            if (ds.Tables[0].Rows.Count > 0)
            {
                string strn_xzdh = "";
                string strn_xzrq = "";
                string strn_hydh = "";
                string strnr     = "";
                string strn_xzwf = "";
                string strn_xzje = "";
                string strlx     = "";
                string strnid    = "";
                string strwxdj   = "";
                string strdbzd   = "";
                string strXZNR   = "";
                string strQR     = "";
                string strdx     = "";
                string strdxbl   = "";
                string strdxxt   = "";

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    strn_xzdh = ds.Tables[0].Rows[i]["N_XZDH"].ToString();
                    strn_xzrq = DateTime.Parse(ds.Tables[0].Rows[i]["N_XZRQ"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                    strn_hydh = ds.Tables[0].Rows[i]["N_HYDH"].ToString();
                    strn_xzje = ds.Tables[0].Rows[i]["N_XZJE"].ToString();
                    strn_xzwf = ds.Tables[0].Rows[i]["N_XZWF"].ToString();
                    strlx     = ds.Tables[0].Rows[i]["N_BSLX"].ToString();
                    strnid    = ds.Tables[0].Rows[i]["N_ID"].ToString();
                    strwxdj   = ds.Tables[0].Rows[i]["N_WXDJ"].ToString();
                    strdbzd   = ds.Tables[0].Rows[i]["N_DBZD"].ToString();
                    strXZNR   = ds.Tables[0].Rows[i]["XZNR"].ToString();
                    strQR     = ds.Tables[0].Rows[i]["N_QR"].ToString();
                    strdx     = ds.Tables[0].Rows[i]["N_DX"].ToString();
                    strdxbl   = ds.Tables[0].Rows[i]["N_DXBL"].ToString();
                    strdxxt   = ds.Tables[0].Rows[i]["N_DXXT"].ToString();

                    XmlElement xmlRow = CreateXml.CreateElement("", "Rows", "");
                    CreateXml.ChildNodes[1].AppendChild(xmlRow);
                    //下注單號
                    XmlElement elemtEQUIP_NAME = CreateXml.CreateElement("", "N_XZDH", "");
                    XmlText    EQUIP_NAMEtext  = CreateXml.CreateTextNode(strn_xzdh);
                    elemtEQUIP_NAME.AppendChild(EQUIP_NAMEtext);
                    CreateXml.ChildNodes[1].ChildNodes[i + 1].AppendChild(elemtEQUIP_NAME);
                    //下注日期
                    XmlElement elemtMapPath = CreateXml.CreateElement("", "N_XZRQ", "");
                    XmlText    MapPathtext  = CreateXml.CreateTextNode(strn_xzrq);
                    elemtMapPath.AppendChild(MapPathtext);
                    CreateXml.ChildNodes[1].ChildNodes[i + 1].AppendChild(elemtMapPath);
                    //會員代號
                    XmlElement elemtPURPOSE = CreateXml.CreateElement("", "N_HYDH", "");
                    XmlText    PURPOSEtext  = CreateXml.CreateTextNode(strn_hydh);
                    elemtPURPOSE.AppendChild(PURPOSEtext);
                    CreateXml.ChildNodes[1].ChildNodes[i + 1].AppendChild(elemtPURPOSE);
                    //下注金額
                    XmlElement eleN_XZJE  = CreateXml.CreateElement("", "N_XZJE", "");
                    XmlText    N_XZJEText = CreateXml.CreateTextNode(strn_xzje);
                    eleN_XZJE.AppendChild(N_XZJEText);
                    CreateXml.ChildNodes[1].ChildNodes[i + 1].AppendChild(eleN_XZJE);
                    //下注金額
                    XmlElement eleN_XZWF = CreateXml.CreateElement("", "N_XZWF", "");
                    //XmlText N_XZWFText = CreateXml.CreateTextNode(Comm.ChType(strn_xzwf));
                    XmlText N_XZWFText = CreateXml.CreateTextNode(Comm.GetPlayName(strn_xzwf, "2"));
                    eleN_XZWF.AppendChild(N_XZWFText);
                    CreateXml.ChildNodes[1].ChildNodes[i + 1].AppendChild(eleN_XZWF);



                    if (!strn_xzwf.Equals("l_gg"))
                    {
                        // strnr = dsnr.Tables[0].Rows[0]["n_xznr"].ToString();
                        strnr = strXZNR.Replace("#", "");
                    }
                    else
                    {
                        strnr = " <table  class='eng_12_bk'> ";
                        string[] strsplit = strXZNR.Split('#');
                        for (int j = 0; j < strsplit.Length - 1; j++)
                        {
                            strnr = strnr + " <tr> <td width='10' bgcolor='#FFFFFF' > " + Convert.ToString(j + 1) + "</td> <td bgcolor='#FFFFFF' >" + strsplit[j].ToString() + " </td> </tr> ";
                        }
                        strnr = strnr + " </table > ";
                    }

                    //下注内容
                    XmlElement eleN_XZNR  = CreateXml.CreateElement("", "N_XZNR", "");
                    XmlText    N_XZNRText = CreateXml.CreateTextNode(string.Format(strnr, "", ""));
                    eleN_XZNR.AppendChild(N_XZNRText);
                    CreateXml.ChildNodes[1].ChildNodes[i + 1].AppendChild(eleN_XZNR);

                    //N_ID
                    XmlElement eleN_ID    = CreateXml.CreateElement("", "N_ID", "");
                    XmlText    N_N_IDText = CreateXml.CreateTextNode(Comm.ChType(strnid));
                    eleN_ID.AppendChild(N_N_IDText);
                    CreateXml.ChildNodes[1].ChildNodes[i + 1].AppendChild(eleN_ID);

                    //危險等級
                    XmlElement eleN_WXDJ  = CreateXml.CreateElement("", "N_WXDJ", "");
                    XmlText    N_WXDJText = CreateXml.CreateTextNode(Comm.ChType(strwxdj));
                    eleN_WXDJ.AppendChild(N_WXDJText);
                    CreateXml.ChildNodes[1].ChildNodes[i + 1].AppendChild(eleN_WXDJ);

                    //大筆注單
                    XmlElement eleN_DBZD  = CreateXml.CreateElement("", "N_DBZD", "");
                    XmlText    N_DBZDText = CreateXml.CreateTextNode(Comm.ChType(strdbzd));
                    eleN_DBZD.AppendChild(N_DBZDText);
                    CreateXml.ChildNodes[1].ChildNodes[i + 1].AppendChild(eleN_DBZD);

                    //是否确认
                    XmlElement eleN_QR  = CreateXml.CreateElement("", "N_QR", "");
                    XmlText    N_QRText = CreateXml.CreateTextNode(Comm.ChType(strdbzd));
                    eleN_QR.AppendChild(N_QRText);
                    CreateXml.ChildNodes[1].ChildNodes[i + 1].AppendChild(eleN_QR);

                    //DA xiao qiu tou
                    if ((strn_xzwf.Equals("l_zddx") || strn_xzwf.Equals("l_dx")) && strdx.Equals("0") && strdxbl.Equals("0") && strdxxt.Equals("0"))
                    {
                        XmlElement eleN_DXQT  = CreateXml.CreateElement("", "N_DXQT", "");
                        XmlText    N_DXQTText = CreateXml.CreateTextNode("1");
                        eleN_DXQT.AppendChild(N_DXQTText);
                        CreateXml.ChildNodes[1].ChildNodes[i + 1].AppendChild(eleN_DXQT);
                    }
                    else
                    {
                        XmlElement eleN_DXQT  = CreateXml.CreateElement("", "N_DXQT", "");
                        XmlText    N_DXQTText = CreateXml.CreateTextNode("0");
                        eleN_DXQT.AppendChild(N_DXQTText);
                        CreateXml.ChildNodes[1].ChildNodes[i + 1].AppendChild(eleN_DXQT);
                    }
                }
            }
            strreturn = CreateXml.InnerXml.ToString();
            this.Response.Write(strreturn);
            this.Response.Flush();
            this.Response.End();;
        }
    }
コード例 #49
0
ファイル: CommentProvider.cs プロジェクト: dkme/moooyo
 /// <summary>
 /// 按回复对象编号和回复类型返回回复集合的数量
 /// </summary>
 /// <param name="contentID">回复对象编号</param>
 /// <param name="deleteFlag">删除状态</param>
 /// <returns>回复集合的数量</returns>
 public static long findForTypeCount(String contentID, CommentType type, Comm.DeletedFlag deleteFlag)
 {
     try
     {
         QueryComplete qc = Query.And(Query.EQ("CommentToID", contentID), Query.EQ("CommentType", type), Query.EQ("DeleteFlag", deleteFlag));
         return MongoDBHelper.GetCount(Comment.GetCollectionName(), qc);
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }
コード例 #50
0
        private void HistoryDataShow_Load(object sender, EventArgs e)
        {
            // *** BEGIN 控件整体设置 ***
            zed1.IsEnableZoom      = false;
            zed1.IsEnableVZoom     = false;
            zed1.IsEnableHZoom     = false;
            zed1.IsShowContextMenu = false; //禁用右键弹出菜单

            zed1.IsShowPointValues = false; //显示网格上对应值
            //zed1.IsZoomOnMouseCenter = true;  //加上这个鼠标中间可以缩放,但是有问题
            zed1.BackColor   = _BACK_COLOR;
            zed1.BorderStyle = BorderStyle.None;
            // *** END 控件整体值显示 ***

            // *** BEGIN myPane设置 ***
            myPane                        = this.zed1.GraphPane;
            myPane.Fill                   = new Fill(_BACK_COLOR);       //chart外框背景颜色
            myPane.Border.IsVisible       = false;                       //chart图边框不显示
            myPane.Title.IsVisible        = false;                       //chart图抬头不显示
            myPane.Chart.Fill             = new Fill(_BACK_COLOR);       //chart内容绘制区域颜色
            myPane.Chart.Border.IsVisible = false;                       //chart曲线边框不显示
            // *** END myPane设置 ***

            // *** BEGIN X轴设置 ***

            myPane.XAxis.Cross                    = 0.0d;                 //X轴交叉刻度
            myPane.XAxis.CrossAuto                = true;
            myPane.XAxis.Title.IsVisible          = false;                //X轴不显示抬头
            myPane.XAxis.Color                    = Color.DarkGray;       //X轴颜色
            myPane.XAxis.Scale.IsVisible          = true;                 //X轴显示
            myPane.XAxis.Scale.FontSpec.FontColor = Color.GreenYellow;    //X轴字体颜色
            myPane.XAxis.MajorGrid.IsVisible      = true;                 //X轴显示网格
            myPane.XAxis.MajorGrid.Color          = Color.Gray;           //X轴网格颜色
            //X轴最小值0
            myPane.XAxis.Scale.Min       = -1;
            myPane.XAxis.Scale.Max       = 101;                            //X轴最大60
            myPane.XAxis.Scale.IsVisible = false;                          //X轴显示
            //myPane.XAxis.Scale.MajorStepAuto = true;                      //X轴显示步长
            myPane.XAxis.Scale.FontSpec.IsUnderline = false;
            myPane.XAxis.Scale.MajorStep            = 20;                  //X轴小步长1,也就是小间隔
            // *** END X轴设置 ***

            // *** BEGIN Y轴设置 ***

            myPane.YAxis.Title.IsVisible     = false;                     //Y轴不显示抬头
            myPane.YAxis.MinorTic.IsOpposite = false;
            myPane.YAxis.MajorTic.IsOpposite = false;
            myPane.YAxis.Color                    = Color.Transparent; //Y轴颜色
            myPane.YAxis.Scale.IsVisible          = IsShowY;           //Y轴不显示
            myPane.YAxis.Scale.Align              = AlignP.Inside;
            myPane.YAxis.Scale.AlignH             = AlignH.Center;
            myPane.YAxis.Scale.FontSpec.Size      = 6;
            myPane.YAxis.Scale.FontSpec.FontColor = Color.GreenYellow;    //Y轴字体颜色
            myPane.YAxis.MajorGrid.IsVisible      = true;                 //Y轴显示网格
            myPane.YAxis.MajorGrid.Color          = Color.Gray;           //Y轴网格颜色
            //myPane.YAxis.CrossAuto = true;
            //myPane.YAxis.Cross = Comm.ConvertDateTimeInt(DateTime.Now) / 1000;              //这个地方如果加上要影响Memo显示,导致Memo在放大的情况下不能展示出来
            myPane.YAxis.Scale.Max = Comm.ConvertDateTimeInt(DateTime.Now) / 1000; //Y轴从0开始,这个地方要影响X轴的显示
            myPane.YAxis.Scale.Min = myPane.YAxis.Scale.Max - _YCount;             //Y轴上放200个点,这样看起来曲线更平滑
            //myPane.YAxis.Scale.MajorStepAuto = true;                      //Y轴显示步长
            myPane.YAxis.Scale.MajorStep   = _YCount / 10;                         //X轴大步长为5,也就是显示文字的大间隔
            myPane.YAxis.Scale.IsReverse   = true;                                 //从上到下画线
            myPane.YAxis.MinorTic.IsInside = false;
            // *** BEGIN Y轴设置 ***
            addCurves();
            //Y轴显示的文本格式化
            if (IsShowY)
            {
                zed1.GraphPane.YAxis.ScaleFormatEvent += new Axis.ScaleFormatHandler(YAxis_ScaleFormatEvent);
            }
            m_dBaseTime = myPane.YAxis.Scale.Max;// (myPane.YAxis.Scale.Max + myPane.YAxis.Scale.Min) / 2;
            //改变轴的刻度
            zed1.AxisChange();
        }
コード例 #51
0
 /// <summary>
 /// After UpdateObjects call objects can be read using Objects property.
 /// </summary>
 public void UpdateObjects()
 {
     try
     {
         GXDLMSObjectCollection objs = Comm.GetObjects();
         objs.Tag = this;
         int pos = 0;
         foreach (GXDLMSObject it in objs)
         {
             ++pos;
             NotifyProgress(this, "Creating object " + it.LogicalName, pos, objs.Count);
             Objects.Add(it);
         }
         GXLogWriter.WriteLog("--- Created " + Objects.Count.ToString() + " objects. ---");
         //Read registers units and scalers.
         int cnt = Objects.Count;
         if (!UseLogicalNameReferencing)
         {
             GXLogWriter.WriteLog("--- Reading Access rights. ---");
             try
             {
                 foreach (GXDLMSAssociationShortName sn in Objects.GetObjects(ObjectType.AssociationShortName))
                 {
                     Comm.ReadValue(sn, 3);
                 }
             }
             catch (Exception ex)
             {
                 GXLogWriter.WriteLog(ex.Message);
             }
             GXLogWriter.WriteLog("--- Reading Access rights end. ---");
         }
         GXLogWriter.WriteLog("--- Reading scalers and units. ---");
         this.OnProgress(this, "Reading scalers and units.", cnt + pos + 1, 3 * cnt);
         if ((Comm.client.NegotiatedConformance & Gurux.DLMS.Enums.Conformance.MultipleReferences) != 0)
         {
             List <KeyValuePair <GXDLMSObject, int> > list = new List <KeyValuePair <GXDLMSObject, int> >();
             foreach (GXDLMSObject it in Objects)
             {
                 if (it is GXDLMSRegister && (it.GetAccess(3) & AccessMode.Read) != 0)
                 {
                     list.Add(new KeyValuePair <GXDLMSObject, int>(it, 3));
                 }
                 if (it is GXDLMSDemandRegister && (it.GetAccess(4) & AccessMode.Read) != 0)
                 {
                     list.Add(new KeyValuePair <GXDLMSObject, int>(it, 4));
                 }
             }
             if (list.Count != 0)
             {
                 try
                 {
                     Comm.ReadList(list);
                 }
                 catch (Exception)
                 {
                     //Show error.
                 }
             }
         }
         else
         {
             for (pos = 0; pos != cnt; ++pos)
             {
                 GXDLMSObject it = Objects[pos];
                 if (it is GXDLMSRegister)
                 {
                     //Read scaler first.
                     try
                     {
                         Comm.ReadValue(it, 3);
                     }
                     catch (Exception ex)
                     {
                         GXLogWriter.WriteLog(ex.Message);
                         it.SetAccess(3, AccessMode.NoAccess);
                         if (ex is GXDLMSException)
                         {
                             continue;
                         }
                         throw ex;
                     }
                 }
                 if (it is GXDLMSDemandRegister)
                 {
                     //Read scaler first.
                     try
                     {
                         Comm.ReadValue(it, 4);
                     }
                     catch (Exception ex)
                     {
                         GXLogWriter.WriteLog(ex.Message);
                         UpdateError(it, 4, ex);
                         if (ex is GXDLMSException)
                         {
                             continue;
                         }
                         throw ex;
                     }
                     //Read Period
                     try
                     {
                         Comm.ReadValue(it, 8);
                     }
                     catch (Exception ex)
                     {
                         GXLogWriter.WriteLog(ex.Message);
                         UpdateError(it, 8, ex);
                         if (ex is GXDLMSException)
                         {
                             continue;
                         }
                         throw ex;
                     }
                     //Read number of periods
                     try
                     {
                         Comm.ReadValue(it, 9);
                     }
                     catch (Exception ex)
                     {
                         GXLogWriter.WriteLog(ex.Message);
                         UpdateError(it, 9, ex);
                         if (ex is GXDLMSException)
                         {
                             continue;
                         }
                         throw ex;
                     }
                 }
             }
         }
         GXLogWriter.WriteLog("--- Reading scalers and units end. ---");
         this.OnProgress(this, "Reading profile generic columns.", cnt, cnt);
         foreach (Gurux.DLMS.Objects.GXDLMSProfileGeneric it in objs.GetObjects(ObjectType.ProfileGeneric))
         {
             ++pos;
             //Read Profile Generic Columns.
             try
             {
                 NotifyProgress(this, "Get profile generic columns", (2 * cnt) + pos, 3 * objs.Count);
                 UpdateColumns(it, Manufacturers.FindByIdentification(Manufacturer));
                 if (it.CaptureObjects == null || it.CaptureObjects.Count == 0)
                 {
                     continue;
                 }
             }
             catch
             {
                 GXLogWriter.WriteLog(string.Format("Failed to read Profile Generic {0} columns.", it.LogicalName));
                 continue;
             }
         }
     }
     finally
     {
         NotifyProgress(this, "", 0, 0);
     }
 }
コード例 #52
0
        private void setValue(int index, string tag, double value, long timestamp)
        {
            //确保CurveList不为空
            if (zed1.GraphPane.CurveList.Count <= 0)
            {
                return;
            }

            switch (index)
            {
            case 1:
                //取Graph第一个曲线,也就是第一步:在GraphPane.CurveList集合中查找CurveItem
                LineItem curve1 = zed1.GraphPane.CurveList[0] as LineItem;
                if (curve1 == null)
                {
                    return;
                }

                //第二步:在CurveItem中访问PointPairList(或者其它的IPointList),根据自己的需要增加新数据或修改已存在的数据
                IPointListEdit list1 = curve1.Points as IPointListEdit;
                if (list1 == null)
                {
                    return;
                }

                var newValue1 = Comm.UnitConversion(listTag, tag, AppDrill.DrillID.ToString(), value);
                newValue1 = getNewValue(newValue1);
                list1.Add(newValue1, timestamp);
                break;

            case 2:
                //取Graph第一个曲线,也就是第一步:在GraphPane.CurveList集合中查找CurveItem
                LineItem curve2 = zed1.GraphPane.CurveList[1] as LineItem;
                if (curve2 == null)
                {
                    return;
                }

                //第二步:在CurveItem中访问PointPairList(或者其它的IPointList),根据自己的需要增加新数据或修改已存在的数据
                IPointListEdit list2 = curve2.Points as IPointListEdit;
                if (list2 == null)
                {
                    return;
                }

                var newValue2 = Comm.UnitConversion(listTag, tag, AppDrill.DrillID.ToString(), value);
                newValue2 = getNewValue(newValue2);
                list2.Add(newValue2, timestamp);
                break;

            case 3:
                //取Graph第一个曲线,也就是第一步:在GraphPane.CurveList集合中查找CurveItem
                LineItem curve3 = zed1.GraphPane.CurveList[2] as LineItem;
                if (curve3 == null)
                {
                    return;
                }

                //第二步:在CurveItem中访问PointPairList(或者其它的IPointList),根据自己的需要增加新数据或修改已存在的数据
                IPointListEdit list3 = curve3.Points as IPointListEdit;
                if (list3 == null)
                {
                    return;
                }

                var newValue3 = Comm.UnitConversion(listTag, tag, AppDrill.DrillID.ToString(), value);
                newValue3 = getNewValue(newValue3);
                list3.Add(newValue3, timestamp);
                break;

            case 4:
                //取Graph第一个曲线,也就是第一步:在GraphPane.CurveList集合中查找CurveItem
                LineItem curve4 = zed1.GraphPane.CurveList[3] as LineItem;
                if (curve4 == null)
                {
                    return;
                }

                //第二步:在CurveItem中访问PointPairList(或者其它的IPointList),根据自己的需要增加新数据或修改已存在的数据
                IPointListEdit list4 = curve4.Points as IPointListEdit;
                if (list4 == null)
                {
                    return;
                }

                var newValue4 = Comm.UnitConversion(listTag, tag, AppDrill.DrillID.ToString(), value);
                newValue4 = getNewValue(newValue4);
                list4.Add(newValue4, timestamp);
                break;
            }
        }
コード例 #53
0
ファイル: SensorBase.cs プロジェクト: ufjl0683/Center
 public abstract void sensorDev_OnReceiveText(object sender, Comm.TextPackage txtObj);
コード例 #54
0
        private string GetPointValue(double timestamp)
        {
            string strValue = " ";

            try
            {
                double[] xVlaue      = new double[4];
                string[] ParaDisplay = new string[4];

                List <ChartPoint> list1 = new List <ChartPoint>(); List <ChartPoint> list2 = new List <ChartPoint>();
                List <ChartPoint> list3 = new List <ChartPoint>(); List <ChartPoint> list4 = new List <ChartPoint>();
                IPointListEdit    line1 = zed1.GraphPane.CurveList[0].Points as IPointListEdit;
                IPointListEdit    line2 = zed1.GraphPane.CurveList[1].Points as IPointListEdit;
                IPointListEdit    line3 = zed1.GraphPane.CurveList[2].Points as IPointListEdit;
                IPointListEdit    line4 = zed1.GraphPane.CurveList[3].Points as IPointListEdit;

                //取得曲线上的点
                for (int i = 0; i < line1.Count; i++)
                {
                    list1.Add(new ChartPoint((long)line1[i].Y, line1[i].X / 100 * getTagRange(1) + Convert.ToInt16(strFrom1)));
                }
                for (int i = 0; i < line2.Count; i++)
                {
                    list2.Add(new ChartPoint((long)line2[i].Y, line2[i].X / 100 * getTagRange(2) + Convert.ToInt16(strFrom2)));
                }
                for (int i = 0; i < line3.Count; i++)
                {
                    list3.Add(new ChartPoint((long)line3[i].Y, line3[i].X / 100 * getTagRange(3) + Convert.ToInt16(strFrom3)));
                }
                for (int i = 0; i < line4.Count; i++)
                {
                    list4.Add(new ChartPoint((long)line4[i].Y, line4[i].X / 100 * getTagRange(4) + Convert.ToInt16(strFrom4)));
                }
                //取得当前时间点对应的参数值
                try
                {
                    if (list1[0].dateTime < timestamp)
                    {
                        xVlaue[0] = list1.Where(o => o.dateTime >= timestamp).OrderBy(p => p.dateTime).First().value; ParaDisplay[0] = xVlaue[0].ToString();
                    }
                }
                catch
                {
                    ParaDisplay[0] = "NA";
                }

                try
                {
                    if (list2[0].dateTime < timestamp)
                    {
                        xVlaue[1] = list2.Where(o => o.dateTime >= timestamp).OrderBy(p => p.dateTime).First().value; ParaDisplay[1] = xVlaue[1].ToString();
                    }
                }
                catch
                {
                    ParaDisplay[1] = "NA";
                }

                try
                {
                    if (list3[0].dateTime < timestamp)
                    {
                        xVlaue[2] = list3.Where(o => o.dateTime >= timestamp).OrderBy(p => p.dateTime).First().value; ParaDisplay[2] = xVlaue[2].ToString();
                    }
                }
                catch
                {
                    ParaDisplay[2] = "NA";
                }

                try
                {
                    if (list4[0].dateTime < timestamp)
                    {
                        xVlaue[3] = list4.Where(o => o.dateTime >= timestamp).OrderBy(p => p.dateTime).First().value; ParaDisplay[3] = xVlaue[3].ToString();
                    }
                }
                catch
                {
                    ParaDisplay[3] = "NA";
                }

                timestamp *= 1000;
                strValue   = Comm.ConvertIntDateTime(timestamp).ToString() + "\n" + ParaDisplay[0] + "\n" + ParaDisplay[1] + "\n" + ParaDisplay[2] + "\n" + ParaDisplay[3];
            }

            catch
            {
            }
            return(strValue);
        }
コード例 #55
0
 /// <summary>
 /// Y轴显示格式
 /// </summary>
 /// <param name="pane"></param>
 /// <param name="axis"></param>
 /// <param name="val"></param>
 /// <param name="index"></param>
 /// <returns></returns>
 private string YAxis_ScaleFormatEvent(GraphPane pane, Axis axis, double val, int index)
 {
     return(Comm.ConvertIntDateTime(val * 1000).ToString("HH:mm:ss"));//yyyy/MM/dd
 }
コード例 #56
0
        private void DepthTimeChart_Load(object sender, EventArgs e)
        {
            _db = new DrillOSEntities();
            //初次加载,读取当前井深
            // m_irepeateValue = (int)double.Parse(_db.Drill.Where(p => p.ID == AppDrill.DrillID).FirstOrDefault().HoleDepth);

            lbl_time.Text = DateTime.Now.ToString("yyyy/MM/dd");
            try
            {
                if (AppDrill.permissionId != 1 && AppDrill.permissionId != 2)
                {
                    rbtn_message.Enabled = false;
                }
                //获取用户配置页面缓存点个数
                DataShowCnt = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["DataShowCnt"].ToString());
            }
            catch
            {
            }

            // *** BEGIN 控件整体设置 ***
            // zed1.IsShowPointValues = true;    //显示网格上对应值
            zed1.IsEnableZoom      = false;
            zed1.IsEnableVZoom     = false;
            zed1.IsEnableHZoom     = false;
            zed1.IsShowContextMenu = false; //禁用右键弹出菜单
            //zed1.IsZoomOnMouseCenter = true;  //加上这个鼠标中间可以缩放,但是有问题
            zed1.BackColor   = _BACK_COLOR;
            zed1.BorderStyle = BorderStyle.None;
            // *** END 控件整体值显示 ***

            // *** BEGIN myPane设置 ***
            myPane                        = this.zed1.GraphPane;
            myPane.Fill                   = new Fill(_BACK_COLOR);       //chart外框背景颜色
            myPane.Border.IsVisible       = false;                       //chart图边框不显示
            myPane.Title.IsVisible        = false;                       //chart图抬头不显示
            myPane.Chart.Fill             = new Fill(_BACK_COLOR);       //chart内容绘制区域颜色
            myPane.Chart.Border.IsVisible = false;                       //chart曲线边框不显示
            // *** END myPane设置 ***

            // *** BEGIN X轴设置 ***
            myPane.XAxis.Cross                    = 0.0d;                 //X轴交叉刻度
            myPane.XAxis.CrossAuto                = true;
            myPane.XAxis.Title.IsVisible          = false;                //X轴不显示抬头
            myPane.XAxis.IsVisible                = false;                //X轴直接不显示
            myPane.XAxis.Color                    = Color.Transparent;    //X轴颜色
            myPane.XAxis.Scale.IsVisible          = true;                 //X轴显示
            myPane.XAxis.Scale.FontSpec.FontColor = Color.GreenYellow;    //X轴字体颜色
            myPane.XAxis.MajorGrid.IsVisible      = false;                //X轴显示网格
            myPane.XAxis.MajorGrid.Color          = Color.Gray;           //X轴网格颜色
            myPane.XAxis.Scale.Min                = 1;                    //X轴最小值0
            myPane.XAxis.Scale.Max                = 10;                   //X轴最大60
            //myPane.XAxis.Scale.MajorStepAuto = true;                      //X轴显示步长
            myPane.XAxis.Scale.FontSpec.IsUnderline = false;
            //myPane.XAxis.Scale.MajorStep = 1;                             //X轴小步长1,也就是小间隔
            // *** END X轴设置 ***

            // *** BEGIN Y轴设置 ***
            myPane.YAxis.Title.IsVisible     = false;
            myPane.YAxis.MinorTic.IsOpposite = false;                //Y轴1显示抬头
            myPane.YAxis.MajorTic.IsOpposite = false;
            //myPane.YAxis.Title.Text = "Timing";                           //Y轴1时间类型
            //myPane.YAxis.Title.FontSpec.FontColor = Color.YellowGreen;    //Y轴字体颜色
            //myPane.YAxis.Title.FontSpec.Size = 22;
            myPane.YAxis.Color                    = Color.White;    //Y轴颜色
            myPane.YAxis.Scale.IsVisible          = true;           //Y轴显示
            myPane.YAxis.Scale.Align              = AlignP.Inside;
            myPane.YAxis.Scale.AlignH             = AlignH.Center;
            myPane.YAxis.Scale.FontSpec.Size      = 20;
            myPane.YAxis.Scale.FontSpec.FontColor = Color.White;                                  //Y轴字体颜色
            myPane.YAxis.MajorGrid.IsVisible      = true;                                         //Y轴显示网格
            myPane.YAxis.MajorGrid.Color          = Color.WhiteSmoke;                             //Y轴网格颜色
            myPane.YAxis.Scale.Max                = Comm.ConvertDateTimeInt(DateTime.Now) / 1000; //Y轴从0开始,这个地方要影响X轴的显示
            myPane.YAxis.Scale.Min                = myPane.YAxis.Scale.Max - _YCount;
            myPane.YAxis.Scale.MajorStep          = (myPane.YAxis.Scale.Max - myPane.YAxis.Scale.Min) / 10;
            m_dBaseTime = myPane.YAxis.Scale.Max;


            myPane.YAxis.Scale.IsReverse = true;                          //从上到下画线

            // *** ★★★★★ 第二轴设置 ★★★★★ ***
            //myPane.Y2Axis.IsVisible = true;
            //myPane.Y2Axis.Title.IsVisible = true;                         //Y轴2显示抬头
            //myPane.Y2Axis.Title.Text = "Depth";                           //Y轴2时间类型
            //myPane.Y2Axis.Title.FontSpec.Size = 22;
            //myPane.Y2Axis.Color = Color.YellowGreen;
            //myPane.Y2Axis.Scale.FontSpec.Size = 22;
            //myPane.Y2Axis.Scale.FontSpec.FontColor = Color.YellowGreen;
            //myPane.Y2Axis.Title.FontSpec.FontColor = Color.YellowGreen;
            //myPane.Y2Axis.MajorTic.IsOpposite = false;
            //myPane.Y2Axis.MinorTic.IsOpposite = false;
            //myPane.Y2Axis.MajorGrid.IsVisible = true;
            //// Align the Y2 axis labels so they are flush to the axis
            //myPane.Y2Axis.Scale.Align = AlignP.Inside;
            //myPane.Y2Axis.Scale.Min = 0;     // ★★★★★ Y2的最小值可以设置为当前井深
            //myPane.Y2Axis.Scale.Max = myPane.Y2Axis.Scale.Min + _DepthCount;      //可以为一定步长
            //myPane.Y2Axis.Scale.IsReverse = true;
            // *** BEGIN Y轴设置 ***

            // *** BEGIN chart线段设置 ***
            //设置1200个点,假设每50毫秒更新一次,刚好检测1分钟,一旦构造后将不能更改这个值
            RollingPointPairList list1 = new RollingPointPairList(DataShowCnt);

            //RollingPointPairList list2 = new RollingPointPairList(259200);

            // *** ★★★★★ Begin Y2的最小值可以设置为当前井深 ★★★★★
            //list2.Add(6, myPane.Y2Axis.Scale.Min);   //设置当前井深 由于要画线,所以得两个点
            //list2.Add(6, 0);                    //设置当前井深 由于要画线,所以得两个点
            // *** ★★★★★ End Y2的最小值可以设置为当前井深 ★★★★★

            //开始,增加的线是没有数据点的(也就是list为空)
            //★★★增加一条名称:Voltage,颜色Color.Bule,无符号,无数据的空线条
            curve = myPane.AddCurve("", list1, Color.Green, SymbolType.None);
            //curve.YAxisIndex = 0;
            curve.Line.IsSmooth      = true; //平滑曲线
            curve.Line.SmoothTension = 0.6F;

            //curve = myPane.AddCurve("", list2, Color.Red, SymbolType.None);
            curve.IsY2Axis = true;
            //curve.YAxisIndex = 1;                     //★★★ 通过词句,该队列与第二个坐标轴关联
            curve.Line.IsSmooth      = true; //平滑曲线
            curve.Line.Width         = 3;
            curve.Line.SmoothTension = 0.6F;
            // *** END chart线段设置 ***

            zed1.GraphPane.YAxis.ScaleFormatEvent += new Axis.ScaleFormatHandler(YAxis_ScaleFormatEvent);

            //改变轴的刻度
            zed1.AxisChange();
            //保存开始时间
            tickStart = Environment.TickCount;
            //SetDepth(Comm.ConvertDateTimeInt(DateTime.Now) / 1000, 1800);
        }
コード例 #57
0
ファイル: MFCC_BS.cs プロジェクト: ufjl0683/Center
        void MFCC_BS_On_BS_1HourData(Comm.TC.BSTC tc, System.DateTime dt, int respones_type, int slope, int shift, int sink, int degree)
        {
            try
            {
               // int day_var, mon_var;

              //  string validChar = IsValidData(day_var, mon_var) ? "V" : "I";
                string sql = "update tblBSData1Hr set bs_slope={0},bs_shift={1},bs_sink={2},bs_degree={3},DataValidity='V'  where DeviceName='{4}' and timestamp='{5}'";

                Program.mfcc_bs.dbServer.SendSqlCmd(string.Format(sql,slope,shift,sink,degree,tc.DeviceName,Comm.DB2.Db2.getTimeStampString(dt)));

            }
            catch (Exception ex)
            {
                ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
            }
        }
コード例 #58
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string ballType       = this.Request["bt"];
        string sortId         = this.Request["si"];
        string accInDate      = this.Request["ad"];
        string selectAlliance = this.Request["sa"];
        int    playType       = -1;
        int    pageSize       = 10;
        int    pageIndex      = 1;
        int    courtType      = -1;
        int    isBet          = -1;

        if (string.IsNullOrEmpty(ballType))
        {
            return;
        }
        if (string.IsNullOrEmpty(sortId))
        {
            return;
        }
        if (accInDate == null)
        {
            return;
        }
        if (selectAlliance == null)
        {
            return;
        }
        if (!int.TryParse(this.Request["ct"], out courtType))
        {
            return;
        }
        if (!int.TryParse(this.Request["pt"], out playType))
        {
            return;
        }
        if (!int.TryParse(this.Request["ps"], out pageSize))
        {
            return;
        }
        if (!int.TryParse(this.Request["pi"], out pageIndex))
        {
            return;
        }
        if (!int.TryParse(this.Request["ib"], out isBet))
        {
            return;
        }
        List <int> selectAllianceList = new List <int>();

        foreach (string str in selectAlliance.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))
        {
            selectAllianceList.Add(Convert.ToInt32(str));
        }
        List <KFB_LMGL> allAllianceList = new List <KFB_LMGL>();

        int    recordCount            = 0; //比赛资料
        string accOutDate             = "";
        List <List <object> > lm      = new List <List <object> >();
        GameSBall             objGame = new GameSBall();

        List <object[]> gameList = objGame.GetCompanyGameList(ballType, selectAllianceList, courtType, sortId, isBet, accInDate, playType, pageIndex, pageSize, out recordCount, out allAllianceList, out accOutDate);
        List <DateTime> zwrqlist = new List <DateTime>();


        if (playType == 0)    //足球早盘
        {
            zwrqlist = objGame.GetBreakfaseZQ(Comm.GetZWRQ().ToString("yyyy/MM/dd"));
        }
        else if (playType == 10)
        {
            zwrqlist = objGame.GetRecycleRQ(ballType);
        }
        JavaScriptSerializer ser = new JavaScriptSerializer();
        string output            = "";

        //0早餐,1單式,2走地,3過關,4波胆,5半全场,6入球数,7已开赛,8过账前的历史比赛,9过账后的历史比赛,
        //n_gsty  0早餐  1单式  2滚球  3过关  4波胆  5单双/入球数  6半全场
        switch (playType)
        {
        case 0:        //足球早餐
            output = "[" + ser.Serialize(gameList) + "," + ser.Serialize(allAllianceList) + "," + recordCount + ",\"" + accOutDate + "\"," + ser.Serialize(zwrqlist) + "]";
            break;

        case 8:        //已计算
            output = "[" + ser.Serialize(gameList) + "," + ser.Serialize(allAllianceList) + "," + recordCount + ",\"" + accOutDate + "\"," + ser.Serialize(Comm.getZWDate()) + "]";
            break;

        case 9:        //历史比赛
            output = "[" + ser.Serialize(gameList) + "," + ser.Serialize(allAllianceList) + "," + recordCount + ",\"" + accOutDate + "\"," + ser.Serialize(Comm.getZWDate()) + "]";
            break;

        case 10:        //垃圾桶
            output = "[" + ser.Serialize(gameList) + "," + ser.Serialize(allAllianceList) + "," + recordCount + ",\"" + accOutDate + "\"," + ser.Serialize(zwrqlist) + "]";
            break;

        default:
            output = "[" + ser.Serialize(gameList) + "," + ser.Serialize(allAllianceList) + "," + recordCount + ",\"" + accOutDate + "\"]";
            break;
        }
        Response.Write(output);
        Response.End();
    }
コード例 #59
0
ファイル: MFCC_RMS.cs プロジェクト: ufjl0683/Center
        void MFCC_RMS_OnTCReport(object tc, Comm.TextPackage txt)
        {
            //throw new Exception("The method or operation is not implemented.");

            Comm.TC.RMSTC dev = (Comm.TC.RMSTC)tc;
            if (txt.Text[0] == 0x86 || txt.Text[0] == 0xa7 || txt.Text[0] == 0xae || txt.Text[0] == 0xaf && txt.Text[1] == 0x01)
            {
               // ConsoleServer.WriteLine("In Rms Report:0x" + Util.ToHexString(txt.Text[0]));
                System.Data.DataSet ds = this.protocol.GetSendDsByTextPackage(txt, Comm.CmdType.CmdReport);
                ds.AcceptChanges();
                this.notifier.NotifyAll(new NotifyEventObject(EventEnumType.MFCC_Report_Event,dev.DeviceName,ds));

                string sql="";
                switch (txt.Text[0])
                {
                    case 0x86:  //黃閃轉態紀錄
                      //  ConsoleServer.WriteLine("0x86 " + txt.Text[1] +"curr_lamp:"+dev.curr_lamep);
                        if (dev.curr_lamep != txt.Text[1] && dev.curr_lamep == 0x05)
                        {
                            sql = "insert into tblRmsActiveReport (devicename,timestamp,protocol,display) values('{0}','{1}','{2}','{3}')";
                            try
                            {
                                ConsoleServer.WriteLine(dev.DeviceName + ", 黃閃轉態!");
                                ConsoleServer.WriteLine(string.Format(sql, dev.DeviceName, DbCmdServer.getTimeStampString(DateTime.Now), "86", "flash Yellow to other state"));
                                this.dbServer.SendSqlCmd(string.Format(sql, dev.DeviceName, DbCmdServer.getTimeStampString(DateTime.Now), "86", "flash Yellow to other state"));

                            }
                            catch (Exception ex)
                            {
                                ConsoleServer.WriteLine(ex.Message+","+ex.StackTrace);
                            }
                        }
                        dev.curr_lamep = txt.Text[1];
                        break;

                    case 0xa7:

                        sql = "insert into tblRmsActiveReport (devicename,timestamp,protocol,display) values('{0}','{1}','{2}','{3}')";

                        string  display = string.Format("plan_no:{0},warnsetno:{1},", ds.Tables[0].Rows[0]["plan_no"], ds.Tables[0].Rows[0]["warnsetno"]);
                        ConsoleServer.WriteLine("*****A7****" + display);
                        for (int i = 0; i < ds.Tables[1].Rows.Count; i++)
                        {
                            for (int j = 0; j < ds.Tables[1].Columns.Count; j++)
                            {
                                display += ds.Tables[1].Columns[j].ColumnName + i + ":" + ds.Tables[1].Rows[i][j] + ",";
                            }
                        }

                        ConsoleServer.WriteLine("*****A7****"+display);
                        this.dbServer.SendSqlCmd(string.Format(sql, dev.DeviceName, DbCmdServer.getTimeStampString(DateTime.Now), "A7", display.Trim(new char[] { ',' })));

                        break;
                    case 0xae:

                    //bos_id(1:8-15)state(1:0"0_close",1"1_open",2"2_flash")msg_id(1:0-255)
                    int bos_id, state, msg_id;
                    bos_id = txt.Text[1];
                    state = txt.Text[2];
                    msg_id = txt.Text[3];
                    byte[] msgbyte = new byte[32];
                    System.Array.Copy(txt.Text, 4, msgbyte, 0, 32);
                    for (int i = 0; i < msgbyte.Length; i++)
                        if (msgbyte[i] == 0x00)
                            msgbyte[i] = 0x20;
                    string message = Util.Big5BytesToString(msgbyte);
                     display = string.Format("bos_id:{0}, state:{1}, msg_id:{2}, messgae:{3}", bos_id, state, msg_id, message.Trim());
                     sql = "insert into tblRmsActiveReport (devicename,timestamp,protocol,display) values('{0}','{1}','{2}','{3}')";
                    this.dbServer.SendSqlCmd(string.Format(sql, dev.DeviceName, DbCmdServer.getTimeStampString(DateTime.Now), "AE", display));

                    break;

                }
            }
            else if (txt.Text[0] == 0xa6)  // 現場操作燈號改變
            {
                string sql = "insert into tblRmsActiveReport (devicename,timestamp,protocol,display) values('{0}','{1}','{2}','{3}')";
                dbServer.SendSqlCmd(string.Format(sql, dev.DeviceName, DbCmdServer.getTimeStampString(DateTime.Now), "A6", txt.Text[5]));
              //  ConsoleServer.WriteLine(dev.DeviceName + "," + (txt.Text[5] == 0 ? "儀控中止" : "儀控啟動"));
            }
            else if (txt.Text[0] == 0xaa)   //儀控啟動結束
            {

                string sql = "insert into tblRmsActiveReport (devicename,timestamp,protocol,display) values('{0}','{1}','{2}','{3}')";
                this.dbServer.SendSqlCmd(string.Format(sql, dev.DeviceName, DbCmdServer.getTimeStampString(DateTime.Now), "AA", txt.Text[5]));
                dev.isDisplayOff=(txt.Text[5] == 0)?true:false;
                ConsoleServer.WriteLine(dev.DeviceName + "," + (txt.Text[5] == 0 ? "儀控中止" : "儀控啟動"));
            }
            else if (txt.Text[0] == 0xAF && txt.Text[1] == 0x02)
            {
                int year = txt.Text[6] * 256 + txt.Text[7];
                int month = txt.Text[8];
                int day = txt.Text[9];
                int hour = txt.Text[10];
                int min = txt.Text[11];
                uint lvd_flow = (uint)(txt.Text[12] * Math.Pow(256, 3) + txt.Text[13] * Math.Pow(256, 2) + txt.Text[14] * Math.Pow(256, 1) + txt.Text[15]);
                int l_no = txt.Text[16];
                int l_mode = txt.Text[17];
                System.DateTime dt = new DateTime(year, month, day, hour, min, 0);

                string display = string.Format("vd_flow:{0},l_no:{1},l_mode:{2}", lvd_flow, l_no, l_mode);

                string sql = "insert into tblRmsActiveReport (devicename,timestamp,protocol,display) values('{0}','{1}','{2}','{3}')";
                this.dbServer.SendSqlCmd(string.Format(sql, dev.DeviceName, DbCmdServer.getTimeStampString(dt), "AF02", display));

            }
            else if (txt.Text[0] == 0xAF && txt.Text[1] == 0x01)
            {
                // main_occ(1:0-100)main_flow(1:0-255)vdq_occ(1:0-100)vdq_flow(1:0-255)lvd_occ(1:0-255)lvd_flow(1:0-255)
                int year = txt.Text[6] * 256 + txt.Text[7];
                int month = txt.Text[8];
                int day = txt.Text[9];
                int hour = txt.Text[10];
                int min = txt.Text[11];
                int sec = txt.Text[12];
                uint main_occ = txt.Text[13];
                int main_flow = txt.Text[14];
                int vdq_occ = txt.Text[15];
                int vdq_flow = txt.Text[16];
                int lvd_occ = txt.Text[17];
                int lvd_flow = txt.Text[18];
                System.DateTime dt = new DateTime(year, month, day, hour, min,sec);

                string display = string.Format("main_occ:{0},main_flow:{1},vdq_occ:{2},vdq_flow:{3},lvd_occ:{4},lvd_flow:{5}", main_occ,main_flow,vdq_occ,vdq_flow,lvd_occ,main_flow);

                string sql = "insert into tblRmsActiveReport (devicename,timestamp,protocol,display) values('{0}','{1}','{2}','{3}')";
                this.dbServer.SendSqlCmd(string.Format(sql, dev.DeviceName, DbCmdServer.getTimeStampString(dt), "AF01", display));

            }
            else if (txt.Text[0] == 0xAF && txt.Text[1] == 0x03)
            {
              //  lvd_flow(0:0-255)state(1:0-1)
                int year = txt.Text[6] * 256 + txt.Text[7];
                int month = txt.Text[8];
                int day = txt.Text[9];
                int hour = txt.Text[10];
                int min = txt.Text[11];
                int lvd_flow = txt.Text[12];
                int state=txt.Text[13];

                System.DateTime dt = new DateTime(year, month, day, hour, min,0);

                string display = string.Format("lvd_flow:{0},state:{1}",lvd_flow,state);

                string sql = "insert into tblRmsActiveReport (devicename,timestamp,protocol,display) values('{0}','{1}','{2}','{3}')";
                this.dbServer.SendSqlCmd(string.Format(sql, dev.DeviceName, DbCmdServer.getTimeStampString(dt), "AF03", display));

            }
        }
コード例 #60
0
        protected override void ProcessColumnInfo()
        {
            // We are connected to a Sql 7.0 server
            if (TdsVersion < TdsVersion.tds80)
            {
                base.ProcessColumnInfo();
                return;
            }

            // VARADHAN: TDS 8 Debugging
            //Console.WriteLine ("Tds80.cs: In ProcessColumnInfo... entry");
            int numColumns = Comm.GetTdsShort();

            //Console.WriteLine ("Column count={0}", numColumns); TDS 8 Debugging
            for (int i = 0; i < numColumns; i += 1)
            {
                byte[] flagData = new byte[4];
                for (int j = 0; j < 4; j += 1)
                {
                    flagData[j] = Comm.GetByte();
                }

                bool nullable = (flagData[2] & 0x01) > 0;
                //bool caseSensitive = (flagData[2] & 0x02) > 0;
                bool writable      = (flagData[2] & 0x0c) > 0;
                bool autoIncrement = (flagData[2] & 0x10) > 0;
                bool isIdentity    = (flagData[2] & 0x10) > 0;

                TdsColumnType columnType = (TdsColumnType)(Comm.GetByte() & 0xff);
                //Console.WriteLine ("Actual ColumnType: {0}", columnType);  TDS 8 Debugging

                if ((byte)columnType == 0xef)
                {
                    columnType = TdsColumnType.NChar;
                }

                TdsColumnType xColumnType = columnType;
                if (IsLargeType(columnType))
                {
                    if (columnType != TdsColumnType.NChar)
                    {
                        columnType -= 128;
                    }
                }

                int    columnSize;
                string tableName = null;
                byte[] collation = null;
                int    lcid = 0, sortId = 0;

                if (IsBlobType(columnType))
                {
                    columnSize = Comm.GetTdsInt();
                }
                else if (IsFixedSizeColumn(columnType))
                {
                    columnSize = LookupBufferSize(columnType);
                }
                else if (IsLargeType(xColumnType))
                {
                    columnSize = Comm.GetTdsShort();
                }
                else
                {
                    columnSize = Comm.GetByte() & 0xff;
                }

                if (xColumnType == TdsColumnType.BigChar || xColumnType == TdsColumnType.BigNVarChar ||
                    xColumnType == TdsColumnType.BigVarChar || xColumnType == TdsColumnType.NChar ||
                    xColumnType == TdsColumnType.NVarChar || xColumnType == TdsColumnType.Text ||
                    xColumnType == TdsColumnType.NText)
                {
                    // Read collation for SqlServer 2000 and beyond
                    collation = Comm.GetBytes(5, true);
                    lcid      = TdsCollation.LCID(collation);
                    sortId    = TdsCollation.SortId(collation);
                }

                if (IsBlobType(columnType))
                {
                    tableName = Comm.GetString(Comm.GetTdsShort());
                    //Console.WriteLine ("Tablename: "+tableName);  TDS 8 Debugging
                }

                byte precision = 0;
                byte scale     = 0;

                switch (columnType)
                {
                case TdsColumnType.NText:
                case TdsColumnType.NChar:
                case TdsColumnType.NVarChar:
                    columnSize /= 2;
                    break;

                case TdsColumnType.Decimal:
                case TdsColumnType.Numeric:
                    //Comm.Skip (1);
                    precision = Comm.GetByte();
                    //Console.WriteLine ("Precision: {0}", precision);  TDS 8 Debugging
                    scale = Comm.GetByte();
                    //Console.WriteLine ("Scale: {0}", scale);  TDS 8 Debugging
                    break;
                }

                string columnName = Comm.GetString(Comm.GetByte());

                TdsDataColumn col = new TdsDataColumn();
                Columns.Add(col);
#if NET_2_0
                col.ColumnType       = columnType;
                col.ColumnName       = columnName;
                col.IsAutoIncrement  = autoIncrement;
                col.IsIdentity       = isIdentity;
                col.ColumnSize       = columnSize;
                col.NumericPrecision = precision;
                col.NumericScale     = scale;
                col.IsReadOnly       = !writable;
                col.AllowDBNull      = nullable;
                col.BaseTableName    = tableName;
                col.LCID             = lcid;
                col.SortOrder        = sortId;
#else
                col ["ColumnType"]       = columnType;
                col ["ColumnName"]       = columnName;
                col ["IsAutoIncrement"]  = autoIncrement;
                col ["IsIdentity"]       = isIdentity;
                col ["ColumnSize"]       = columnSize;
                col ["NumericPrecision"] = precision;
                col ["NumericScale"]     = scale;
                col ["IsReadOnly"]       = !writable;
                col ["AllowDBNull"]      = nullable;
                col ["BaseTableName"]    = tableName;
                col ["LCID"]             = lcid;
                col ["SortOrder"]        = sortId;
#endif
            }
            //Console.WriteLine ("Tds80.cs: In ProcessColumnInfo... exit");  TDS 8 Debugging
        }