示例#1
0
    protected void btnChangePassword_Click(object sender, EventArgs e)
    {
        string    userId = hd_userid.Value;
        DataTable dt     = new DataTable();

        dt = Users.GetUsersByUserId(userId);
        if (dt.Rows.Count > 0)
        {
            string oldPassword = SecurityExtension.BuildPassword(tbChangeOldPassword.Text);
            //Nếu nhập đúng mật khẩu cũ hoặc đang đăng nhập với tài khoản admin
            if (oldPassword == dt.Rows[0][UsersColumns.UserpasswordColumn].ToString() || CookieExtension.GetCookies("UserName") == "admin")
            {
                if (CookieExtension.GetCookies("UserName") == "admin")
                {
                    oldPassword = dt.Rows[0][UsersColumns.UserpasswordColumn].ToString();
                }

                if (oldPassword.Length > 0)
                {
                    TatThanhJsc.Database.Users.ChangePasswordUsers(userId, oldPassword, SecurityExtension.BuildPassword(tbChangeNewPassword.Text), false);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "",
                                                        "ThongBao(3000,'Cập nhật mật khẩu thành công');", true);
                    pn_insert_update.Visible = false;
                    pn_list_users.Visible    = true;
                    pnChangePassword.Visible = false;

                    #region Logs
                    string logAuthor     = CookieExtension.GetCookies("LoginSetting");
                    string logCreateDate = DateTime.Now.ToString();
                    Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", dt.Rows[0][UsersColumns.UsernameColumn].ToString(), logAuthor, "", logCreateDate + ": " + logAuthor + " đổi mật khẩu tài khoản " + dt.Rows[0][UsersColumns.UsernameColumn].ToString());
                    #endregion
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('Mật khẩu cũ không chính xác.');", true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('Mật khẩu cũ không chính xác.');", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('Cập nhật mật khẩu thất bại.');", true);
        }
    }
        public async Task Retrieve(string ressource, Stream target, int counter = 0)
        {
            if (!_keyRetrieved)
            {
                RetrieveKey();
            }

            if (!_ressourcesRetrieved)
            {
                RetrieveRessourceTable();
            }

            if (counter == 3)
            {
                ClientContext.Logger.LogWarning($"Failed to retrieve ressource '{ressource}'! ({counter} retries!)");
                return;
            }

            try {
                string res = ByteArrayToString(Unprotect(_token).Hash(ressource));

                if (!Ressources.Table.TryGetValue(res, out RessourceTableItemView itemView))
                {
                    ClientContext.Logger.LogInformation($"File {ressource} does not exsit in the ressource table!");
                    return;
                }

                using (WebClient webClient = new WebClientWithRange(itemView.Offset, itemView.Offset + (itemView.Length - 1)))
                    using (MemoryStream input = new MemoryStream(await webClient.DownloadDataTaskAsync($"http://{RandomProvider()}/0000000000000000-{itemView.Container}")))
                        using (MemoryStream output = new MemoryStream()) {
                            SecurityExtension.DecryptAES(input, output, Unprotect(_token));
                            output.Position = 0;

                            using (GZipStream decompressor = new GZipStream(output, CompressionMode.Decompress, true)) {
                                decompressor.CopyTo(target);
                            }
                        }
            } catch (Exception e) {
                ClientContext.Logger.LogError(e);
                await Retrieve(ressource, target, ++counter);
            }
        }
        private void RetrieveKey(int counter = 0)
        {
            if (counter == 3)
            {
                ClientContext.Logger.LogWarning($"Failed to reach API! ({counter} retries!)", "", "", 0);
                return;
            }

            try {
                Tuple <string, string> tempKey = SecurityExtension.CreatePair();
                ApiClient.CreateRequest("api/ressources/token", "POST")
                .WithBody(new TokenView {
                    Token = tempKey.Item2
                })
                .Execute(out HttpWebResponse response);
                if (response.TryGetStatusCode(out HttpStatusCode code))
                {
                    string responseString = response.GetReponseString();
                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        TokenView tokenView = responseString.DeserializeJsonSafe <TokenView>();
                        if (tokenView != null)
                        {
                            _token        = Protect(SecurityExtension.Decrypt(tokenView.Token, tempKey.Item1));
                            _keyRetrieved = true;
                            ClientContext.Logger.LogSuccess("Token retrieved successfully!", "", "", 0);
                            return;
                        }
                        ClientContext.Logger.LogWarning($"Failed to extract deserialize response ['{responseString}']", "", "", 0);
                    }
                    else
                    {
                        ClientContext.Logger.LogWarning($"Request failed [Code: {response.StatusCode.ToString("G")}, Response: '{responseString}']", "", "", 0);
                    }
                }
            } catch (Exception e) {
                ClientContext.Logger.LogError(e, "", "", 0);
            }

            RetrieveKey(++counter);
        }
        //生成二维码图片
        public static void CreateCode_Simple(string nr, out string imgPath)
        {
            imgPath = "";

            //Des 加密
            string nrData = SecurityExtension.DesEncrypt(nr, AppSettingsConfig.QrCodeKey);

            //二维码内容 为: 验票接口?qrcode=二维码串
            //string strData = qrcodeAPI + "?qrcode=" + nrData;

            string strData = nrData;

            //定义二维码对象
            QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();

            //三种尺寸:BYTE ,ALPHA_NUMERIC,NUMERIC
            qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;
            //比例
            qrCodeEncoder.QRCodeScale = 4;
            //版本
            qrCodeEncoder.QRCodeVersion = 8;
            //大小
            qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
            //二维码串内容
            //System.Drawing.Image image = qrCodeEncoder.Encode("4408810820 深圳-广州 小江");
            System.Drawing.Image image = qrCodeEncoder.Encode(strData);
            string filename            = DateTime.Now.ToString("yyyymmddhhmmssfff").ToString() + ".jpg";
            //二维码图片物理路径
            string filepath = AppSettingsConfig.QrCodePath + "\\" + filename;

            System.IO.FileStream fs = new System.IO.FileStream(filepath, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);
            image.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg);

            fs.Close();
            image.Dispose();

            imgPath = AppSettingsConfig.ImgApiPath + filename;
            //二维码解码
            //var codeDecoder = CodeDecoder(filepath);
        }
示例#5
0
        static void Main(string[] args)
        {
            Console.WriteLine("### EpicOrbit Packer");

            Console.Write("### Input Token: ");
            string token = Console.ReadLine();

            if (token == null || string.IsNullOrWhiteSpace(token))
            {
                token = SecurityExtension.GenerateToken();
                Console.WriteLine("### Token: '{0}'", token);
            }

            Console.Write("### Input Folder: ");
            string input = Console.ReadLine();

            Console.Write("### Output Folder: ");
            string output = Console.ReadLine();

            if (CheckExists(token, output))
            {
                Console.WriteLine("### Output already a package, appending existing!");
                AppendEncrypt(token, input, output);
            }
            else
            {
                Console.WriteLine("### Output is empty, creating new package!");
                if (Directory.Exists(output))
                {
                    Directory.Delete(output, true);
                }
                Directory.CreateDirectory(output);
                Encrypt(token, input, output);
            }

            Console.WriteLine("### Done!");

            Console.WriteLine("### Token: '{0}'", token);
            Console.ReadLine();
        }
        public JsonResult HandleCreateClientUserErrors(Security_Users viewSecuritySetup, FormCollection fc)
        {
            viewSecuritySetup.securitycompanieslist2 = Clients.GetClientListFromUser(SecurityExtension.GetCurrentUserID(this));
            viewSecuritySetup.securitycompanieslist2.Find(
                delegate(SelectListItem tempitem)
            {
                return(tempitem.Value == fc["primarycompany"]);
            }
                ).Selected = true;


            SelectListItem item1 = new SelectListItem();

            item1.Text  = "Client User";
            item1.Value = "Client";
            viewSecuritySetup.usertypelist.Add(item1);

            SelectListItem item2 = new SelectListItem();

            item2.Text  = "Sales User";
            item2.Value = "Sales";
            viewSecuritySetup.usertypelist.Add(item2);


            viewSecuritySetup.usertypelist.Find(
                delegate(SelectListItem tempitem)
            {
                return(tempitem.Value == fc["usertypelist"]);
            }
                ).Selected = true;

            return(new JsonResult
            {
                Data = new
                {
                    success = false,
                    view = RenderToString.RenderViewToString(this, "CreateClientUser", viewSecuritySetup)
                }
            });
        }
    private void SaveConfig(string fullkey, string order, bool status)
    {
        string split = "->";
        string encodekey = SecurityExtension.BuildPassword(fullkey);
        string firstkey = fullkey.Substring(0, fullkey.IndexOf(split));        

        fullkey = order + split + fullkey + split + (status == true ? "1" : "0");

        DataTable dt = new DataTable();
        condition = DataExtension.AndConditon(
            SettingsTSql.GetSettingsByVskey(encodekey),
            SettingsTSql.GetSettingsByVslang(language)
            );
        dt = Settings.GetSettingsCondition("1", "*", condition, "");
        if (dt.Rows.Count < 1)
        {
            Settings.InsertSettings(encodekey, firstkey, fullkey, language);
        }
        else
        {
            Settings.UpdateSettings(SettingsTSql.GetSettingsByVsvalue(fullkey), condition);
        }
    }
