Ejemplo n.º 1
0
        private void DoWalletQuery(QueryCriteria c)
        {
            int handle = 0;

            Global.BCCInit();
            //make a new bcc handle
            handle = BCCHelper.NewXpackHandle(@"KSLib\cpack.dat");
            //prepare input params
            BCCHelper.SetIntFieldByName(handle, 0, "lvol1", string.IsNullOrEmpty(c.CustomerId) ? 0 : Convert.ToInt32(c.CustomerId));
            BCCHelper.SetStringFieldByName(handle, 0, "sall_name", c.CustomerName);

            BCCHelper.SetIntFieldByName(handle, 0, "lvol3", string.IsNullOrEmpty(c.Category) ? 0 : Convert.ToInt32(c.Category));
            BCCHelper.SetIntFieldByName(handle, 0, "lvol5", string.IsNullOrEmpty(c.FeeType) ? 0 : Convert.ToInt32(c.FeeType));

            BCCHelper.SetStringFieldByName(handle, 0, "smarket_code2", c.Sex);
            BCCHelper.SetStringFieldByName(handle, 0, "scust_auth2", c.SchoolId);

            if (BCCHelper.SetRequestType(handle, 841601))
            {
                int           errCode       = 0;
                int           retCode       = -1;
                bool          hasMorePack   = false;
                StringBuilder errMsg        = new StringBuilder(255);
                bool          requestStatus = BCCHelper.CallRequest(handle, Global.Drtp_NO, Global.Drtp_Branch, Global.BCC_BaseFunction, 5000, ref errCode, errMsg);
                if (!requestStatus)
                {
                    Global.Logger.Warn(string.Format("BCCHelper.CallRequest[841601] failed! errorCode ={0} and errMsg= {1}", errCode, errMsg));
                    Invoke(new QueryResultInvoker(HideLoadingForm));
                    Invoke(new Action(RestoreUI));
                    return;
                }
                BCCHelper.GetRetCode(handle, ref retCode);
                int packageCnt = 0;
                do
                {
                    if (retCode != 0)
                    {
                        continue;
                    }
                    //show data rows of package into grid view
                    packageCnt++;
                    Global.Logger.Info("do package data show with package#:" + packageCnt);
                    DoPackageDataShow(handle);
                } while (hasMorePack = BCCHelper.HaveNextPack(handle) && BCCHelper.CallNext(handle, 5000, ref errCode, errMsg));
            }//
            else
            {
                Global.Logger.Info("BCCHelper.SetRequestType[841601] failed!");
            }
            //release cpack handle
            if (handle != 0)
            {
                BCCHelper.DeleteXpackHandle(handle);
                Global.Logger.Info("delete xpack handle");
            }
            //show data in grid
            Invoke(new QueryResultInvoker(AddCustomersToGrid));
            //hide loading form
            Invoke(new QueryResultInvoker(HideLoadingForm));
        } //end of DoWalletQuery(QueryCriteria c)
Ejemplo n.º 2
0
        private string SignIn()
        {
            string key    = string.Empty;
            int    handle = 0;

            Global.BCCInit();
            //make a new bcc handle
            handle = BCCHelper.NewXpackHandle(@"KSLib\cpack.dat");
            //prepare input params
            string myIp  = Utility.GetHostIP();
            string myMac = Utility.GetHostMac();

            BCCHelper.SetStringFieldByName(handle, 0, "scust_limit", "192.168.0.127");
            BCCHelper.SetStringFieldByName(handle, 0, "scust_limit2", "00-21-5E-68-40-20");
            BCCHelper.SetStringFieldByName(handle, 0, "scert_no", "sungard kingstar gateway common version");
            if (BCCHelper.SetRequestType(handle, 950001))
            {
                int           errCode       = 0;
                int           retCode       = -1;
                StringBuilder errMsg        = new StringBuilder(255);
                bool          requestStatus = BCCHelper.CallRequest(handle, Global.Drtp_NO, Global.Drtp_Branch, Global.BCC_BaseFunction, 5000, ref errCode, errMsg);
                if (!requestStatus)
                {
                    Splasher.Status = "调用后台功能号失败:[950001]";
                    Global.Logger.Warn("BCCHelper.CallRequest [950001] failed and errorcode =" + errCode + errMsg);
                }
                BCCHelper.GetRetCode(handle, ref retCode);
                if (retCode == 0)
                {
                    StringBuilder val = new StringBuilder(256);
                    BCCHelper.GetStringFieldByName(handle, 0, "scust_limit", val, 256);
                    key             = val.ToString();
                    Splasher.Status = string.Format("签到成功:[{0}]", val);
                }
                else
                {
                    Splasher.Status = "子系统签到失败!";
                    Global.Logger.Warn("BCCHelper.CallRequest [950001] failed and return code = : " + retCode);
                }
            }
            else
            {
                Splasher.Status = "设置后台功能号失败:[950001]";
                Global.Logger.Warn("BCCHelper.SetRequestType [950001] failed!");
            }
            if (handle != 0)
            {
                BCCHelper.DeleteXpackHandle(handle);
            }
            return(key);
        } //end of SignIn()
