public bool Register()
 {
     try
     {
         RegResult result = this.taxCard.TBRegister();
         if (result == null)
         {
             this.loger.Debug("报税盘注册失败");
             return(false);
         }
         if (result == 1)
         {
             this.loger.Debug("报税盘已经注册");
             return(false);
         }
         if (result == 2)
         {
             this.loger.Debug("报税盘注册成功");
             return(true);
         }
     }
     catch (Exception exception)
     {
         ExceptionHandler.HandleError(exception);
     }
     this.loger.Debug("其他情况:返回true");
     return(true);
 }
Exemple #2
0
 internal static extern IntPtr RegCreateKeyEx(
     IntPtr hKey,
     string subKey,
     IntPtr Reserved,
     string lpClass,
     RegOption dwOptions,
     RegSAM samDesired,
     ref SECURITY_ATTRIBUTES lpSecurityAttributes,
     out IntPtr hkResult,
     out RegResult lpdwDisposition);
 static extern int RegCreateKeyEx(
     IntPtr hKey,
     string lpSubKey,
     int Reserved,
     string lpClass,
     RegOption dwOptions,
     RegSAM samDesired,
     SecurityAttributes lpSecurityAttributes,
     out IntPtr phkResult,
     out RegResult lpdwDisposition);
Exemple #4
0
 static extern Int32 RegCreateKeyEx(
     UInt32 hKey,
     String lpSubKey,
     UInt32 Reserved,
     String lpClass,
     RegOption dwOptions,
     RegSAM samDesired,
     IntPtr lpSecurityAttributes,
     out UInt32 phkResult,
     out RegResult lpdwDisposition);
Exemple #5
0
 public static extern int RegCreateKeyEx(
     [In] SafeRegistryHandle hKey,
     [In] string lpSubKey,
     [In, MarshalAs(UnmanagedType.U4)] int Reserved,
     [In] string lpClass,
     [In, MarshalAs(UnmanagedType.U4)] RegOption dwOptions,
     [In, MarshalAs(UnmanagedType.U4)] RegSAM samDesired,
     [In] IntPtr lpSecurityAttributes,
     [Out] out SafeRegistryHandle phkResult,
     [Out] out RegResult lpdwDisposition);
Exemple #6
0
 static extern int RegCreateKeyEx(
     int hKey,
     string lpSubKey,
     int Reserved,
     string lpClass,
     RegOption dwOptions,
     RegSAM samDesired,
     SECURITY_ATTRIBUTES lpSecurityAttributes,
     out int phkResult,
     out RegResult lpdwDisposition);
 public void Register()
 {
     try
     {
         TaxCard card = TaxCardFactory.CreateTaxCard();
         if (!this.taxReportRegisterBLL.GetRegeisteredSign())
         {
             RegResult result = card.TBRegister();
             if (result == null)
             {
                 int message = card.get_RetCode();
                 loger.Debug(message);
                 if (message != 0)
                 {
                     string str = "TCD_" + message.ToString() + "_";
                     loger.Debug(str);
                     MessageManager.ShowMsgBox(str);
                 }
                 else
                 {
                     MessageManager.ShowMsgBox("INP-232102", new string[] { "报税盘注册成功" });
                     this.bIsRegistered = true;
                 }
             }
             else if (result == 1)
             {
                 MessageManager.ShowMsgBox("INP-232102", new string[] { "报税盘已经注册" });
                 this.bIsRegistered = true;
             }
             else
             {
                 MessageManager.ShowMsgBox("INP-232102", new string[] { "报税盘注册成功" });
                 this.bIsRegistered = true;
             }
         }
         else
         {
             MessageManager.ShowMsgBox("INP-232102", new string[] { "报税盘已经注册" });
             this.bIsRegistered = true;
         }
     }
     catch (Exception exception)
     {
         MessageManager.ShowMsgBox("INP-232101", new string[] { exception.ToString() });
     }
 }
Exemple #8
0
        public static void RegistryCreateKey(
            IntPtr hKey,
            string lpSubKey,
            int reserved,
            string lpClass,
            RegOption dwOptions,
            RegSAM samDesired,
            SecurityAttributes lpSecurityAttributes,
            out IntPtr phkResult,
            out RegResult lpdwDisposition)
        {
            int error;

            if ((error = RegCreateKeyEx(hKey, lpSubKey, reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, out phkResult, out lpdwDisposition)) != 0)
            {
                throw new Win32Exception(error);
            }
        }
        public async Task <RegResult> Register(string email, string username, string password, string cpassword)
        {
            RegResult RR = RegResult.Success;

            if (password != cpassword)
            {
                RR = RegResult.PWNotMatch;
            }

            Account emailAcc = await _AccService.GetByEmail(email);

            if (emailAcc != null)
            {
                RR = RegResult.EmailX;
            }

            Account userNameAcc = await _AccService.GetByUsername(username);

            if (userNameAcc != null)
            {
                RR = RegResult.UsernameX;
            }

            if (RR == RegResult.Success)
            {
                string hashedPassword = _passwordHasher.HashPassword(password);

                User user = new User()
                {
                    Email        = email,
                    Username     = username,
                    PasswordHash = hashedPassword,
                    DateJoined   = DateTime.Now
                };

                Account account = new Account()
                {
                    WhichUser = user
                };

                await _AccService.Create(account);
            }
            return(RR);
        }
