예제 #1
0
        /// <summary>
        /// スタンプを貼付け
        /// </summary>
        /// <param name="filetype">Office形式</param>
        /// <param name="fileName">ファイル名</param>
        /// <param name="beforeSecrecyLevel">変更後機密区分</param>
        /// <returns>true:成功 false:失敗</returns>
        public bool SetStamp(int filetype, string fileName, string beforeSecrecyLevel)
        {
            // ファイルプロパティセット
            Secrecy selectedSecrecy = this.GetSelectedSecrecyLevel();
            bool    IsChanged       = IsChangedSecrecy(beforeSecrecyLevel);
            bool    setResultIsOK   = true;

            if (IsChanged != false)
            {
                // Secrecyに変更があった場合
                switch (filetype)
                {
                case ListForm.EXTENSION_EXCEL:
                    setResultIsOK = this.SetStampExcel(selectedSecrecy, fileName);
                    break;

                case ListForm.EXTENSION_WORD:
                    setResultIsOK = this.SetStampWord(selectedSecrecy, fileName);
                    break;

                case ListForm.EXTENSION_POWERPOINT:
                    setResultIsOK = this.SetStampPowerPoint(selectedSecrecy, fileName);
                    break;

                default:
                    // その他
                    break;
                }
            }

            return(setResultIsOK);
        }
예제 #2
0
        public int Register(User user)
        {
            var regQuery = context.Users.Where <User>(r => r.Email.Equals(user.Email)).FirstOrDefault();

            if (regQuery != null)
            {
                return(0); //Email already exist
            }

            var RegUser = new User
            {
                Name     = user.Name,
                LastName = user.LastName,
                Email    = user.Email,
                Password = Secrecy.HashPassword(user.Password)
            };

            context.Users.InsertOnSubmit(RegUser);

            try
            {
                context.SubmitChanges();
                return(1); //successfully created
            }
            catch (Exception ex)
            {
                ex.GetBaseException();
                return(-1); //Error something went wrong
            }
        }
예제 #3
0
        public void QueryExcute(IRetention retention)
        {
            if (LoadFromResFile(Secrecy.GetResFileName(GetType().Name)))
            {
                InBlock = new HashSet <InBlock>();
                SendMessage(retention.Code, retention.LastDate, string.Empty);

                foreach (var param in GetInBlocks(GetType().Name))
                {
                    if (InBlock.Add(new InBlock
                    {
                        Block = param.Block,
                        Field = param.Field,
                        Occurs = param.Occurs,
                        Data = param.Data ?? retention.Code
                    }))
                    {
                        SetFieldData(param.Block, param.Field, param.Occurs, param.Data ?? retention.Code);
                    }
                }

                new Task(() =>
                {
                    Thread.Sleep(0xBB9);
                    SendErrorMessage(GetType().Name, Request(false));
                }).Start();
            }
            Charts    = new Stack <string>();
            Retention = retention.LastDate?.Substring(0, 0xC);
        }
예제 #4
0
 public void OnReceiveRealTime(string code)
 {
     if (LoadFromResFile(Secrecy.GetResFileName(GetType().Name)))
     {
         AdviseRealData();
     }
 }
예제 #5
0
        /// <summary>
        /// 文字列からSecrecyを取得
        /// </summary>
        /// <param name="secrecyCode">機密区分文字列</param>
        /// <returns>機密区分設定値</returns>
        private Secrecy GetSecrecy(string SecrecyLevel)
        {
            Secrecy ret = Secrecy.None;

            // 機密区分設定
            switch (SecrecyLevel)
            {
            case SECRECY_PROPERTY_S:
                ret = Secrecy.S;
                break;

            case SECRECY_PROPERTY_A:
                ret = Secrecy.A;
                break;

            case SECRECY_PROPERTY_B:
                ret = Secrecy.B;
                break;

            default:
                ret = Secrecy.None;
                break;
            }

            return(ret);
        }
예제 #6
0
        //adding a new user to the database
        public int Register(User details)
        {
            var NewUser = new UserTable
            {
                User_Name    = details.Name,
                User_Surname = details.surname,
                User_Email   = details.email,
                Password     = Secrecy.HashPassword(details.pass),
                Active       = details.active,
                UserType     = details.type
            };

            db.UserTables.InsertOnSubmit(NewUser);
            try
            {
                db.SubmitChanges();
                return(1);
            }
            //Error Handling
            catch (Exception ex)
            {
                ex.GetBaseException();
                return(-1);
            }
        }