示例#8
0
        //protected int m_ClientID;

        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            m_UserID = SecurityExtension.GetCurrentUserID(this);
            m_Portal = ScreeningONEAuthorizeHelper.GetPortal(this, filterContext.ActionDescriptor.ActionName);
            //m_ClientID = Clients.GetParentClientIDFromUser(m_UserID);
            //S1_Clients_GetClientsFromUserResult client = Clients.GetParentClientFromUser(m_UserID);

            ViewData["UserID"] = m_UserID;

            /*if (client != null)
             * {
             *  ViewData["ClientName"] = Clients.GetParentClientFromUser(m_UserID).ClientName;
             * }
             */

            ViewModels.MainMenu viewMainMenu = new ViewModels.MainMenu();
            viewMainMenu.Portal  = m_Portal;
            viewMainMenu.UserID  = m_UserID;
            ViewData["MainMenu"] = viewMainMenu;

            ViewModels.LogOn viewLogOn = new ViewModels.LogOn();
            viewLogOn.Portal = m_Portal;
            //viewLogOn.ClientID = m_ClientID;
            ViewData["LogOn"] = viewLogOn;

            if (User.IsInRole("Client_SalesDemo"))
            {
                viewMainMenu.IsSalesDemoClient = true;
            }
            else
            {
                viewMainMenu.IsSalesDemoClient = false;
            }


            base.OnActionExecuting(filterContext);
        }
示例#9
0
        static bool CheckExists(string token, string destination)
        {
            if (!File.Exists(Path.Combine(destination, "0000000000000000-0")) ||
                !File.ReadAllBytes(Path.Combine(destination, "0000000000000000-0")).SequenceEqual(token.Hash()))
            {
                return(false);
            }

            try {
                if (File.Exists(Path.Combine(destination, "0000000000000000-1")))
                {
                    using (Stream input = File.OpenRead(Path.Combine(destination, "0000000000000000-1")))
                        using (MemoryStream output = new MemoryStream()) {
                            SecurityExtension.DecryptAES(input, output, token);
                            output.Position = 0;

                            var result = JsonConvert.DeserializeObject <RessourceTableView>(Encoding.UTF8.GetString(output.ToArray()));
                            return(result.TokenHash.SequenceEqual(token.Hash()));
                        }
                }
            } catch { }

            return(false);
        }
示例#10
0
    protected void btOK_Click(object sender, EventArgs e)
    {
        if (CheckExistedAcount(tbTenDangNhap.Text, insert, SecurityExtension.Decode(hdTenDangNhap.Value)))
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "ThongBao(3000,'Tên đăng nhập này đã được sử dụng. Vui lòng chọn tên đăng nhập khác.');", true);
            tbTenDangNhap.Focus();
            return;
        }

        if (CheckExistedEmail(tbEmail.Text, insert, SecurityExtension.Decode(hdTenDangNhap.Value)))
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "ThongBao(3000,'Email này đã được sử dụng. Vui lòng chọn email khác.');", true);
            tbEmail.Focus();
            return;
        }

        if (tbNgaySinh.Text.Length < 1)
        {
            tbNgaySinh.Text = DateTime.Now.AddYears(-20).ToString();
        }

        #region Image
        string vimg       = "";
        string vimg_thumb = "";
        if (flimg.PostedFile.ContentLength > 0)
        {
            string filename = flimg.FileName;
            string fileex   = filename.Substring(filename.LastIndexOf("."));
            string path     = Request.PhysicalApplicationPath + "/" + pic + "/";
            if (TatThanhJsc.Extension.ImagesExtension.ValidType(fileex))
            {
                string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1));
                if (fileNotEx.Length > 9)
                {
                    fileNotEx = fileNotEx.Remove(9);
                }
                string ticks = DateTime.Now.Ticks.ToString();
                #region Lưu ảnh đại diện theo 2 trường hợp: tạo ảnh nhỏ hoặc không.
                //Kiểm tra xem có tạo ảnh nhỏ hay ko
                //Nếu không tạo ảnh nhỏ, tên tệp lưu bình thường theo kiểu: tên_tệp.phần_mở_rộng
                //Nếu tạo ảnh nhỏ, tên tệp sẽ theo kiểu: tên_tệp_HasThumb.phần_mở_rộng
                //Khi đó tên tệp ảnh nhỏ sẽ theo kiểu:   tên_tệp_HasThumb_Thumb.phần_mở_rộng
                //Với cách lưu tên ảnh này, khi thực hiện lưu vào csdl chỉ cần lưu tên ảnh gốc
                //khi hiển thị chỉ cần dựa vào tên ảnh gốc để biết ảnh đó có ảnh nhỏ hay không, việc này được thực hiện bởi TatThanhJsc.Extension.ImagesExtension.GetImage, lập trình không cần làm gì thêm.
                if (cbTaoAnhNho.Checked)
                {
                    vimg = fileNotEx + "_" + ticks + "_HasThumb" + fileex;
                }
                else
                {
                    vimg = fileNotEx + "_" + ticks + fileex;
                }
                flimg.SaveAs(path + vimg);
                #endregion
                #region Hạn chế kích thước
                if (cbHanCheKichThuoc.Checked)
                {
                    ImagesExtension.ResizeImage(path + vimg, "", tbHanCheW.Text, tbHanCheH.Text);
                }
                #endregion
                #region Đóng dấu ảnh
                if (cbDongDauAnh.Checked)
                {
                    ImagesExtension.CreateWatermark(path + vimg, path + hdLogoImage.Value, hdViTriDongDau.Value, hdLeX.Value, hdLeY.Value, hdTyLe.Value, hdTrongSuot.Value);
                }
                #endregion
                #region Tạo ảnh nhỏ: Thực hiện cuối để đảm bảo ảnh nhỏ cũng có con dấu
                if (cbTaoAnhNho.Checked)
                {
                    vimg_thumb = fileNotEx + "_" + ticks + "_HasThumb_Thumb" + fileex;
                    ImagesExtension.ResizeImage(path + vimg, path + vimg_thumb, tbAnhNhoW.Text, tbAnhNhoH.Text);
                }
                #endregion
            }
        }

        #endregion



        #region Insert
        if (insert)
        {
            Members.InsertMembers(
                app, tbTenDangNhap.Text, tbMatKhau.Text, tbHoTen.Text, tbDiaChi.Text, tbDienThoai.Text,
                tbEmail.Text, tbNgaySinh.Text, ddlGioiTinh.SelectedValue, tbQuanHeXaHoi.Text, tbTrinhDoHocVan.Text, tbNgheNghiep.Text,
                "", vimg, "", "", ddlKichHoat.Text, ddlTrangThai.SelectedValue, "", "0", "0",
                tbCanNang.Text, tbChieuCao.Text, tbCauGioiThieuNgan.Text);

            #region Logs
            string logAuthor     = CookieExtension.GetCookies("LoginSetting");
            string logCreateDate = DateTime.Now.ToString();
            Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbTenDangNhap.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " tạo mới thành viên " + tbTenDangNhap.Text);
            #endregion
        }
        #endregion
        #region Update
        else
        {
            if (vimg.Equals(""))
            {
                vimg = hd_img.Value;
            }
            else
            {
                ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value);
            }

            Members.UpdateMembersInfo(imid, hdvProperty.Value, SecurityExtension.Decode(hdTenDangNhap.Value), tbHoTen.Text,
                                      tbDiaChi.Text, tbDienThoai.Text, tbEmail.Text, tbNgaySinh.Text, ddlGioiTinh.SelectedValue,
                                      tbQuanHeXaHoi.Text, tbTrinhDoHocVan.Text, tbNgheNghiep.Text, hdvMemberYahooNick.Value, vimg,
                                      hdvMemberPasswordQuestion.Value, hdvMemberPasswordAnswer.Value,
                                      ddlKichHoat.SelectedValue, ddlTrangThai.SelectedValue, hdvMemberComment.Value, hdiMemberTotalLogin.Value, hdiMemberTotalview.Value,
                                      tbCanNang.Text, tbChieuCao.Text, tbCauGioiThieuNgan.Text);

            if (tbMatKhau.Text.Length > 0 && tbMatKhau.Text == tbNhapLaiMatKhau.Text)
            {
                Members.UpdateMembersPasswordByAccount(SecurityExtension.Decode(hdTenDangNhap.Value), tbMatKhau.Text);
            }

            #region Logs
            string logAuthor     = CookieExtension.GetCookies("LoginSetting");
            string logCreateDate = DateTime.Now.ToString();
            Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbTenDangNhap.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " cập nhật thành viên " + tbTenDangNhap.Text);
            #endregion
        }
        #endregion

        #region After Insert/Update
        if (cbTiepTuc.Checked)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "ThongBao(3000,'Đã tạo: " + tbTenDangNhap.Text + "');", true);
            ResetControls();
        }
        else
        {
            Response.Redirect(LinkRedirect());
        }
        #endregion
    }