Exemple #10
0
        private void HandleRegResult(string hotkeyStr, Label label, RegResult result)
        {
            switch (result)
            {
            case RegResult.ParseError:
                MessageBox.Show(string.Format(I18N.GetString("Cannot parse hotkey: {0}"), hotkeyStr));
                break;

            case RegResult.UnregSuccess:
                label.ResetBackColor();
                break;

            case RegResult.RegSuccess:
                label.BackColor = Color.Green;
                break;

            case RegResult.RegFailure:
                label.BackColor = Color.Red;
                break;

            default:
                break;
            }
        }
Exemple #11
0
        async void LvPlanning_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            db = App.dbHandler.db;             //set db could be cleaned up
            Planning p = e.Item as Planning;

            // if planningItem tapped then load registrations from server
            //  only if status == Planned
            if (p.StatusID == StatusTypes.Planned)
            {
                try {
                    SetWaitStatus(true);
                    lbProgress.Text = AppResources.lblProgressRegistrations;

                    MobRegService service = new MobRegService(ProgramVars.URL);

                    RegResult result = await service.GetRegistrationsAsync(new GetRegistrationInput()
                    {
                        userID         = App.appSettings.loginVars.userID.ToString(),
                        installationID = App.appSettings.installationID,
                        planningID     = p.ID
                    });

                    if (result.statusCode == 0)
                    {
                        // Has Registrations
                        //
                        if (result.Registrations != null)
                        {
                            foreach (rsRegistration rg in result.Registrations)
                            {
                                Registration registration = new Registration()
                                {
                                    ID         = rg.ID.ToString(), PlanningID = rg.PlanningID.ToString(), OrderID = rg.OrderID.ToString(), UserID = rg.UserID.ToString(),
                                    RegTypeID  = rg.RegTypeID, Priority = rg.Priority, IsDisplayed = rg.IsDisplayed, IsOnReport = rg.IsOnReport,
                                    IsRequired = rg.IsRequired, IsReadingOnly = rg.IsReadingOnly, Caption = rg.Caption, Result = rg.Result,
                                    PathName   = rg.PathName, Input = rg.Input, Date = rg.Date, IsChanged = rg.IsChanged, IsClientReg = rg.IsClientReg, IsDeleted = rg.IsDeleted
                                };
                                db.Insert(registration);
                                if (registration.RegTypeID == RegistrationTypes.Picture)
                                {
                                    IFileSystem fileSystem = DependencyService.Get <IFileSystem> ();

                                    using (Stream saveToStream = fileSystem.CreateFileStream(fileSystem.GetDataPath($"{registration.ID}.jpg"))) {
                                        MobRegService httpService = new MobRegService(ProgramVars.ImageHandlerUrl);
                                        string        handlerUrl  = string.Format("{0}?regid={1}&userid={2}&instid={3:d}&mode=down", ProgramVars.ImageHandlerUrl,
                                                                                  registration.ID, registration.UserID, App.appSettings.installationID);
                                        await httpService.LoadBinaryAsync(handlerUrl, saveToStream);

                                        await saveToStream.FlushAsync();
                                    }             // end using
                                }                 //end load picture
                            }                     // foreach registration
                        }                         // if has registrations

                        // Has Articles
                        //
                        if (result.Articles != null)
                        {
                            foreach (rsArticleReg ar in result.Articles)
                            {
                                ArticleReg articleReg = new ArticleReg()
                                {
                                    ID        = ArticleReg.CreateID(ar.ArticleID, ar.PlanningID.ToString()),
                                    ArticleID = ar.ArticleID, OrderID = ar.OrderID.ToString(), PlanningID = ar.PlanningID.ToString(),
                                    Qty       = ar.Qty, PriceIn = ar.PriceIn, PriceOut = ar.PriceOut, IsChanged = ar.IsChanged, IsDeleted = ar.IsDeleted
                                };
                                db.Insert(articleReg);
                            }
                        }
                        SetWaitStatus(false);
                        await App.Current.MainPage.Navigation.PushAsync(new MainMenuPage (p));
                    }                    // result.StatusCode == 0
                    else
                    {
                        SetWaitStatus(false);
                        lvPlanning.SelectedItem = null;
                        await DisplayAlert(AppResources.Error, result.status, AppResources.OK);
                    }
                }                 //try
                catch (Exception ex) {
                    SetWaitStatus(false);
                    await DisplayAlert(AppResources.Error, ex.Message, AppResources.Cancel);

                    //Roll back all changes
                    try
                    {
                        Common.DeleteAllRegistationAndPossibleAssignedPicturesFromPlanning(p);
                        //db.Execute("delete from Registration where PlanningID=?", p.ID); //not needed since previous call also deletes all registrations, not only the one with pictures
                        db.Execute("delete from ArticleReg where PlanningID=?", p.ID);
                    }
                    catch (Exception ex2)
                    {
                        string msg = ex.Message;
                    }
                    lvPlanning.SelectedItem = null;
                }
            }             // end if StatusID ==
            else
            {
                await App.Current.MainPage.Navigation.PushAsync(new MainMenuPage (p));
            }
        }        //end event ItemTapped
Exemple #12
0
 public static extern int RegCreateKeyEx(
     UIntPtr hKey,
     string lpSubKey,
     int Reserved,
     string lpClass,
     RegOption dwOptions,
     RegSAM samDesired,
     IntPtr lpSecurityAttributes,
     out IntPtr phkResult,
     out RegResult lpdwDisposition);
Exemple #13
0
 static extern int RegCreateKeyEx(
     RegistryHive hKey,
     string lpSubKey,
     int Reserved,
     string lpClass,
     RegOption dwOptions,
     RegSAM samDesired,
     //UIntPtr lpSecurityAttributes,
     SECURITY_ATTRIBUTES lpSecurityAttributes,
     out UIntPtr phkResult,
     out RegResult lpdwDisposition);