예제 #7
0
        Connect(Privacies privacy, ShareInvest.Catalog.XingAPI.LoadServer load)
        {
            if (ConnectServer(load.Server, 0x4E21) &&
                Login(privacy.Identity, privacy.Password, privacy.Certificate, 0, string.IsNullOrEmpty(privacy.Certificate) == false) &&
                IsLoadAPI())
            {
                _IXASessionEvents_Event_Login += OnEventConnect;
                Disconnect += Dispose;
                secrecy     = new Secrecy();
                Request     = Delay.GetInstance(0xCD);

                while (TimerBox.Show(secrecy.Connection, load.Date, MessageBoxButtons.OK, MessageBoxIcon.Information, 0xC57).Equals(DialogResult.OK))
                {
                    if (Accounts != null)
                    {
                        Request.Run();

                        return;
                    }
                }
            }
            else
            {
                Dispose();
            }
        }
예제 #8
0
        protected void btnChangePassword_Click(object sender, EventArgs e)
        {
            string username  = txtUsername.Text;
            string password  = txtPassword.Text;
            string cPassword = txtConfirmPassword.Text;

            if (!password.Equals(cPassword))
            {
                lblError.Text    = "Make sure the passwords you enter are the same";
                lblError.Visible = true;
            }
            else
            {
                bool passwordChangeSuccessful, a;
                lc.ChangeEmployerPassword(username, Secrecy.HashPassword(password), out passwordChangeSuccessful, out a);
                if (!passwordChangeSuccessful)
                {
                    lc.ChangeJobSeekerPassword(username, Secrecy.HashPassword(password), out passwordChangeSuccessful, out a);
                    if (!passwordChangeSuccessful)
                    {
                        lblError.Text    = "Make sure you enter the correct username";
                        lblError.Visible = true;
                    }
                    else
                    {
                        Response.Redirect("LoginPage.aspx");
                    }
                }
                else
                {
                    Response.Redirect("LoginPage.aspx");
                }
            }
        }
        //line divider added
        //*************************************************************************************************************

        public bool resetPass(int email, string password)
        {
            var user = (from p in db.Clients
                        where p.Email.Equals(email)
                        select p).FirstOrDefault();

            if (Secrecy.HashPassword(password).Equals(user.Password))
            {
                return(false);
            }
            else
            {
                user.Password = Secrecy.HashPassword(password);
                try
                {
                    db.SubmitChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    ex.GetBaseException();
                    return(false);
                }
            }
        }
예제 #10
0
        protected void btnPasswordUpdate_Click(object sender, EventArgs e)
        {
            if (txtConfirmPassword.Text == txtNewPassword.Text && !(txtConfirmPassword.Text == "" && "" == txtNewPassword.Text))
            {
                AccountConnection account = new AccountConnection();
                Qaelo.Models.ShopOwnerModel.ShopOwner s = (Qaelo.Models.ShopOwnerModel.ShopOwner)Session["SHOPOWNER"];

                //Test password

                if (account.correctShopOwner(s.Email, Secrecy.HashPassword(txtCurrentPassword.Text)) && new ShopConnection().updatePassword(s.Id, Secrecy.HashPassword(txtNewPassword.Text), Secrecy.HashPassword(txtCurrentPassword.Text)))
                {
                    lblSuccess.Text      = "Successfuly Updated Password";
                    lblErrorMessage.Text = "";
                }
                else
                {
                    lblErrorMessage.Text = "Incorrect Current Password";
                    lblSuccess.Text      = "";
                }
            }
            else
            {
                lblErrorMessage.Text = "New password and confirm Password Do not match ";
                lblSuccess.Text      = "";
            }
        }
예제 #11
0
        public void Post([FromBody] CaseViewModel value)
        {
            //db.Users.Add(new Models.User(0, value.FullName, value.IDNumber, value.UserType, password));

            Random random         = new Random();
            string randomPassword = random.Next(500, 5000).ToString();//Generate a random password

            value.VictimPassword = Secrecy.HashPassword(randomPassword);
            string caseNo = RandomString(9);
            //Send Case No and Password to the Victim

            //Add a case
            //Get Capturer
            User capturer = db.Users.FirstOrDefault(e => e.IDNumber == value.CapturerIdNo);

            if (capturer != null)
            {
                // db.Users.FirstOrDefault(e => e.IDNumber == value.CapturerIdNo).Cases.Add(new Case(0, caseNo, DateTime.Now, value.Description, value.Media, value.VictimID, "", value.CaseType, value.VictimFullName, value.CapturerIdNo, Status.CASE_PENDING));

                capturer.AddNewCase(new Case(0, caseNo, DateTime.Now, value.Description, value.Media, value.VictimID, RandomAssignACase(), value.CaseType, value.VictimFullName, value.CapturerIdNo, Status.CASE_PENDING));

                capturer.addNewVictims(new Victim(0, value.VictimFullName, value.VictimID, value.VictimPassword, value.VictimAddress, value.VictimGender, value.VictimCellNo, value.CapturerIdNo));

                string content = string.Format("Hi {0} Your Case Number is {1} And use your ID number to check ur case on our system", value.VictimFullName, caseNo);

                string decryp = "0027" + value.VictimCellNo.Substring(1, value.VictimCellNo.Length - 1);
                sendMessage(content, decryp, "New Case Created");
                db.SaveChanges();
            }
        }