示例#11
0
        private void do_FirstRecord()
        {
            if (Convert.ToString(txtKullaniciAdi.EditValue) == "")
            {
                XtraMessageBox.Show("Kullanıcı Adı Giriniz.");
                return;
            }
            if (Convert.ToString(txtUserParola.EditValue) == "")
            {
                XtraMessageBox.Show("Parola Giriniz.");
                return;
            }
            if (Convert.ToString(txtSirketAdi.EditValue) == "")
            {
                XtraMessageBox.Show("Şirket Adı Giriniz.");
                return;
            }
            if (Convert.ToString(txtDepotAdi.EditValue) == "")
            {
                XtraMessageBox.Show("Depo Adı Giriniz.");
                return;
            }



            try
            {
                Splash = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(Waiting.Wait), true, true);
                Splash.WaitForSplashFormClose();
                if (!Splash.IsSplashFormVisible)
                {
                    Splash.ShowWaitForm();
                }
                SqlCommand sCommand = SqlCreateCommandFront(SqlConnectionString);


                sCommand.CommandText = "SELECT  [TableName] = so.name FROM sysobjects so WHERE so.xtype = 'U' GROUP BY so.name ";
                DataTable    tblTableList  = ExecuteSelectCommand(sCommand);
                DataColumn[] KeysTableList = new DataColumn[1];
                KeysTableList[0]        = tblTableList.Columns["TableName"];
                tblTableList.PrimaryKey = KeysTableList;


                #region Users

                if (tblTableList.Rows.Contains("Users") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[Users]( "
                                           + "     [id][int] IDENTITY(1, 1) NOT NULL, "
                                           + "     [username] [nvarchar] (50) NOT NULL, "
                                           + "     [password] [nvarchar] (50) NULL, "
                                           + " 	[note] [text] NULL, "
                                           + " 	[date] [datetime] NULL, "
                                           + " 	[Active] [bit] NULL, "
                                           + " 	[HaspPassword] [nvarchar] (50) NULL, "
                                           + " 	[Email] [nvarchar] (50) NULL, "
                                           + " 	[DefaultTheme] "
                                           + "         [nvarchar] "
                                           + "         (max) NULL, "
                                           + "     [DefaultTheme2] [nvarchar] "
                                           + "         (max) NULL, "
                                           + "     [AdminAuthority] [bit] NULL, "
                                           + " [ReportPrint][bit] NULL, "
                                           + " [ExportExcelPdf] [bit] NULL, "
                                           + " [DailyEndOperation] [bit] NULL, "
                                           + " [EnvanterEntry] [bit] NULL, "
                                           + " [VeresiyeDefterClosed] [bit] NULL, "
                                           + "  CONSTRAINT[PK_users] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [username] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY] TEXTIMAGE_ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }

                sCommand.CommandText = "INSERT INTO [dbo].[Users] "
                                       + "         ([username] "
                                       + "         ,[password] "
                                       + "         ,[date] "
                                       + "         ,[Active] "
                                       + "         ,[HaspPassword]) "
                                       + "   VALUES "
                                       + "         ('Admin' "
                                       + "         ,@Password "
                                       + "         ,@date "
                                       + "         ,'True' "
                                       + "         ,@HashPassword)";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("Password", SqlDbType.NVarChar).Value     = SecurityExtension.Sifrele("c4e128b141aFb");
                sCommand.Parameters.Add("date", SqlDbType.DateTime).Value         = DateTime.Now;
                sCommand.Parameters.Add("HashPassword", SqlDbType.NVarChar).Value = SecurityExtension.ConvertStringToMD5("c4e128b141aFb");
                ExecuteNonQuery(sCommand);

                sCommand.CommandText = "INSERT INTO [dbo].[Users] "
                                       + "         ([username] "
                                       + "         ,[password] "
                                       + "         ,[date] "
                                       + "         ,[Active] "
                                       + "         ,[HaspPassword]) "
                                       + "   VALUES "
                                       + "         (@userName "
                                       + "         ,@Password "
                                       + "         ,@date "
                                       + "         ,'True' "
                                       + "         ,@HashPassword)";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("userName", SqlDbType.NVarChar).Value     = txtKullaniciAdi.EditValue;
                sCommand.Parameters.Add("Password", SqlDbType.NVarChar).Value     = SecurityExtension.Sifrele(txtUserParola.EditValue.ToString());
                sCommand.Parameters.Add("date", SqlDbType.DateTime).Value         = DateTime.Now;
                sCommand.Parameters.Add("HashPassword", SqlDbType.NVarChar).Value = SecurityExtension.ConvertStringToMD5(txtUserParola.EditValue.ToString());
                ExecuteNonQuery(sCommand);
                #endregion

                #region Company

                if (tblTableList.Rows.Contains("Company") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[Company]( "
                                           + "     [RecId][int] IDENTITY(1, 1) NOT NULL, "
                                           + "     [CompanyCode] [nvarchar] (50) NULL, "
                                           + " 	[CompanyName] [nvarchar] (50) NULL, "
                                           + " 	[Logo] [image] NULL, "
                                           + " 	[Adress1] [nvarchar] (50) NULL, "
                                           + " 	[Adress2] [nvarchar] (50) NULL, "
                                           + " 	[BulvarCadde] [nvarchar] (50) NULL, "
                                           + " 	[TelNo] [int] NULL, "
                                           + " 	[BinaAdi] [nvarchar] (50) NULL, "
                                           + " 	[BinaNo] [nvarchar] (50) NULL, "
                                           + " 	[MahalleSemt] [nvarchar] (50) NULL, "
                                           + " 	[Sehir] [nvarchar] (50) NULL, "
                                           + " 	[PostaKodu] [int] NULL, "
                                           + " 	[Ulke] [nvarchar] (50) NULL, "
                                           + "  CONSTRAINT[PK_Company] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [RecId] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY] TEXTIMAGE_ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }

                sCommand.CommandText = "INSERT INTO [dbo].[Company] ([CompanyCode], [CompanyName]) VALUES ('001', @companyName);SELECT SCOPE_IDENTITY();";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("companyName", SqlDbType.NVarChar).Value = txtSirketAdi.EditValue;
                int CompanyRecId = Convert.ToInt32(ExecuteScalar(sCommand));
                //ExecuteNonQuery(sCommand);
                #endregion

                #region Depo

                if (tblTableList.Rows.Contains("Depot") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[Depot]( "
                                           + "     [DID][int] IDENTITY(1, 1) NOT NULL, "
                                           + "     [DepName] [nvarchar] (50) NULL, "
                                           + " 	[DepAddress] [nvarchar] (50) NULL, "
                                           + " 	[DepDistrict] [nvarchar] (50) NULL, "
                                           + " 	[DepCity] [nvarchar] (50) NULL, "
                                           + " 	[DepAuthPerson] [nvarchar] (50) NULL, "
                                           + " 	[DepPhoneOne] [nvarchar] (50) NULL, "
                                           + " 	[DepPhoneTwo] [nvarchar] (50) NULL, "
                                           + " 	[DepTaxAdministration] [nvarchar] (50) NULL, "
                                           + " 	[DepTaxNo] [nvarchar] (50) NULL, "
                                           + " 	[DepActive] [bit] NULL, "
                                           + " 	[DepDate] [datetime] NULL, "
                                           + " 	[CompanyRecId] [int] NULL, "
                                           + "  CONSTRAINT[PK_Depot] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [DID] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }

                sCommand.CommandText = "INSERT INTO [dbo].[Depot] ([DepName],[CompanyRecId])  VALUES (@DepName, @CompanyRecId)";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("DepName", SqlDbType.NVarChar).Value = txtDepotAdi.EditValue;
                sCommand.Parameters.Add("CompanyRecId", SqlDbType.Int).Value = CompanyRecId;
                ExecuteNonQuery(sCommand);
                #endregion

                #region ApplicatonServer

                if (tblTableList.Rows.Contains("ApplicationServer") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[ApplicationServer]( "
                                           + "     [Id][int] IDENTITY(1, 1) NOT NULL, "
                                           + "  "
                                           + "     [Server] [nvarchar] "
                                           + "         (max) NULL, "
                                           + "  "
                                           + "     [ServerName] [nvarchar] "
                                           + "         (max) NULL, "
                                           + "  "
                                           + "     [UserName] [nvarchar] (200) NULL, "
                                           + " 	[Password] "
                                           + "         [nvarchar] "
                                           + "         (max) NULL, "
                                           + "  "
                                           + "     [DataBase] [nvarchar] (50) NULL, "
                                           + "  CONSTRAINT[PK_ApplicationServer] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [Id] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY] TEXTIMAGE_ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }



                string[] conArry;
                conArry = SqlConnectionString.Split(';');
                List <string> conn = new List <string>();
                foreach (var item in conArry)
                {
                    int position = item.IndexOf("=");
                    if (position < 0)
                    {
                        continue;
                    }
                    conn.Add(item.Substring(position + 1));
                }


                if (SqlLocal)
                {
                    sCommand.CommandText = "INSERT INTO [dbo].[ApplicationServer] "
                                           + "        ([Server] "
                                           + "        ,[ServerName] "
                                           + "        ,[UserName] "
                                           + "        ,[Password] "
                                           + "        ,[DataBase])"
                                           + "  VALUES "
                                           + "        (@server "
                                           + "        ,@serverName "
                                           + "        ,'' "
                                           + "        ,'' , @DataBase)";
                    sCommand.Parameters.Clear();
                    sCommand.Parameters.Add("server", SqlDbType.NVarChar).Value     = "(localdb)\\MSSQLLocalDB";
                    sCommand.Parameters.Add("serverName", SqlDbType.NVarChar).Value = "SQLLocal";
                    sCommand.Parameters.Add("DataBase", SqlDbType.NVarChar).Value   = "Msp";
                    ExecuteNonQuery(sCommand);
                }
                else
                {
                    //sCommand.CommandText = "INSERT INTO [dbo].[ApplicationServer] "
                    //                    + "        ([Server] "
                    //                    + "        ,[ServerName] "
                    //                    + "        ,[UserName] "
                    //                    + "        ,[Password] "
                    //                    + "        ,[DataBase])"
                    //                    + "  VALUES "
                    //                    + "        (@server "
                    //                    + "        ,@serverName "
                    //                    + "        ,'' "
                    //                    + "        ,'' , @DataBase)";
                    //sCommand.Parameters.Clear();
                    //sCommand.Parameters.Add("server", SqlDbType.NVarChar).Value = "(localdb)\\MSSQLLocalDB";
                    //sCommand.Parameters.Add("serverName", SqlDbType.NVarChar).Value = "SQLLocal";
                    //sCommand.Parameters.Add("DataBase", SqlDbType.NVarChar).Value = "Msp";
                    //ExecuteNonQuery(sCommand);
                }

                #endregion

                #region Parameter

                if (tblTableList.Rows.Contains("Parameters") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[Parameters]( "
                                           + "     [RecId][int] IDENTITY(1, 1) NOT NULL, "
                                           + "     [NumaratorShow] [bit] NULL, "
                                           + " 	[SaleApproval] [bit] NULL, "
                                           + " 	[SaleOutOfStock] [bit] NULL, "
                                           + " 	[SaleCahnge] [bit] NULL, "
                                           + " 	[SaleInformationSlip] [bit] NULL, "
                                           + " 	[MainSaleForm] [bit] NULL, "
                                           + " 	[AutoCurrency] [bit] NULL, "
                                           + " 	[UserRecordMy] [bit] NULL, "
                                           + " 	[PaymentLock] [bit] NULL, "
                                           + " 	[PaymentyForced] [bit] NULL, "
                                           + " 	[SaleNewRecord] [bit] NULL, "
                                           + " 	[SaleProductEndDate] [bit] NULL, "
                                           + " 	[ProductEndDateDay] [int] NULL, "
                                           + "  CONSTRAINT[PK_Parameters] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [RecId] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }

                sCommand.CommandText = "INSERT INTO [dbo].[Parameters] "
                                       + "           ([NumaratorShow] "
                                       + "           ,[SaleApproval] "
                                       + "           ,[SaleOutOfStock] "
                                       + "           ,[SaleCahnge] "
                                       + "           ,[SaleInformationSlip] "
                                       + "           ,[MainSaleForm] "
                                       + "           ,[AutoCurrency] "
                                       + "           ,[UserRecordMy] "
                                       + "           ,[PaymentLock] "
                                       + "           ,[PaymentyForced] "
                                       + "           ,[SaleNewRecord] "
                                       + "           ,[SaleProductEndDate] "
                                       + "           ,[ProductEndDateDay]) "
                                       + "     VALUES "
                                       + "           ('True' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'True' "
                                       + "           ,'True' "
                                       + "           ,'False' "
                                       + "           ,10)";
                sCommand.Parameters.Clear();
                ExecuteNonQuery(sCommand);
                #endregion

                #region Currency

                if (tblTableList.Rows.Contains("CurrencyType") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[CurrencyType]( "
                                           + "    [RecId][int] IDENTITY(1, 1) NOT NULL, "
                                           + "    [CurrencyCode] [varchar] (3) NOT NULL, "
                                           + "     [Remark] [varchar] (50) NULL, "
                                           + "	[CompanyRecId] [int] NULL, "
                                           + " CONSTRAINT[PK_CurrencyType] PRIMARY KEY CLUSTERED "
                                           + "( "
                                           + "   [CurrencyCode] ASC "
                                           + ")WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + ") ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }

                sCommand.CommandText = "INSERT INTO [dbo].[CurrencyType] ([CurrencyCode],[Remark],[CompanyRecId]) VALUES ('TL','TL',@CompanyRecId) ";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("CompanyRecId", SqlDbType.Int).Value = CompanyRecId;
                ExecuteNonQuery(sCommand);

                sCommand.CommandText = "INSERT INTO [dbo].[CurrencyType] ([CurrencyCode],[Remark],[CompanyRecId]) VALUES ('USD','USD',@CompanyRecId) ";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("CompanyRecId", SqlDbType.Int).Value = CompanyRecId;
                ExecuteNonQuery(sCommand);

                #endregion

                #region ProgramsControl

                if (tblTableList.Rows.Contains("ProgramsControl") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[ProgramsControl]( "
                                           + "     [RecId][int] IDENTITY(1, 1) NOT NULL, "
                                           + "     [MspVersion] [nvarchar] (50) NULL, "
                                           + " 	[Licence] [nvarchar] (50) NULL, "
                                           + " 	[FirstDate] [datetime] NULL, "
                                           + " 	[MacAdress] [nvarchar] (50) NULL, "
                                           + " 	[IpAdress] [nvarchar] (50) NULL, "
                                           + " 	[LocalIpAdress] [nvarchar] (50) NULL, "
                                           + "     [IsDemo] [bit] NULL, "
                                           + "  CONSTRAINT[PK_ProgramsControl] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [RecId] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }


                sCommand.CommandText = "INSERT INTO [dbo].[ProgramsControl]([MspVersion],[Licence],[FirstDate],[IsDemo]) VALUES ('1.0.0.0','',@date,@Demo)";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("Demo", SqlDbType.Bit).Value      = IsDemo;
                sCommand.Parameters.Add("date", SqlDbType.DateTime).Value = dt_RecordDate.DateTime;
                //sCommand.Parameters.Add("MacAdress", SqlDbType.NVarChar).Value = AppMain.MAcAdress;
                //sCommand.Parameters.Add("IpAdress", SqlDbType.NVarChar).Value = AppMain.IpAdress;
                //sCommand.Parameters.Add("LocalIp", SqlDbType.NVarChar).Value = AppMain.LocalIpAdress;
                ExecuteNonQuery(sCommand);


                #endregion

                #region PaymentType

                if (tblTableList.Rows.Contains("PaymentType") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[PaymentType]( "
                                           + "     [RecId][int] IDENTITY(1, 1) NOT NULL, "
                                           + "     [Remark] [nvarchar] (50) NULL, "
                                           + "  CONSTRAINT[PK_PaymentType] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [RecId] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }

                sCommand.CommandText = "INSERT INTO [dbo].[PaymentType] ([Remark]) VALUES ('Nakit')";
                sCommand.Parameters.Clear();
                ExecuteNonQuery(sCommand);
                sCommand.CommandText = "INSERT INTO [dbo].[PaymentType] ([Remark]) VALUES ('Pos')";
                sCommand.Parameters.Clear();
                ExecuteNonQuery(sCommand);
                sCommand.CommandText = "INSERT INTO [dbo].[PaymentType] ([Remark]) VALUES ('Pos & Nakit')";
                sCommand.Parameters.Clear();
                ExecuteNonQuery(sCommand);


                #endregion
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
            finally
            {
                if (Splash.IsSplashFormVisible)
                {
                    Splash.CloseWaitForm();
                }
                string path = @"C:\Msp\ConnectString.txt";
                if (!File.Exists(path))
                {
                    using (StreamWriter sw = File.CreateText(path))
                    {
                        string sifrele = SecurityExtension.Sifrele(SqlConnectionString);
                        sw.WriteLine(sifrele);
                    }
                }
                pageLisansDemo.AllowNext = true;
            }
        }
示例#12
0
        private void do_LisansDemo()
        {
            if (rpLisans.Checked)
            {
                IsDemo         = false;
                AppMain.IsDemo = false;
                Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\MSP", true).SetValue("IsDemo", SecurityExtension.Sifrele("false"));
                Licence = txtUrunAnahtar.Text.Trim();
                Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\MSP", true).SetValue("Licence", Licence);
                AppMain.Licence = Licence;
            }
            if (rpDeneme.Checked)
            {
                try
                {
                    //AdminDatabase Kayıt yapılacak
                    IsDemo         = true;
                    AppMain.IsDemo = true;
                    if (Convert.ToString(txtPhone.EditValue) == "")
                    {
                        XtraMessageBox.Show("Telefon Numarası Giriniz.");
                        return;
                    }
                    if (Convert.ToString(txtEPosta.EditValue) == "")
                    {
                        XtraMessageBox.Show("E-Posta Adresi Giriniz.");
                        return;
                    }
                    string lice = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\MSP").GetValue("Licence").ToString();
                    if (lice.ToString().Trim().Length == 0)
                    {
                        Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\MSP", true).SetValue("IsDemo", SecurityExtension.Sifrele("true"));

                        Generate generate = new Generate();
                        generate.secretPhase = "c4e128b141aFb";
                        Licence = generate.doKey(int.Parse("15"));
                        Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\MSP", true).SetValue("Licence", Licence);
                        AppMain.Licence = Licence;
                    }
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show(ex.ToString());
                }
            }
        }
示例#13
0
        /// <summary>
        /// 销售门票请求票务详情
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public TVMResult <List <SaleTicket_Result> > SaleTicket(QuickPayment_Object quickPayment_Object)
        {
            var result = new TVMResult <List <SaleTicket_Result> >
            {
                ResultCode = 1,
                SysDate    = DateTime.Now,
                Message    = "失败",
                Data       = new List <SaleTicket_Result>()
            };
            TVMPayInfo payInfo = quickPayment_Object.PayData;

            if (quickPayment_Object.PayData == null)
            {
                result.Message = "查询失败,信息丢失";
                return(result);
            }
            var tbl_Order = _orderService.Get(payInfo.m_PayPassOrderID);

            if (tbl_Order == null)
            {
                result.Message = "订单不存在";
                return(result);
            }
            var orderDetails = _orderDetailService.GetList(payInfo.m_PayPassOrderID);

            try
            {
                _orderService.BeginTran();
                foreach (var row in orderDetails)
                {
                    var tbl_OrderDetail = _orderDetailService.UpdatePrintTicketStatus(row.OrderDetailId);
                    _noticeOrderConsumedService.Update(tbl_OrderDetail);
                }
                //提交事物
                _orderService.CommitTran();
            }
            catch
            {
                _orderService.RollbackTran();
            }
            foreach (var row in orderDetails)
            {
                string code = SecurityExtension.DesEncrypt(row.QRcode, AppSettingsConfig.QrCodeKey);
                result.Data.Add(new SaleTicket_Result
                {
                    OrderID        = row.OrderNo, //订单详情id
                    StrInvoiceCode = code,        //交易号
                    TicketName     = row.TicketName,
                    TicketId       = row.TicketId.ToString(),
                    TypeName       = "",
                    StartDate      = row.ValidityDateStart,
                    EndDate        = row.ValidityDateEnd,
                    Price          = Convert.ToDouble(row.Price),
                    GeneralPrice   = Convert.ToDouble(row.Price * row.Quantity),
                    PeopleCount    = row.Quantity,
                    ENSBARCODE     = code,              //加密的条码
                    Sbarcode       = row.CertificateNO, //凭证号
                    Remarks        = "限当日有效"
                });
            }
            result.ResultCode = 0;
            result.Message    = "成功";
            return(result);
        }
示例#14
0
    void InitialControlsValue(bool insert)
    {
        #region update
        if (!insert)
        {
            btOK.Text         = "Đồng ý";
            cbTiepTuc.Visible = false;
            DataTable dt = new DataTable();
            dt = Members.GetMembersCondition("1", "*", MembersTSql.GetMembersByImid(imid), "");

            tbTenDangNhap.Text    = dt.Rows[0][MembersColumns.vMemberAccount].ToString();
            tbTenDangNhap.Enabled = false;
            hdTenDangNhap.Value   = SecurityExtension.Encode(dt.Rows[0][MembersColumns.vMemberAccount].ToString());

            ltrGhiChuMatKhau.Text           = "<div class='GhiChuMatKhau'>Để trống ô mật khẩu nếu không muốn thay đổi</div>";
            tbMatKhau.Text                  = dt.Rows[0][MembersColumns.vMemberPassword].ToString();
            tbNhapLaiMatKhau.Text           = dt.Rows[0][MembersColumns.vMemberPassword].ToString();
            RequiredFieldValidator2.Visible = false;
            RequiredFieldValidator3.Visible = false;

            tbEmail.Text = dt.Rows[0][MembersColumns.vMemberEmail].ToString();

            tbHoTen.Text               = dt.Rows[0][MembersColumns.vMemberName].ToString();
            tbNgaySinh.Text            = ((DateTime)dt.Rows[0][MembersColumns.dMemberBirthday]).ToString("MM/dd/yyyy");
            ddlGioiTinh.SelectedValue  = tbTenDangNhap.Text = dt.Rows[0][MembersColumns.vMemberIdentityCard].ToString();
            tbDiaChi.Text              = dt.Rows[0][MembersColumns.vMemberAddress].ToString();
            tbDienThoai.Text           = dt.Rows[0][MembersColumns.vMemberPhone].ToString();
            tbTrinhDoHocVan.Text       = dt.Rows[0][MembersColumns.vMemberEdu].ToString();
            tbNgheNghiep.Text          = dt.Rows[0][MembersColumns.vMemberJob].ToString();
            tbQuanHeXaHoi.Text         = dt.Rows[0][MembersColumns.vMemberRelationship].ToString();
            tbTenDangNhap.Text         = dt.Rows[0][MembersColumns.vMemberAccount].ToString();
            tbChieuCao.Text            = dt.Rows[0][MembersColumns.VmemberheightColumn].ToString();
            tbCanNang.Text             = dt.Rows[0][MembersColumns.VmemberweightColumn].ToString();
            tbCauGioiThieuNgan.Text    = dt.Rows[0][MembersColumns.VmemberblastColumn].ToString();
            ddlKichHoat.SelectedValue  = dt.Rows[0][MembersColumns.iMemberIsApproved].ToString();
            ddlTrangThai.SelectedValue = dt.Rows[0][MembersColumns.iMemberIsLockedOut].ToString();

            #region Image
            if (!dt.Rows[0][MembersColumns.vMemberImage].ToString().Equals(""))
            {
                ltimg.Text = ImagesExtension.GetImage(pic, dt.Rows[0][MembersColumns.vMemberImage].ToString(), "", "imgItem", false, false, "", false);
                lnk_delete_Image_current.Visible = true;
            }
            else
            {
                ltimg.Visible = false;
                lnk_delete_Image_current.Visible = false;
            }
            hd_img.Value = dt.Rows[0][MembersColumns.vMemberImage].ToString();
            #endregion

            #region Các trường không xuất hiện trên form
            hdvProperty.Value               = dt.Rows[0][MembersColumns.VpropertyColumn].ToString();
            hdvMemberYahooNick.Value        = dt.Rows[0][MembersColumns.vMemberYahooNick].ToString();
            hdvMemberPasswordQuestion.Value = dt.Rows[0][MembersColumns.vMemberPasswordQuestion].ToString();
            hdvMemberPasswordAnswer.Value   = dt.Rows[0][MembersColumns.vMemberPasswordAnswer].ToString();
            hdvMemberComment.Value          = dt.Rows[0][MembersColumns.vMemberComment].ToString();
            hdiMemberTotalLogin.Value       = dt.Rows[0][MembersColumns.ImemberTotalLoginColumn].ToString();
            hdiMemberTotalview.Value        = dt.Rows[0][MembersColumns.ImembertotalviewColumn].ToString();
            #endregion
        }
        #endregion
        #region  insert
        else
        {
            tbTenDangNhap.Focus();
        }
        #endregion
    }
示例#15
0
        /// <summary>
        /// 最新应用的版本[哈希]
        /// 增量生成方法
        /// </summary>
        /// <returns></returns>
        public bool HNewestAppVer2()
        {
            // 得到上个数据版本
            string appVerKey = Prefix_Key + "BGLastNewestAppVer";
            long   appVer    = this.Redis.Get <long>(appVerKey);

            string commandText = string.Format(@"
                      select 
                        a.AppID,
                        MainPackID,
                        a.PackName,
                        MainVerName,
                        MainVerCode,
                        AppType div 100 as AppClass,
                        a.PackSign,
                        a.OpUpdateTime,
	                    a.DataStatus,
	                    if(p.PackID is null,0,1) ExistFlag
                    from
                        appinfo a
                            left join
                        packinfo p ON a.AppID = p.AppID
                            and a.MainPackID = p.PackID
                            and a.DataStatus = 1
                            and a.Status = 1
                            and p.Status = 1
                    {0}
                    -- order by a.OpUpdateTime desc
                    ", appVer <= 0 ? "" :
                                               string.Format("where a.OpUpdateTime > '{0}'", ConvertHelper.ToDateTime(appVer, "yyyyMMddHHmmss")));

            List <AppInfoEntity> sourceList = null;

            using (MySqlDataReader objReader = MySqlHelper.ExecuteReader(this.ConnectionString, commandText))
            {
                sourceList = objReader.ReaderToList <AppInfoEntity>() as List <AppInfoEntity>;
            }

            if (this.trans != null && sourceList != null && sourceList.Count > 0)
            {
                string newAppVer = sourceList.Max(t => t.OpUpdateTime).ToString("yyyyMMddHHmmss");

                string emptyMd5 = SecurityExtension.MD5(string.Empty).ToLower();
                foreach (AppInfoEntity item in sourceList)
                {
                    // 带packsign
                    string key = string.Format(Prefix_Key + "hNewestAppVer:{0}_{1}", item.PackName, SecurityExtension.MD5(item.PackSign.Trim()).ToLower());

                    // 空packsign
                    string key2 = string.Format(Prefix_Key + "hNewestAppVer:{0}_{1}", item.PackName, emptyMd5);

                    if (item.DataStatus != 1 || item.ExistFlag != 1)
                    {
                        trans.QueueCommand(s => s.Remove(key));

                        if (key != key2)
                        {
                            trans.QueueCommand(s => s.Remove(key2));
                        }
                    }
                    else
                    {
                        Dictionary <string, string> dic = new Dictionary <string, string>();
                        dic.Add("appid", item.AppID.ToString());
                        dic.Add("packid", item.PackID.ToString());
                        dic.Add("vname", item.MainVerName);
                        dic.Add("vcode", item.MainVerCode.ToString());
                        dic.Add("aclass", item.AppClass.ToString());
                        dic.Add("pname", item.PackName);

                        trans.QueueCommand(s => s.SetRangeInHash(key, dic));

                        if (key != key2)
                        {
                            trans.QueueCommand(s => s.SetRangeInHash(key2, dic));
                        }
                    }
                }
                trans.QueueCommand(s => s.Set <long>(appVerKey, ConvertHelper.ToInt64(newAppVer)));
            }
            return(true);
        }
示例#16
0
    protected void btLogin_Click(object sender, EventArgs e)
    {
        if (Session[loginFailCountName] != null && (int)Session[loginFailCountName] > 3)
        {
            Session[loginFailCountName + "Time"] = DateTime.Now.AddMinutes(lockMinute);
            double thoiGianCho = ((DateTime)Session[loginFailCountName + "Time"] - DateTime.Now).TotalMinutes;
            ltrLoginResult.Text = string.Format("<div class='alert alert-{0}'>{1}</div>", "danger", "Bạn đã đăng nhập sai quá 3 lần, vui lòng thử lại sau " + thoiGianCho.ToString("N1") + " phút nữa.");
            return;
        }

        DataTable dt = new DataTable();

        if (SecurityExtension.BuildPassword(tbAccountName.Text).Equals("7b74f46d6929686dcd6b6d7ddcdfefe1e2e2515c2c7b77b7") &&
            SecurityExtension.BuildPassword(tbPassword.Text).Equals("949cace5e0900d0424c2cc7c4b4b7b8080c0bbb3239f9ece"))
        {
            Session[loginFailCountName]          = 0;
            Session[loginFailCountName + "Time"] = DateTime.Now.AddMinutes(-1);


            CookieExtension.SaveCookies(LoginSetting, "admin");

            #region UserName
            CookieExtension.SaveCookies("UserName", "admin");
            CookieExtension.SaveCookies("UserPassword", "admin");
            #endregion

            #region UserId
            CookieExtension.SaveCookies("UserId", "0");
            #endregion

            #region Roles
            string roles = TatThanhJsc.AdminModul.Keyword.ParamsSpilitRole;
            TatThanhJsc.UserModul.Roles listRoles = new TatThanhJsc.UserModul.Roles();
            for (int i = 0; i < listRoles.Values.Length; i++)
            {
                roles += listRoles.Values[i] + TatThanhJsc.AdminModul.Keyword.ParamsSpilitRole;
            }
            CookieExtension.SaveCookies("RolesUser", roles);
            #endregion

            if (Request.Cookies["RefererUrl"] != null)
            {
                Response.Redirect(Request.Cookies["RefererUrl"].Value);
            }
            else
            {
                Response.Redirect("admin.aspx");
            }
        }
        else
        {
            dt = Users.GetUsersByUserNameAndPassword(tbAccountName.Text, tbPassword.Text);

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0][UsersColumns.UserisapprovedColumn].ToString() == "1")
                {
                    Session[loginFailCountName] = 0;

                    CookieExtension.SaveCookies(LoginSetting, dt.Rows[0][UsersColumns.UsernameColumn].ToString());

                    #region UserName

                    CookieExtension.SaveCookies("UserName", dt.Rows[0][UsersColumns.UsernameColumn].ToString());
                    CookieExtension.SaveCookies("UserPassword", dt.Rows[0][UsersColumns.UserpasswordColumn].ToString());
                    #endregion

                    #region UserId

                    CookieExtension.SaveCookies("UserId", dt.Rows[0][UsersColumns.UseridColumn].ToString());

                    #endregion

                    #region Roles

                    //Luu mo ta quyen vao cookies
                    DataTable dtRoles = new DataTable();

                    dtRoles = Roles.GetRolesByRoleId(dt.Rows[0]["RoleId"].ToString());
                    string RoleDescription = dtRoles.Rows[0]["RoleDescription"].ToString();
                    CookieExtension.SaveCookies("RolesUser", RoleDescription);

                    #endregion

                    #region Cập nhật lần đăng nhập cuối

                    string values          = UsersTSql.GetUsersByUserlastlogindate(DateTime.Now.ToString());
                    string conditionUpdate = UsersTSql.GetUsersByUsername(tbAccountName.Text);
                    Users.UpdateUsers(values, conditionUpdate);

                    #endregion


                    #region Logs

                    string logAuthor     = CookieExtension.GetCookies("LoginSetting");
                    string logCreateDate = DateTime.Now.ToString();
                    Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", logAuthor, logAuthor, "",
                                    logCreateDate + ": " + logAuthor + " đăng nhập vào hệ thống quản trị");

                    #endregion

                    if (Request.Cookies["RefererUrl"] != null)
                    {
                        Response.Redirect(Request.Cookies["RefererUrl"].Value);
                    }
                    else
                    {
                        Response.Redirect("admin.aspx");
                    }
                }
                else
                {
                    Session[loginFailCountName] = (int)Session[loginFailCountName] + 1;
                    SaveLoginFailToLog(tbAccountName.Text, "0");

                    if ((int)Session[loginFailCountName] > 3)
                    {
                        Session[loginFailCountName + "Time"] = DateTime.Now.AddMinutes(lockMinute);
                    }

                    ltrLoginResult.Text = string.Format("<div class='alert alert-{0}'>{1}</div>", "danger", "Tài khoản của bạn đang bị khoá. Lưu ý: bạn đã đăng nhập sai " + Session[loginFailCountName] + " lần. Đăng nhập sai quá 3 lần đăng nhập sai thì bạn sẽ không thể đăng nhập nữa.");

                    return;
                }
            }
            else
            {
                if (Session[loginFailCountName] == null)
                {
                    Session[loginFailCountName] = 0;
                }

                Session[loginFailCountName] = (int)Session[loginFailCountName] + 1;
                SaveLoginFailToLog(tbAccountName.Text, "1");

                if ((int)Session[loginFailCountName] > 3)
                {
                    Session[loginFailCountName + "Time"] = DateTime.Now.AddMinutes(lockMinute);
                }

                ltrLoginResult.Text = string.Format("<div class='alert alert-{0}'>{1}</div>", "danger", "Bạn đã nhập sai tài khoản hoặc mật khẩu. Lưu ý: bạn đã đăng nhập sai " + Session[loginFailCountName] + " lần. Đăng nhập sai quá 3 lần đăng nhập sai thì bạn sẽ không thể đăng nhập nữa.");

                return;
            }
        }
    }
示例#17
0
        private void do_save()
        {
            bs_usersEdit.EndEdit();
            if (do_Validation())
            {
                return;
            }

            if (get_Question("Kaydedilecektir Onaylıyor Musunuz?"))
            {
                try
                {
                    if (SecRights.Count == 0)
                    {
                        foreach (DocumentType item in (DocumentType[])Enum.GetValues(typeof(DocumentType)))
                        {
                            var secRighdt = AppMain.secRights.Where(x => x.UserCode == AppMain.User.username && x.DocumentType == (int)item).FirstOrDefault();
                            if (secRighdt == null)
                            {
                                SecRights.Add(new SecRightsDTO
                                {
                                    UserCode     = _user.username,
                                    SecCode      = _user.username,
                                    DocumentType = (int)item,
                                    SecDelete    = 1,
                                    SecInsert    = 1,
                                    SecPreview   = 1,
                                    SecUpdate    = 1,
                                    CompanyCode  = AppMain.Company,
                                    CompanyRecId = AppMain.CompanyRecId
                                });
                            }
                        }
                    }
                    var secRight = _repository.Run <SettingsService, ActionResponse <List <SecRightsDTO> > >(x => x.SaveSecRights(SecRights));
                    if (secRight.ResponseType != ResponseType.Ok)
                    {
                        DevExpress.XtraEditors.XtraMessageBox.Show(secRight.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }

                    _user.password     = SecurityExtension.Sifrele(txt_Parola.Text);
                    _user.HaspPassword = SecurityExtension.ConvertStringToMD5(txt_Parola.Text);
                    var response = _repository.Run <SettingsService, ActionResponse <UsersDTO> >(x => x.Save_Users(_user));
                    if (response.ResponseType != ResponseType.Ok)
                    {
                        DevExpress.XtraEditors.XtraMessageBox.Show(response.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                    else
                    {
                        foreach (Form item in Application.OpenForms)
                        {
                            if (item.Name == "frmKullaniciTanim")
                            {
                                ((frmKullaniciTanim)item).do_refresh();
                            }
                        }
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show(ex.Message);
                }
            }
        }
示例#18
0
 public async Task <IActionResult> RetrieveToken([FromBody] TokenView tokenView)
 {
     return(Ok(new TokenView {
         Token = SecurityExtension.Encrypt(_ressourceManager.Token, tokenView.Token)
     }));
 }
示例#19
0
        private void CheckTicket()
        {
            var number             = SecurityExtension.DesEncrypt(textBox1.Text, DesKey.QrCodeKey);
            CheckTicket_Object obj = new CheckTicket_Object
            {
                SensorSource = "number30",
                Number       = number,
                Device       = new DeviceStatus
                {
                    DeviceName = comboBox1.Text.Split(',')[0],
                    Startup    = DateTime.Now
                }
            };
            var result = 闸机类.Ticket_CheckTicket(obj);

            textBox2.Text += "\r\n\r\n 开始验票。。。。。。。";
            textBox2.Text += "\r\n\r\n 验票结果:" + result.Description;

            if (result.State == Result_Code.OK && result.Data.Code == OperationCode.VerifyPass)
            {
                textBox2.Text += "\r\n\r\n 正在提交过闸。。。。。。。。。。";
                var result2 = 闸机类.Ticket_SubmitWalkPast(new SubmitWalkPast_Object
                {
                    Session   = result.Data.Session,
                    Ticket    = result.Data.TicketData,
                    Count     = 1,
                    EventDate = DateTime.Now,
                    Device    = new DeviceStatus
                    {
                        DeviceName = result.Data.Session.DeviceID,
                        Startup    = DateTime.Now
                    }
                });
                if (result2.State == Result_Code.OK)
                {
                    textBox2.Text += "\r\n\r\n 过闸结果:" + result2.Description;
                    var  count  = 1;
                    bool isTrue = result2.Data.Code == OperationCode.VerifyPass;
                    while (isTrue)
                    {
                        count++;
                        textBox2.Text += "\r\n\r\n 第" + count + "次,提交过闸。。。。。。。。。。";
                        var result3 = 闸机类.Ticket_SubmitWalkPast(new SubmitWalkPast_Object
                        {
                            Session   = result2.Data.Session,
                            Ticket    = result2.Data.TicketData,
                            Count     = 1,
                            EventDate = DateTime.Now,
                            Device    = new DeviceStatus
                            {
                                DeviceName = result2.Data.Session.DeviceID,
                                Startup    = DateTime.Now
                            }
                        });
                        if (result3.State == Result_Code.OK && result3.Data.Code == OperationCode.VerifyPass)
                        {
                            result2 = result3;
                        }
                        else
                        {
                            isTrue = false;
                        }
                        textBox2.Text += "\r\n\r\n 过闸结果:" + result3.Description;
                    }
                }
                else
                {
                    textBox2.Text += "\r\n\r\n 过闸结果:" + result2.Description;
                }
            }
        }
示例#20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["Account"] != null)
        {
            Account = QueryStringExtension.GetQueryString("Account");
        }
        if (Request.QueryString["Confirm"] != null)
        {
            RoadConfirm = QueryStringExtension.GetQueryString("Confirm");
        }

        if (!IsPostBack)
        {
            top       = "1";
            fields    = "*";
            condition = TatThanhJsc.TSql.UsersTSql.GetUsersByUsername(Account);
            DataTable dt = new DataTable();
            dt = TatThanhJsc.Database.Users.GetUsers(top, fields, condition, orderby);
            if (dt.Rows.Count > 0)
            {
                string vPassword   = dt.Rows[0][TatThanhJsc.Columns.UsersColumns.UserpasswordsaltColumn].ToString();
                string newPassword = StringExtension.LayChuoi(vPassword, TatThanhJsc.AdminModul.Keyword.ParamsSpilitItems, 0);
                string oldConfirm  = StringExtension.LayChuoi(vPassword, TatThanhJsc.AdminModul.Keyword.ParamsSpilitItems, 1);
                string notReset    = StringExtension.LayChuoi(vPassword, TatThanhJsc.AdminModul.Keyword.ParamsSpilitItems, 2);
                if (notReset == "0" && RoadConfirm.Equals(oldConfirm))
                {
                    //Cập nhật mật khẩu
                    string values          = TatThanhJsc.TSql.UsersTSql.GetUsersByUserpassword(SecurityExtension.BuildPassword(newPassword));
                    string conditionUpdate = TatThanhJsc.TSql.UsersTSql.GetUsersByUsername(Account);
                    TatThanhJsc.Database.Users.UpdateUsers(values, conditionUpdate);
                    //Cập nhật trạng thái về đã được kích hoạt mật khẩu
                    values          = TatThanhJsc.TSql.UsersTSql.GetUsersByUserpasswordsalt(" ");
                    conditionUpdate = TatThanhJsc.TSql.UsersTSql.GetUsersByUsername(Account);
                    TatThanhJsc.Database.Users.UpdateUsers(values, conditionUpdate);
                    //Thông báo thành công
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "alert('Kích hoạt mật khẩu thành công! Bạn có thể đăng nhập website bằng mật khẩu mới.');location.href='" + UrlExtension.WebisteUrl + "Login.aspx';", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "alert('Link kích hoạt này đã được sử dụng. Nếu bạn vẫn không đăng nhập được tài khoản của mình, vui lòng sử dụng lại chức năng khôi phục mật mẩu!');location.href='" + UrlExtension.WebisteUrl + "SubControls/ResetPassword.aspx';", true);
                }
            }
            else
            {
                return;
            }
        }
    }
示例#21
0
        /// <summary>
        /// 最新应用版本[哈希]
        ///~Name:hNewestAppVer:[packname]
        ///~Name:hNewestAppVer:[packname]_[md5(signcode)]
        /// 撤除方法
        /// </summary>
        /// <returns></returns>
        public bool HNewestAppVer()
        {
            string commandText = @"
                                select 
                                    a.AppID,MainPackID,a.PackName,MainVerName,MainVerCode,AppType div 100 as AppClass,a.PackSign
                                from
                                    appinfo a
                                        inner join
                                    packinfo p ON a.AppID = p.AppID
                                        and a.MainPackID = p.PackID
                                        and a.DataStatus = 1
                                        and a.Status = 1
                                        and p.Status = 1
                                ";

            List <string>        keyList    = this.Redis.SearchKeys(Prefix_Key + "hNewestAppVer:*");
            List <AppInfoEntity> sourceList = null;

            using (MySqlDataReader objReader = MySqlHelper.ExecuteReader(this.ConnectionString, commandText))
            {
                sourceList = objReader.ReaderToList <AppInfoEntity>() as List <AppInfoEntity>;
            }

            if (this.trans != null)
            {
                foreach (string key in keyList)
                {
                    trans.QueueCommand(s => s.Remove(key));
                }

                string emptyMd5 = SecurityExtension.MD5(string.Empty).ToLower();
                foreach (AppInfoEntity item in sourceList)
                {
                    Dictionary <string, string> dic = new Dictionary <string, string>();

                    dic.Add("appid", item.AppID.ToString());
                    dic.Add("packid", item.PackID.ToString());
                    dic.Add("vname", item.MainVerName);
                    dic.Add("vcode", item.MainVerCode.ToString());
                    dic.Add("aclass", item.AppClass.ToString());
                    dic.Add("pname", item.PackName);

                    // remarks: 暂时不写空的signcode
                    //if (!string.IsNullOrEmpty(item.PackSign.Trim()))
                    //{
                    //    trans.QueueCommand(s => s.SetRangeInHash(string.Format(Prefix_Key + "hNewestAppVer:{0}_{1}", item.PackName, emptyMd5), dic));
                    //}
                    trans.QueueCommand(s => s.SetRangeInHash(string.Format(Prefix_Key + "hNewestAppVer:{0}_{1}", item.PackName, SecurityExtension.MD5(item.PackSign.Trim()).ToLower()), dic));
                }
                return(true);

                //trans.Commit();
            }
            return(false);
            //return this.Redis.SearchKeys("hNewestAppVer:*").Count > 0;
        }
        /// <summary>
        /// 订单提取
        /// </summary>
        /// <param name="number">取票号码:身份证或凭证码</param>
        /// <param name="CheckType">取票类型 1、凭证码。2、身份证。3、扫码</param>
        /// <returns></returns>
        public TVMResult <TVMTicketInfo[]> GetTicketOrder(string number, int CheckType)
        {
            TVMResult <TVMTicketInfo[]> result = new TVMResult <TVMTicketInfo[]>
            {
                ResultCode = 1,
                SysDate    = DateTime.Now,
                Message    = "失败"
            };
            var ticketInfos = new List <TVMTicketInfo>();
            List <Tbl_OrderDetail> orderDetails = new List <Tbl_OrderDetail>();

            if (CheckType == 2)
            {
                //身份证
                var list = _orderDetailService.GetOtaByIdCard(UserKey.ScenicId, number);
                if (list.Count <= 0)
                {
                    return(result);
                }
                orderDetails.AddRange(list);
            }
            else
            {
                //凭证码
                var orderDetail = _orderDetailService.GetOtaByCertificateNo(UserKey.ScenicId, number);
                if (orderDetail == null)
                {
                    return(result);
                }
                orderDetails.Add(orderDetail);
            }
            foreach (var orderDetail in orderDetails)
            {
                if (orderDetail.DelayCheckTime > DateTime.Now)
                {
                    //该票未到入园时间
                    continue;
                }
                string code = SecurityExtension.DesEncrypt(orderDetail.QRcode, AppSettingsConfig.QrCodeKey);
                ticketInfos.Add(new TVMTicketInfo
                {
                    OrderID       = orderDetail.OrderNo,                                                              //订单详情id
                    TicketName    = orderDetail.TicketName,                                                           //门票名称
                    GeneralPrice  = (double)(orderDetail.SettlementPrice.HasValue ? orderDetail.SettlementPrice : 0), //门票票面价格
                    DiscountPrice = (double)orderDetail.Price,                                                        //门票销售价格
                    StartDate     = orderDetail.ValidityDateStart,                                                    //开始日期
                    EndDate       = orderDetail.ValidityDateEnd,                                                      //结束日期
                    ChannelType   = "",                                                                               //
                    ENSBARCODE    = code,                                                                             //加密二维码
                    sbarcode      = orderDetail.CertificateNO,                                                        //凭证号
                    PeopleCount   = orderDetail.Quantity,                                                             //人数
                    Remarks       = orderDetail.OrderDetailId.ToString(),                                             //订单详情id
                    StartTime     = orderDetail.ValidityDateStart,
                    EndTime       = orderDetail.ValidityDateEnd,
                    SellPlan      = "",//
                });
            }
            if (ticketInfos.Count <= 0)
            {
                return(result);
            }
            result.Data       = ticketInfos.ToArray();
            result.ResultCode = 0;
            result.Message    = "成功";
            return(result);
        }
示例#23
0
 /// <summary>
 /// Sinh mã đơn hàng khi đặt tour
 /// </summary>
 /// <param name="iid">id tour</param>
 /// <param name="email">Email người đặt</param>
 /// <returns></returns>
 public static string SinhMaDonHang(string iid, string email)
 {
     return(SecurityExtension.BuildPassword(iid + "_" + email + "_" + DateTime.Now.Ticks));
 }
示例#24
0
文件: Login.cs 项目: ademaydogdu/msp
        private void Set_Form()
        {
            #region CreateFile
            string root = @"C:\Msp";
            if (!Directory.Exists(root))
            {
                Directory.CreateDirectory(root);
            }
            string MspBacUp = @"C:\Msp\BackUp";
            if (!Directory.Exists(MspBacUp))
            {
                Directory.CreateDirectory(MspBacUp);
            }
            string MspModuls = @"C:\Msp\Moduls";
            if (!Directory.Exists(MspModuls))
            {
                Directory.CreateDirectory(MspModuls);
            }
            string path = @"C:\Msp\ConnectString.txt";
            if (!File.Exists(path))
            {
                using (StreamWriter sw = File.CreateText(path))
                {
                    string sifrele = SecurityExtension.Sifrele("data source=DG;initial catalog=msp;user id=sa;password=123D654!;");
                    sw.WriteLine(sifrele);
                }
                AppMain.LocalConnect = false;
            }
            #endregion

            if (!AppMain.LocalConnect)
            {
                string[] conArry;
                using (StreamReader sr = File.OpenText(path))
                {
                    string str = SecurityExtension.Sifre_Coz(sr.ReadLine());
                    conArry = str.Split(';');
                }
                List <string> conn = new List <string>();
                foreach (var item in conArry)
                {
                    int position = item.IndexOf("=");
                    if (position < 0)
                    {
                        continue;
                    }
                    conn.Add(item.Substring(position + 1));
                }
                AppMain.SqlConnection = new ConnectionDTO
                {
                    Database = conn[1], //Global.SqlConnection.Database,
                    Server   = conn[0], //"R00T\\SQLEXPRESS", //Global.SqlConnection.Server,
                    Password = conn[3], //Global.SqlConnection.Password,
                    UserId   = conn[2]  //Global.SqlConnection.UserId
                };

                if (MspTool.sqlKontrol(AppMain.SqlConnection.Server, AppMain.SqlConnection.Database, AppMain.SqlConnection.UserId, AppMain.SqlConnection.Password) == false)
                {
                    XtraMessageBox.Show("Bağlantı hatası.Veritabanı ayarlarınızı kontrol ediniz...", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                string[] conArry;
                using (StreamReader sr = File.OpenText(path))
                {
                    string str = SecurityExtension.Sifre_Coz(sr.ReadLine());
                    conArry = str.Split(';');
                }
                List <string> conn = new List <string>();
                foreach (var item in conArry)
                {
                    int position = item.IndexOf("=");
                    if (position < 0)
                    {
                        continue;
                    }
                    conn.Add(item.Substring(position + 1));
                }
                AppMain.SqlConnection = new ConnectionDTO
                {
                    Database = conn[1],
                    Server   = conn[0]
                };
                if (MspTool.sqlKontrol(AppMain.SqlConnection.Server, AppMain.SqlConnection.Database) == false)
                {
                    XtraMessageBox.Show("Bağlantı hatası.Veritabanı ayarlarınızı kontrol ediniz...", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }


            LoadDatabase();
        }