Ejemplo n.º 3
0
        private void DoWalletRegister(object obj)
        {
            List <Customer> list = obj as List <Customer>;

            if (list != null && list.Count > 0)
            {
                int handle = 0;
                Global.BCCInit();
                //make a new bcc handle
                handle = BCCHelper.NewXpackHandle(@"KSLib\cpack.dat");
                foreach (Customer c in list)
                {
                    DoSingleWalletRegister(c, handle);
                }
                //delete handle
                if (handle > 0)
                {
                    BCCHelper.DeleteXpackHandle(handle);
                }
                //hide form
                Invoke(new QueryResultInvoker(HideLoadingForm));
            }
        }
Ejemplo n.º 4
0
        private void PrepareRelations()
        {
            if (dtRelation == null)
            {
                dtRelation = new DataTable("relations");
                dtRelation.Columns.Add("StaffId", typeof(string));
                dtRelation.Columns.Add("Name", typeof(string));
                dtRelation.Columns.Add("WalletId", typeof(string));
                dtRelation.PrimaryKey = new DataColumn[] { dtRelation.Columns[0] };
            }
            dtRelation.Rows.Clear();

            int handle = 0;

            Global.BCCInit();
            //make a new bcc handle
            handle = BCCHelper.NewXpackHandle(@"KSLib\cpack.dat");
            if (BCCHelper.SetRequestType(handle, 841601))
            {
                int           errCode       = 0;
                int           retCode       = -1;
                bool          hasMorePack   = false;
                StringBuilder errMsg        = new StringBuilder(255);
                bool          requestStatus = BCCHelper.CallRequest(handle, Global.Drtp_NO, Global.Drtp_Branch, Global.BCC_BaseFunction, 5000, ref errCode, errMsg);
                if (!requestStatus)
                {
                    Global.Logger.Warn(string.Format("BCCHelper.CallRequest[841601] failed! errorCode ={0} and errMsg= {1}", errCode, errMsg));
                    return;
                }
                BCCHelper.GetRetCode(handle, ref retCode);
                //int packageCnt = 0;
                do
                {
                    if (retCode != 0)
                    {
                        continue;
                    }
                    //show data rows of package into grid view
                    int cnt = 0;
                    BCCHelper.GetRecordCount(handle, ref cnt);
                    for (int rowIndex = 0; rowIndex < cnt; rowIndex++)
                    {
                        DataRow dr = dtRelation.NewRow();
                        dr["StaffId"]  = BCCHelper.GetStringFieldByName(handle, rowIndex, "scust_auth2");
                        dr["Name"]     = BCCHelper.GetStringFieldByName(handle, rowIndex, "sname");
                        dr["WalletId"] = BCCHelper.GetStringFieldByName(handle, rowIndex, "sname2");
                        dtRelation.Rows.Add(dr);
                    }
                } while (hasMorePack = BCCHelper.HaveNextPack(handle) && BCCHelper.CallNext(handle, 5000, ref errCode, errMsg));
            }
            else
            {
                Global.Logger.Info("BCCHelper.SetRequestType[841601] failed!");
            }
            //release cpack handle
            if (handle != 0)
            {
                BCCHelper.DeleteXpackHandle(handle);
                Global.Logger.Info("delete xpack handle for request type= 841601");
            }
        }