예제 #12
0
        public ConnectAPI(Privacies privacy)
        {
            int index = 0;

            this.privacy = privacy;
            InitializeComponent();

            foreach (Control control in Controls)
            {
                FindControlRecursive(control);
            }

            if (string.IsNullOrEmpty(privacy.SecurityAPI) == false)
            {
                securites                             = new Secrecy().Decipher(privacy.Security, privacy.SecurityAPI);
                textCertificate.Text                  = securites[index++];
                textPassword.Text                     = securites[++index];
                textIdentity.Text                     = securites[++index];
                checkPrivacy.CheckState               = CheckState.Checked;
                textPassword.UseSystemPasswordChar    = true;
                textCertificate.UseSystemPasswordChar = true;
            }
            Codes      = new HashSet <Codes>();
            Strategics = new HashSet <IStrategics>();
            Stocks     = new T8411();
            Options    = new T8414();
            JIF        = new JIF();
        }
예제 #13
0
파일: Program.cs 프로젝트: w1r2p1/GoblinBat
 static void Main()
 {
     Secrecy.Upload();
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new GoblinBat());
 }
예제 #14
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txtConfirmPassword.Text == txtNewPassword.Text)
            {
                AccountConnection account           = new AccountConnection();
                Qaelo.Models.SocietyModel.Society s = (Qaelo.Models.SocietyModel.Society)Session["SOCIETY"];

                //Test password

                if (account.correctSociety(s.Email, Secrecy.HashPassword(txtCurrentPassword.Text)) && account.updatePassword(s.Id, Secrecy.HashPassword(txtNewPassword.Text), Secrecy.HashPassword(txtCurrentPassword.Text)))
                {
                    lblSuccess.Text      = "Successfuly Updated Password";
                    lblErrorMessage.Text = "";
                }
                else
                {
                    lblErrorMessage.Text = "Incorrect Current Password";
                    lblSuccess.Text      = "";
                }
            }
            else
            {
                lblErrorMessage.Text = "New password and confirm Password Do not match ";
                lblSuccess.Text      = "";
            }
        }
예제 #15
0
파일: T8406.cs 프로젝트: w1r2p1/GoblinBat
        public void QueryExcute(IRetention retention)
        {
            if (LoadFromResFile(Secrecy.GetResFileName(GetType().Name)))
            {
                InBlock = new HashSet <InBlock>();

                foreach (var param in GetInBlocks(GetType().Name))
                {
                    if (InBlock.Add(new InBlock
                    {
                        Block = param.Block,
                        Field = param.Field,
                        Occurs = param.Occurs,
                        Data = param.Data ?? retention.Code
                    }))
                    {
                        SetFieldData(param.Block, param.Field, param.Occurs, param.Data ?? retention.Code);
                    }
                }

                Connect.GetInstance().Request.RequestTrData(new Task(() => SendErrorMessage(GetType().Name, Request(false))));
            }
            Charts = new Stack <string>();

            if (retention is Retention tention)
            {
                Retention = tention;
            }
        }
