Example #1
0
            public AccountType(string name, string psw, string lvl)
            {
                mName = name;
                mPsw  = psw;
                mLvl  = lvl;
                //add to database
                HttpHandler handler = new HttpHandler(DAO.sConsoleUrl);
                ConsoleCodeUpTransmissionType up = new ConsoleCodeUpTransmissionType();

                up.mCode   = "11N1";
                up.mParamL = StdMd5Maker.toMd5String(DAO.sUserName + DAO.sPassword);
                up.mParamU = "RPAT&" + mName + "&" + mPsw + "&" + mLvl;
                ConsoleCodeDownTransmissionType newDown = new ConsoleCodeDownTransmissionType();
                HttpHandlerException            newE    = handler.goSingle(up, out newDown, "POST");

                if (newE.IsOK())
                {
                    mId     = Convert.ToInt32(newDown.mServiceAnwser);
                    mInited = true;
                }
                else
                {
                    throw new Exception(newE.getMessage());
                }
            }
            public FlowerInfoType(string name, string description, string info)
            {
                mName        = name;
                mDescription = description;
                mInfo        = info;
                //add to database
                HttpHandler handler = new HttpHandler(DAO.sConsoleUrl);
                ConsoleCodeUpTransmissionType up = new ConsoleCodeUpTransmissionType();

                up.mCode   = "11N1";
                up.mParamL = StdMd5Maker.toMd5String(DAO.sUserName + DAO.sPassword);
                up.mParamU = "RPFI&" + mName + "&" + mDescription + "&" + mInfo;
                ConsoleCodeDownTransmissionType newDown = new ConsoleCodeDownTransmissionType();
                HttpHandlerException            newE    = handler.goSingle(up, out newDown, "POST");

                if (newE.IsOK())
                {
                    mId     = Convert.ToInt32(newDown.mServiceAnwser);
                    mInited = true;
                }
                else
                {
                    throw new Exception(newE.getMessage());
                }
            }
Example #3
0
            public AccountType(int id)
            {
                mId = id;
                //read from database
                HttpHandler handler = new HttpHandler(DAO.sConsoleUrl);
                ConsoleCodeUpTransmissionType up = new ConsoleCodeUpTransmissionType();

                up.mCode   = "11R1";
                up.mParamL = StdMd5Maker.toMd5String(DAO.sUserName + DAO.sPassword);
                up.mParamU = "RPAT&" + id;
                ConsoleCodeDownTransmissionType readDown = new ConsoleCodeDownTransmissionType();
                HttpHandlerException            readE    = handler.goSingle(up, out readDown, "POST");

                if (readE.IsOK())
                {
                    string[] dataGrp = readDown.mServiceAnwser.Split('&');
                    mName   = dataGrp[0];
                    mPsw    = dataGrp[1];
                    mLvl    = dataGrp[2];
                    mInited = true;
                }
                else
                {
                    throw new Exception(readE.getMessage());
                }
            }
        public FlowerPicCtrl(string name, string description, byte[] buf, string type, Action onDelete)
        {
            mName        = name;
            mDescription = description;
            mPicBuf      = buf;
            mType        = type;
            mOnDelete    = onDelete;
            //add to database
            HttpHandler handler = new HttpHandler(DAO.sConsoleUrl);
            ConsoleCodeUpTransmissionType up = new ConsoleCodeUpTransmissionType();

            up.mCode   = "11N1";
            up.mParamL = StdMd5Maker.toMd5String(DAO.sUserName + DAO.sPassword);
            up.mParamU = "RPFP&" + mName + "&" + mDescription + "&" + mType + "&" + Convert.ToBase64String(mPicBuf);
            ConsoleCodeDownTransmissionType newDown = new ConsoleCodeDownTransmissionType();
            HttpHandlerException            newE    = handler.goSingle(up, out newDown, "POST");

            if (newE.IsOK())
            {
                mId     = Convert.ToInt32(newDown.mServiceAnwser);
                mInited = true;
            }
            else
            {
                throw new Exception(newE.getMessage());
            }

            InitializeComponent();
        }
Example #5
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            mHttpMethodBox.SelectedIndex = 0;
            mPostParams.layObject(new ConsoleCodeUpTransmissionType());
            mConsoleUrlBox.Text = DAO.sConsoleUrl;

            ConsoleCodeUpTransmissionType up = new ConsoleCodeUpTransmissionType();

            up.mCode   = "00T1";
            up.mParamL = StdMd5Maker.toMd5String(DAO.sUserName + DAO.sPassword);
            HttpHandler handler = new HttpHandler(mConsoleUrlBox.Text);

            handler.goSingleAsync <ConsoleCodeDownTransmissionType>(up, "POST", handleHttpResponse);
        }
Example #6
0
            public void remove()
            {
                HttpHandler handler = new HttpHandler(DAO.sConsoleUrl);
                ConsoleCodeUpTransmissionType up = new ConsoleCodeUpTransmissionType();

                up.mCode   = "11D0";
                up.mParamL = StdMd5Maker.toMd5String(DAO.sUserName + DAO.sPassword);
                up.mParamU = "RPAT&" + mId;
                ConsoleCodeDownTransmissionType deleteDown = new ConsoleCodeDownTransmissionType();
                HttpHandlerException            removeE    = handler.goSingle(up, out deleteDown, "POST");

                if (!removeE.IsOK())
                {
                    throw new Exception(removeE.getMessage());
                }
            }