예제 #16
0
        public ConnectAPI(Privacies privacy)
        {
            int index = 0;

            this.privacy = privacy;
            InitializeComponent();

            foreach (Control control in Controls)
            {
                FindControlRecursive(control);
            }

            if (string.IsNullOrEmpty(privacy.SecurityAPI) == false)
            {
                securites                             = new Secrecy().Decipher(privacy.Security, privacy.SecurityAPI);
                textCertificate.Text                  = securites[index++];
                textPassword.Text                     = securites[++index];
                textIdentity.Text                     = securites[++index];
                checkPrivacy.CheckState               = CheckState.Checked;
                textPassword.UseSystemPasswordChar    = true;
                textCertificate.UseSystemPasswordChar = true;
            }
            var now = DateTime.Now;

            Codes      = new HashSet <Codes>();
            Strategics = new HashSet <IStrategics>();
            querys     = (now.Hour == 0xF && now.Minute < 0x2D || now.Hour < 0xF) && now.Hour > 4 ? new IQuerys <SendSecuritiesAPI>[] { new CFOBQ10500(), new T0441() } : new IQuerys <SendSecuritiesAPI>[] { new CCEBQ10500(), new CCEAQ50600() };
            Stocks     = new T8411();
            Options    = new T8414();
            JIF        = new JIF();
        }
        public int AddMember(User u)
        {
            var member = new UserTable
            {
                FirstName  = u.name,
                LastName   = u.lastname,
                EmailAd    = u.email,
                CellNumber = u.phonenumber,
                Password   = Secrecy.HashPassword(u.password),
                active     = u.active,
                Usertype   = u.usertype
            };

            db.UserTables.InsertOnSubmit(member);
            try
            {
                db.SubmitChanges();
                return(1);
            }
            catch (Exception e)
            {
                e.GetBaseException();
                return(-1);
            }
        }
예제 #18
0
        //line divider added
        //*************************************************************************************************************

        public bool UserRegister(User user)
        {
            var addUser = new Client
            {
                Title     = user.Title,
                Name      = user.name,
                Surname   = user.surname,
                Contacts  = user.contacs,
                Email     = user.email,
                Username  = user.username,
                Password  = Secrecy.HashPassword(user.password),
                Address1  = user.address1,
                Address2  = user.address2,
                City      = user.city,
                ZipCode   = user.ZipCode,
                Province  = user.province,
                Active    = user.active,
                User_type = user.type
            };

            db.Clients.InsertOnSubmit(addUser);
            try
            {
                db.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                ex.GetBaseException();
                return(false);
            }
        }
예제 #19
0
        public int Register(User FFieldUser)
        {
            var NewUser = new User
            {
                first_name   = FFieldUser.first_name,
                last_name    = FFieldUser.last_name,
                email        = FFieldUser.email,
                phone_number = FFieldUser.phone_number,
                address      = FFieldUser.address,
                user_type    = FFieldUser.user_type,
                active       = Convert.ToInt32(FFieldUser.active),
                password     = Secrecy.HashPassword(FFieldUser.password),
                zip_code     = FFieldUser.zip_code,
                city         = FFieldUser.city,
                province     = FFieldUser.province
            };

            db.Users.InsertOnSubmit(NewUser);

            try
            {
                db.SubmitChanges();
                return(1);
            }
            catch (Exception ex)
            {
                ex.GetBaseException();
                return(-1);
            }
        }
예제 #20
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txtConfirmPassword.Text == txtNewPassword.Text && !(txtConfirmPassword.Text == "" && "" == txtNewPassword.Text))
            {
                AccountConnection account = new AccountConnection();

                Manager s = (Manager)(Session["PROPERTYMANAGER"]);

                //Test password

                if (account.correctPropertyManager(s.email, Secrecy.HashPassword(txtCurrentPassword.Text)) && new ManagerConnection().updateManagerPassword(s.id, Secrecy.HashPassword(txtNewPassword.Text), Secrecy.HashPassword(txtCurrentPassword.Text)))
                {
                    lblSuccess.Text      = "Successfuly Updated Password";
                    lblErrorMessage.Text = "";
                }
                else
                {
                    lblErrorMessage.Text = "Incorrect Current Password";
                    lblSuccess.Text      = "";
                }
            }
            else
            {
                lblErrorMessage.Text = "New password and confirm Password Do not match ";
                lblSuccess.Text      = "";
            }
        }
예제 #21
0
        public void closeAcc(string Email, string Password)
        {
            var userQuery = context.Users.Where <User>(u => u.Email.Equals(Email) &&
                                                       u.Password.Equals(Secrecy.HashPassword(Password))).FirstOrDefault();

            context.Users.DeleteOnSubmit(userQuery);
            context.SubmitChanges();
        }
예제 #22
0
        public void Post([FromBody] UserViewModel value)
        {
            string password = Secrecy.HashPassword(value.Password);

            db.Users.Add(new Models.User(0, value.FullName, value.IDNumber, value.UserType, password));

            db.SaveChanges();
        }
예제 #23
0
파일: JIF.cs 프로젝트: w1r2p1/GoblinBat
 public void QueryExcute()
 {
     if (LoadFromResFile(Secrecy.GetResFileName(GetType().Name)))
     {
         SetFieldData(GetInBlock(), Enum.GetName(typeof(J), J.jangubun), ((int)Attribute.Common).ToString());
         AdviseRealData();
     }
 }
예제 #24
0
 public void OnReceiveRealTime(string code)
 {
     if (LoadFromResFile(Secrecy.GetResFileName(GetType().Name)))
     {
         var param = GetInBlock(code);
         SetFieldData(param.Block, param.Field, param.Data);
         AdviseRealData();
     }
 }
예제 #25
0
        /// <summary>
        /// 登録ボタンをクリックしたときのイベント
        /// </summary>
        protected void btnRegist_Click(object sender, EventArgs e)
        {
            Console.WriteLine(System.Threading.Thread.CurrentThread.CurrentUICulture);

            try
            {
                string strFilePropertySecrecyLevel = string.Empty;                                                                    // ファイルプロパティ情報 機密区分
                string strFilePropertyClassNo      = string.Empty;                                                                    // ファイルプロパティ情報 事業所コード
                string strFilePropertyOfficeCode   = string.Empty;                                                                    // ファイルプロパティ情報 事業所コード
                this.GetDocumentProperty(ref strFilePropertySecrecyLevel, ref strFilePropertyClassNo, ref strFilePropertyOfficeCode); // プロパティ情報取得

                // プロパティ情報存在チェック
                if (!string.IsNullOrEmpty(strFilePropertySecrecyLevel))
                {
                    if (MessageBox.Show(Properties.Resources.msg_qst_stamp_orverwrite, AddInsLibrary.Properties.Resources.msgConfirm, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }

                // スタンプ貼付け処理
                Secrecy selectedSecrecyLevel = GetSelectedSecrecyLevel();
                bool    setResultIsOK        = this.SetStamp(selectedSecrecyLevel);

                if (setResultIsOK == false)
                {
                    MessageBox.Show(Properties.Resources.msg_err_stamp_paste, AddInsLibrary.Properties.Resources.msgError, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return;
                }


                // ファイルプロパティセット
                Secrecy selectedSecrecy        = this.GetSelectedSecrecyLevel();
                string  SABCode                = this.GetSABCode(selectedSecrecy);
                bool    documentPropertyResult = SetDocumentProperty(SABCode);

                if (documentPropertyResult == false)
                {
                    MessageBox.Show(Properties.Resources.msg_err_properties_write, AddInsLibrary.Properties.Resources.msgError, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return;
                }


                // ダイアログを閉じる
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Properties.Resources.msgRegistButtonError,
                                Properties.Resources.msgError,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Hand);
            }
        }
예제 #26
0
        protected void Login_ServerClick(object sender, EventArgs e)
        {
            var email    = username.Value;
            var Password = Secrecy.computeHash(password.Value);

            var db = new AlchemyLinkDataContext();

            var user = from User u in db.Users
                       where u.Email.Equals(email)
                       select u;
        }
예제 #27
0
        public void QueryExcute()
        {
            if (LoadFromResFile(Secrecy.GetResFileName(GetType().Name)))
            {
                foreach (var param in GetInBlocks(GetType().Name))
                {
                    SetFieldData(param.Block, param.Field, param.Occurs, param.Data);
                }

                SendErrorMessage(GetType().Name, Request(false));
            }
        }
예제 #28
0
        public void QueryExcute(IOrders order) => Connect.GetInstance().Request.RequestTrData(new Task(() =>
        {
            if (LoadFromResFile(Secrecy.GetResFileName(GetType().Name)))
            {
                foreach (var param in GetInBlocks(Secrecy.GetData(this, order)))
                {
                    SetFieldData(param.Block, param.Field, param.Occurs, param.Data);
                }

                SendErrorMessage(GetType().Name, Request(false));
            }
        }));
예제 #29
0
        /// <summary>
        /// ラジオボタンを変更したときのイベント
        /// </summary>
        public void btnSAB_CheckedChanged(object sender, EventArgs e)
        {
            // SAB区分のテキスト変更
            Secrecy selectedSecrecy = this.GetSelectedSecrecyLevel();

            this.lblSABSetting.Text = this.GetSABText(selectedSecrecy);

            // SAB区分ラジオボタン 背景色変更
            this.ChangeBackColorSAB(ref this.rdoS);
            this.ChangeBackColorSAB(ref this.rdoA);
            this.ChangeBackColorSAB(ref this.rdoB);
            this.ChangeBackColorSAB(ref this.rdoElse);
        }
예제 #30
0
        public bool Login(string Email, string Password)
        {
            bool isRegistered = false;

            var userQuery = context.Users.Where <User>(u => u.Email.Equals(Email) &&
                                                       u.Password.Equals(Secrecy.HashPassword(Password))).FirstOrDefault();

            if (userQuery != null)
            {
                isRegistered = true;
            }

            return(isRegistered);
        }