Example #7
0
            private void sync()
            {
                HttpHandler handler = new HttpHandler(DAO.sConsoleUrl);
                ConsoleCodeUpTransmissionType up = new ConsoleCodeUpTransmissionType();

                up.mCode   = "11U0";
                up.mParamL = StdMd5Maker.toMd5String(DAO.sUserName + DAO.sPassword);
                up.mParamU = "RPAT&" + mId + "&" + mName + "&" + mPsw + "&" + mLvl;
                ConsoleCodeDownTransmissionType upDateDown = new ConsoleCodeDownTransmissionType();
                HttpHandlerException            syncE      = handler.goSingle(up, out upDateDown, "POST");

                if (!syncE.IsOK())
                {
                    throw new Exception(syncE.getMessage());
                }
            }
        public FlowerPicCtrl(int id, Action onDelete)
        {
            mId       = id;
            mOnDelete = onDelete;
            //read from database
            HttpHandler handler = new HttpHandler(DAO.sConsoleUrl);
            ConsoleCodeUpTransmissionType up = new ConsoleCodeUpTransmissionType();

            up.mCode   = "11R1";
            up.mParamL = StdMd5Maker.toMd5String(DAO.sUserName + DAO.sPassword);
            up.mParamU = "RPFP&" + id;
            ConsoleCodeDownTransmissionType readDown = new ConsoleCodeDownTransmissionType();
            HttpHandlerException            readE    = handler.goSingle(up, out readDown, "POST");

            if (readE.IsOK())
            {
                string[] dataGrp = readDown.mServiceAnwser.Split('&');
                mName        = dataGrp[0];
                mDescription = dataGrp[1];
                mType        = dataGrp[2];
                StringBuilder picData = new StringBuilder();
                picData.Append(dataGrp[3]);
                if (dataGrp.Length > 4)
                {
                    //recover data
                    for (int index = 4; index < dataGrp.Length; ++index)
                    {
                        picData.Append("&").Append(dataGrp[index]);
                    }
                }
                mPicBuf = Convert.FromBase64String(picData.ToString());

                mInited = true;
            }
            else
            {
                throw new Exception(readE.getMessage());
            }

            InitializeComponent();
        }
Example #9
0
        private void refreshTable()
        {
            this.Dispatcher.Invoke(new Action(delegate {
                mPicTable.Children.Clear();
            }));
            HttpHandler handler = new HttpHandler(DAO.sConsoleUrl);
            ConsoleCodeUpTransmissionType up = new ConsoleCodeUpTransmissionType();

            up.mCode   = "11P1";
            up.mParamL = StdMd5Maker.toMd5String(DAO.sUserName + DAO.sPassword);
            up.mParamU = "RPFP&" + (sPageSize * mPageNo).ToString() + "&" + sPageSize.ToString();
            handler.goSingleAsync(up, "POST", new Action <ConsoleCodeDownTransmissionType, HttpHandlerException>(
                                      delegate(ConsoleCodeDownTransmissionType idDown, HttpHandlerException idE) {
                if (!idE.IsOK())
                {
                    this.Dispatcher.Invoke(new Action(delegate {
                        mHttpState.Content = idE.getMessage();
                    }));
                    return;
                }

                string[] idGrp  = idDown.mServiceAnwser.Split('&');
                Action onDelete = new Action(delegate { refreshTable(); });
                foreach (string id in idGrp)
                {
                    if (id.Equals(""))
                    {
                        break;
                    }

                    this.Dispatcher.Invoke(new Action(delegate {
                        FlowerPicCtrl ctrl = new FlowerPicCtrl(Convert.ToInt32(id), onDelete);
                        mPicTable.Children.Add(ctrl);
                    }));
                }
                this.Dispatcher.Invoke(new Action(delegate {
                    mHttpState.Content = "OK";
                }));
            }));
        }
Example #10
0
        private void refreshTable()
        {
            List <AccountType> accountList = new List <AccountType>();

            HttpHandler handler = new HttpHandler(DAO.sConsoleUrl);
            ConsoleCodeUpTransmissionType up = new ConsoleCodeUpTransmissionType();

            up.mCode   = "11P1";
            up.mParamL = StdMd5Maker.toMd5String(DAO.sUserName + DAO.sPassword);
            up.mParamU = "RPAT&" + (sPageSize * mPageNo).ToString() + "&" + sPageSize.ToString();
            handler.goSingleAsync(up, "POST", new Action <ConsoleCodeDownTransmissionType, HttpHandlerException>(
                                      delegate(ConsoleCodeDownTransmissionType idDown, HttpHandlerException idE) {
                if (!idE.IsOK())
                {
                    this.Dispatcher.Invoke(new Action(delegate {
                        mHttpState.Content = idE.getMessage();
                    }));
                    return;
                }

                string[] idGrp = idDown.mServiceAnwser.Split('&');
                foreach (string id in idGrp)
                {
                    if (id.Equals(""))
                    {
                        break;
                    }
                    AccountType account = new AccountType(Convert.ToInt32(id));
                    accountList.Add(account);
                }
                this.Dispatcher.Invoke(new Action(delegate {
                    mAccountTable.ItemsSource = accountList;
                    mHttpState.Content        = "OK";
                }));
            }));
        }