private void simpleButton2_Click(object sender, EventArgs e) { string Date, Day, Month; if (DateTime.Now.Month < 10) { Month = "0" + DateTime.Now.Month; } else { Month = DateTime.Now.Month.ToString(); } if (DateTime.Now.Day < 10) { Day = "0" + DateTime.Now.Day; } else { Day = DateTime.Now.Day.ToString(); } Date = DateTime.Now.Year + "-" + Month + "-" + Day; var TrialLicence = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); var TrialLicencePath = TrialLicence + "\\Trial2.txt"; StreamWriter Sw = new StreamWriter(TrialLicencePath); Sw.Write(SecurityClass.Encrypt(Date, "PosSystemEncraptionKey")); Sw.Close(); XtraMessageBox.Show("تم اضافة مدة تجربية 20 يوم بمجرد الانتهاء سيتم ايقاف البرنامج "); Application.Exit(); }
public QueryResult TryGetResult(string batchCurrnum, string batchDate, out string returnPayValue) { QueryResult qr = null; string easypay_url = FormatUrl(new { _input_charset = _input_charset, batchBizid = batchBizid, batchCurrnum = batchCurrnum, batchDate = batchDate, batchVersion = batchVersion }); MyHttpUtility http = new MyHttpUtility(); returnPayValue = http.DoGet("http://entrust.reapal.com/agentpay/payquerybatch?" + easypay_url, false); if (returnPayValue.Substring(0, 6).ToUpper() == "<RESP>") { CheckException(returnPayValue); } else { //解密 SecurityClass security = new SecurityClass(Encoding.GetEncoding("GBK")); returnPayValue = security.RSADecrypt(PrivateKey, "clientok", returnPayValue); qr = Common.QueryResult.FromXml(returnPayValue); } return(qr); }
public SecurityClassEditDialog(SecurityClass securityClass) { InitializeComponent(); OriginalSecurityClass = securityClass; CurrentSecurityClass = CopySecurityClass(); this.DataContext = CurrentSecurityClass; }
private void UpdateRecord() { if (string.IsNullOrEmpty(txtUserName.Text)) { return; } var user = new Users { FullName = txtFullName.Text, UserName = SecurityClass.Encrypt(txtUserName.Text), Password = SecurityClass.Encrypt(txtPassword.Text), Tell = txtTell.Text, Mobile = txtMobile.Text, Address = txtAddress.Text, Comment = "", LogRecord = DateTime.Now, Status = 1, UserId = UtilityClass.UserId }; using (var dbContext = new UnitOfWork()) { user.Id = UserId; dbContext.UserRepository.Update(user); dbContext.Save(); DialogResult = DialogResult.OK; } }
private string FormatUrl(object o) { SecurityClass security = new SecurityClass(encoding); security.FromFile(PubliCertificate); string notEncryText = "", encryText = ""; System.Collections.Generic.Dictionary <string, string> dic = new Dictionary <string, string>(); foreach (System.Reflection.PropertyInfo p in o.GetType().GetProperties()) { dic.Add(p.Name, p.GetValue(o, null).ToString()); } dic.OrderBy(x => x.Key).ThenBy(x => x.Value); foreach (KeyValuePair <string, string> kv in dic) { notEncryText += "&" + kv.Key + "=" + kv.Value; string txt = kv.Value; if (kv.Key == "batchContent") { txt = System.Web.HttpUtility.UrlEncode(security.RSAEncrypt(txt)); } encryText += "&" + kv.Key + "=" + txt; } notEncryText = notEncryText.Substring(1); string sign = security.MD5(notEncryText.Trim('&') + key); encryText = string.Format("sign={0}&signType={1}", sign, signType) + encryText; return(encryText); }
private void SaveProfile() { Settings.Default.IsRemember = "true"; Settings.Default.UserName = SecurityClass.Encrypt(txtUsername.Text); Settings.Default.Password = SecurityClass.Encrypt(txtPassword.Text); Settings.Default.Save(); }
public void InitializeQuizList() { string QueryString = @"Select QuizName, QuizID FROM QuizList"; DataTable datatable = new DataTable(); datatable = QueryExecute(QueryString, QuizDBContext.QuizConnectionString()); if (datatable != null) { if (datatable.Rows.Count > 0) { foreach (DataRow dr in datatable.Rows) { HtmlGenericControl li = new HtmlGenericControl("li"); li.InnerText = dr["QuizName"].ToString(); li.Attributes["class"] = "list-group-item"; HtmlButton editButton = new HtmlButton(); editButton.InnerText = "Edit"; editButton.Attributes["class"] = "btn btn-primary"; editButton.Attributes["value"] = SecurityClass.EncryptString(dr["QuizName"].ToString(), "TableNamePhrase"); editButton.Attributes["quizid"] = SecurityClass.EncryptString(dr["QuizID"].ToString(), "QuizID"); editButton.Attributes["action"] = SecurityClass.EncryptString("Edit", "ActionPhrase"); editButton.Attributes["runat"] = "server"; editButton.ServerClick += EditQuiz; editButton.Attributes["id"] = "editButton"; HtmlButton DeleteButton = new HtmlButton(); DeleteButton.InnerText = "Delete"; DeleteButton.Attributes["class"] = "btn btn-danger"; DeleteButton.Attributes["value"] = SecurityClass.EncryptString(dr["QuizName"].ToString(), "TableNamePhrase"); DeleteButton.Attributes["action"] = SecurityClass.EncryptString("Delete", "ActionPhrase"); DeleteButton.Attributes["quizid"] = SecurityClass.EncryptString(dr["QuizID"].ToString(), "QuizID"); DeleteButton.Attributes["runat"] = "server"; DeleteButton.ServerClick += DeleteQuiz; DeleteButton.Attributes["id"] = "deleteButton"; HtmlButton SendToButton = new HtmlButton(); SendToButton.InnerText = "Send To Email"; SendToButton.Attributes["class"] = "btn btn-success"; SendToButton.Attributes["value"] = SecurityClass.EncryptString(dr["QuizName"].ToString(), "TableNamePhrase"); SendToButton.Attributes["action"] = SecurityClass.EncryptString("Delete", "ActionPhrase"); SendToButton.Attributes["quizid"] = SecurityClass.EncryptString(dr["QuizID"].ToString(), "QuizID"); SendToButton.Attributes["runat"] = "server"; SendToButton.ServerClick += SendToEmail; SendToButton.Attributes["id"] = "sendToEmailButton"; QuizListDiv.Controls.Add(li); li.Controls.Add(editButton); li.Controls.Add(DeleteButton); li.Controls.Add(SendToButton); } } } }
private SecurityClass CopySecurityClass() { SecurityClass securityclass = new SecurityClass(); securityclass.Guid = OriginalSecurityClass.Guid; securityclass.Name = OriginalSecurityClass.Name; securityclass.Comments = OriginalSecurityClass.Comments; return(securityclass); }
private void SendToEmail(object sender, EventArgs e) { HtmlButton button = (HtmlButton)sender; string QuizID = Server.UrlEncode(MD5EncryptionHelper.Encrypt(SecurityClass.DecryptString(button.Attributes["quizid"], "QuizID"))); string QuizTableName = Server.UrlEncode(MD5EncryptionHelper.Encrypt(SecurityClass.DecryptString(button.Attributes["value"], "TableNamePhrase"))); string UserID = Server.UrlEncode(MD5EncryptionHelper.Encrypt(Session["UserID"].ToString())); string ResponseString = string.Format("TakeQuiz.aspx?QuizID={0}&QuizTableName={1}&UserID={2}", QuizID, QuizTableName, UserID); Response.Redirect(ResponseString); }
internal void InitializeClasses() { this.Healer = new HealerClass(); this.ExperienceCounter = new ExperienceCounterClass(); this.Hotkeys = new HotkeysClass(); this.Magebomb = new MagebombClass(); this.PvP = new PvPClass(); this.Scripter = new ScripterClass(); this.Security = new SecurityClass(); }
protected void CreateNewQuiz(object sender, EventArgs e) { if (QuizNameTextBox.Text != "") { Session["TableName"] = SecurityClass.EncryptString(QuizNameTextBox.Text, "TableNamePhrase"); Session["Action"] = SecurityClass.EncryptString("Create", "ActionPhrase"); Response.Redirect("QuizSetup.aspx"); } }
public static string Decrypt(string textToEncrypt) { string temp; #if UNITY_WINRT && !UNITY_EDITOR temp = LegacySystem.IO.Decrypt(textToEncrypt) #else temp = SecurityClass.Decrypt(textToEncrypt); #endif return(temp); }
private void CashRecord() { using (var dbContext = new UnitOfWork()) { var user = dbContext.UserRepository.GetById(UserId); txtUserName.Text = SecurityClass.Decrypt(user.UserName); txtFullName.Text = user.FullName; txtTell.Text = user.Tell; txtMobile.Text = user.Mobile; txtAddress.Text = user.Address; } }
/// <summary> /// 新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void securityAdd_Click(object sender, RoutedEventArgs e) { SecurityClass newsecurityClass = new SecurityClass(); newsecurityClass.Guid = System.Guid.NewGuid().ToString(); SecurityClassEditDialog dialog = new SecurityClassEditDialog(newsecurityClass); dialog.AllowEdite = true; dialog.WindowTitle = "新增保障类别"; dialog.RefreshSecurityClassEvent += () => { GetSecurityClass(); }; dialog.ShowDialog(this); }
private void ShpbalBtn_Click(object sender, EventArgs e) { ISecurity m_Security; m_Security = new SecurityClass(); Infolist.Items.Clear(); InfoLbl.Text = ""; Securitylist.Items.Clear(); double dShpBal; dShpBal = m_Security.UpdateShopBalance; Infolist.Items.Add(dShpBal); }
public static ActivityOrganization LoadActivityORGFromTable(DataTable dt, string activityguid) { ActivityOrganization org = null; if (dt.Rows != null && dt.Rows.Count > 0) { org = new ActivityOrganization(); org.ActivityGuid = activityguid; org.Guid = System.Guid.NewGuid().ToString(); if (dt.Columns[1] != null) { org.Name = dt.Columns[1].ColumnName; } org.ShortName = dt.Rows[0][1].ToString(); org.Address = dt.Rows[2][1].ToString(); org.Contact = dt.Rows[3][1].ToString(); org.Phone = dt.Rows[4][1].ToString(); string secclass = dt.Rows[1][1].ToString(); SecurityClass[] securityclasses = CO_IA.Client.Utility.GetSecurityClasses(); if (secclass != null && securityclasses.Length > 0) { SecurityClass securityclass = securityclasses.FirstOrDefault(r => r.Name == secclass); if (securityclass == null) { MessageBoxResult msgres = MessageBox.Show(string.Format("系统的保障类别中,不存在名称为‘{0}’的保障类别,是否将保障类别改为默认保障类别'{1}'", secclass, securityclasses[0].Name), "提示", MessageBoxButton.YesNo); if (msgres == MessageBoxResult.Yes) { org.SecurityClass = securityclasses[0]; } else { MessageBox.Show("请修改保障类别"); return(null); } } else { org.SecurityClass = securityclass; } } else { MessageBox.Show("系统中不存在保障类别"); } } return(org); }
private void btnOk_Click(object sender, EventArgs e) { using (var dbContext = new UnitOfWork()) { var userName = SecurityClass.Encrypt(txtUsername.Text); var password = SecurityClass.Encrypt(txtPassword.Text); var result = dbContext.UserRepository.Get(user => user.UserName == userName && user.Password == password); var users = result.ToList(); if (!users.Any()) { UtilityClass.ShowMessage(this, Settings.Default.Language == "fa-IR" ? @"کاربری با این مشخصاب یافت نگردید" : @"بەکارهێنەر به زانیاریانی ندوزراوه"); return; } foreach (var user in users) { var permission = new List <string>(); if (chkRemember.Checked) { SaveProfile(); } else { RemoveProfile(); } var query = @"SELECT * FROM UserAccesses UA JOIN SystemParts SP ON UA.SystemPartsId=SP.Id WHERE UA.UsersId=" + user.Id; var dtPermission = UtilityClass.GetData(query); foreach (DataRow item in dtPermission.Rows) { permission.Add(item["Name"].ToString()); } UtilityClass.CurrentUserPermissions = permission; UtilityClass.UserId = user.Id; UtilityClass.FullName = user.FullName; DialogResult = DialogResult.OK; } } }
//生成員工============================================================================================= void CreateEmployee() { //生成經理(ID 姓名 能力 薪水 僱用費用 自我介紹 僱用狀態 出勤狀態 工作地點) Manage [0] = new ManageClass(0, "沃特‧巴特", 1, 460000, 0, "雇用人之前,你需要確認三項素質:誠實,聰明,活力。但是最重要的是誠實。", true, true, 0); Manage [1] = new ManageClass(1, "彼得·薩奇", 2, 789000, 1654700, "當市場下跌時,你輕易的將好東西打折變賣,但是一旦市場向上,再想買回來,難之又難。", true, false, 1); Manage [2] = new ManageClass(2, "寶迪·鄧普頓", 2, 1180000, 2141000, "我可以靠著學生時期賣愛心筆的經驗,適時的給予幫助。", false, false, 1); Manage [3] = new ManageClass(3, "班傑明·格嵐費姆", 2, 1680000, 4300000, "我不認識一個叫富蘭克林的人,但我認識隔壁賣奶茶的妹子。", false, false, 1); Manage [4] = new ManageClass(4, "喬治·威盛頓", 3, 3468000, 6570000, "成功在優點的發揮,失敗是缺點的累積,我覺得是廢話。", false, false, 1); Manage [5] = new ManageClass(5, "約翰‧醒夫", 3, 5689000, 9672000, "沒有口水與汗水,就只能去喝早餐店的紅茶。", false, false, 1); Manage [6] = new ManageClass(6, "狂古·博格爾", 4, 9897000, 13400000, "做好手中事,珍惜眼前人。", false, false, 1); Manage [7] = new ManageClass(7, "麥爾遜‧威斯", 4, 14200000, 35550000, "我只能說:問君能有幾多愁,睏了累了喝蠻牛。", false, false, 1); Manage [8] = new ManageClass(8, "朱利亞‧迪伯遜", 4, 32640000, 50000000, "老闆我喜歡交朋友,尤其是女朋友。", false, false, 1); Manage [9] = new ManageClass(9, "馬克·墨比普斯", 5, 56970000, 84000000, "少說多做,句句都會得到別人的重視;多說少做,句句都會受到別人的忽視。", false, false, 1); //生成警衛(ID 姓名 能力 薪水 僱用費用 自我介紹 僱用狀態 出勤狀態 工作地點) Security[0] = new SecurityClass(0, "傑克·邱爾", 1, 236000, 0, "爭吵的時候,男人和女人的區別就像步槍和機關槍的區別。", true, true, 0); Security[1] = new SecurityClass(1, "馬汀‧尼格", 1, 452100, 84900, "寒冷到了極致時,太陽就要光臨。", true, false, 1); Security[2] = new SecurityClass(2, "黃浦興", 2, 553210, 98000, "不怕虎一樣的敵人,就怕豬一樣的隊友。", false, false, 1); Security[3] = new SecurityClass(3, "李自白", 2, 804320, 134520, "成功是一種觀念,致富是一種義務,快樂是一種權力。", false, false, 1); Security[4] = new SecurityClass(4, "趙永昌", 3, 1300000, 179500, "老闆,錢對你來說真的就那麼重要嗎?講了三個多小時了一分錢都不降?", false, false, 1); Security[5] = new SecurityClass(5, "關漢壽", 3, 1850000, 253000, "強者向人們揭示的是確認人生的價值,弱者向人們揭示的卻是對人生的懷疑。", false, false, 1); Security[6] = new SecurityClass(6, "克雷·哈森", 3, 3240000, 324000, "我要是做了人事部經理,第一件事就是提拔自己做老總。", false, false, 1); Security[7] = new SecurityClass(7, "羅·福爾", 4, 4685000, 495100, "超乎一切之上的一件事,就是保持青春朝氣。", false, false, 1); Security[8] = new SecurityClass(8, "馬克·科爾", 4, 5239600, 541000, "廢話是人際關係的第一句。", false, false, 1); Security[9] = new SecurityClass(9, "羅剎", 5, 8745000, 785100, "每一個成功者都有一個開始。勇於開始,才能找到成功。", false, false, 1); //生成顧問(ID 姓名 能力 薪水 僱用費用 自我介紹 僱用狀態 出勤狀態 工作地點 烹飪 音樂 科技 機工 金融) Consultant[0] = new ConsultantClass(0, "貝果", 1, 230000, 0, "逆風的方向更適合飛翔,我不怕千萬人阻擋只怕自己投降。", true, false, 3, 1, 1, 0, 1); Consultant[1] = new ConsultantClass(1, "米其輪", 1, 280000, 0, "世界上那些最容易的事情中,拖延時間最不費力。", true, false, 2, 2, 2, 0, 1); Consultant[2] = new ConsultantClass(2, "弗朗索瓦", 1, 370000, 0, "每天晚上疲憊地坐到椅子上時,才覺得真真切切地過了一天。", true, false, 1, 3, 1, 0, 1); Consultant[3] = new ConsultantClass(3, "幔酘", 1, 450000, 1555555, "成功不是將來才有的,而是從決定去做的那一刻起,持續累積而成。", false, false, 3, 1, 1, 0, 0); Consultant[4] = new ConsultantClass(4, "布里茲", 2, 680000, 1974100, "用腦思考,用心琢磨,用行動證實。", false, false, 3, 2, 1, 0, 1); Consultant[5] = new ConsultantClass(5, "阿瑪迪斯", 2, 860000, 2841000, "工作的最高境界就是看著別人上班,領著別人的工資。", false, false, 1, 3, 1, 1, 1); Consultant[6] = new ConsultantClass(6, "塞巴斯蒂安", 2, 930000, 3333333, "前程四緊就是:手頭緊、眉頭緊、衣服緊、時間緊。", false, false, 2, 3, 3, 1, 1); Consultant[7] = new ConsultantClass(7, "費曲·博德", 2, 1700000, 3485200, "既然上了賊船,就要做個成功的海盜。", false, false, 3, 2, 0, 0, 0); Consultant[8] = new ConsultantClass(8, "路德維希", 3, 1954000, 4320000, "學習要加,驕傲要減,機會要乘,懶惰要除。", false, false, 1, 3, 2, 2, 1); Consultant[9] = new ConsultantClass(9, "威廉·G", 3, 2350000, 5100000, "唯女人與英語難過也,唯老婆與工作難找也。", false, false, 2, 2, 3, 2, 0); Consultant[10] = new ConsultantClass(10, "史蒂芬·J", 3, 3360000, 5505500, "人生自古誰無死,哪個拉屎不用紙!", false, false, 1, 1, 3, 1, 1); Consultant[11] = new ConsultantClass(11, "托瓦茲", 3, 4890000, 6484100, "積極思考造成積極人生,消極思考造成消極人生。", false, false, 2, 1, 3, 0, 0); Consultant[12] = new ConsultantClass(12, "恰配克", 3, 6300000, 8940100, "微笑是我們心靈的最真誠傾訴,是在困難面前最好的良藥。", false, false, 0, 0, 1, 3, 1); Consultant[13] = new ConsultantClass(13, "瓦特", 3, 7056000, 14523000, "在非洲,每隔一分鐘,就有六十秒過去。", false, false, 2, 2, 2, 3, 1); Consultant[14] = new ConsultantClass(14, "紐克曼", 4, 8641000, 26348100, "跟你通電話的那晚,聽見了你的聲音。", false, false, 1, 2, 1, 3, 2); Consultant[15] = new ConsultantClass(15, "達文西", 4, 8800000, 45200000, "跟你在一起時,回憶一天前的事情,就如回想昨天的事情。", false, false, 3, 0, 2, 3, 1); Consultant[16] = new ConsultantClass(16, "湯普遜", 4, 9800000, 57841000, "比別人多一點志氣,你就會多一份出息。", false, false, 1, 2, 3, 0, 3); Consultant[17] = new ConsultantClass(17, "摩根", 5, 13200000, 63890000, "比別人多一點執著,你就會創造奇蹟。", false, false, 2, 1, 3, 3, 3); Consultant[18] = new ConsultantClass(18, "園潔三菱", 5, 35100000, 78400000, "月亮好美麗啊…到了這個時候,我還在工作喔!", false, false, 1, 1, 3, 3, 3); Consultant[19] = new ConsultantClass(19, "易中滿", 5, 68740000, 99999999, "你付的出錢請我嗎?", false, false, 3, 3, 3, 3, 3); } //生成員工=============================================================================================
private void UsrRytBtn_Click(object sender, EventArgs e) { ISecurity m_Security; m_Security = new SecurityClass(); InfoLbl.Text = ""; Infolist.Items.Clear(); Securitylist.Items.Clear(); string strXML; string strModule; string strLeaf; long lUserRyt; strXML = XMTTxt.Text; strModule = ModuleTxt.Text; strLeaf = LeafsecurityTxt.Text; if ((strXML == "") && (strModule == "") && (strLeaf == "")) { MessageBox.Show("Please the XML Module name,module section and leaf security node name"); } else if (strXML == "") { MessageBox.Show("Please enter the XML module name"); } else if (strModule == "") { MessageBox.Show("Please enter the module section"); } else if (strLeaf == "") { MessageBox.Show("Please enter the leaf security node name"); } else { lUserRyt = m_Security.get_UserRightInfo(strXML, strModule, strLeaf); if (lUserRyt == 1) { InfoLbl.Text = "Have User Right Info"; } else if (lUserRyt == 0) { InfoLbl.Text = "Don't have user right Info"; } } }
public void UpdateAddinCmdUI(int lCommandID, ref int pbEnable) { //TODO: Add CAddinDotNet.UpdateAddinCmdUI implementation try { pbEnable = 1; string strFunctionName = string.Empty; for (int lIndex = 0; lIndex < m_MenuInfoArray.Count; lIndex++) { for (int lCommandIndex = 0; lCommandIndex < m_MenuInfoArray[lIndex].m_CommandIDArray.Count; lCommandIndex++) { if (lCommandID == m_MenuInfoArray[lIndex].m_CommandIDArray[lCommandIndex]) { strFunctionName = m_MenuInfoArray[lIndex].m_strFunctionName; break; } } } ISecurity mSMPSecurity = new SecurityClass(); int lValue = -1; if (("UsingISettingsInterface") == strFunctionName) { string strCSharpModuleName = "CSharp SecurityTest Module"; string strCSharpModuleSection = "Security Test Setup"; string strLeafNodeName = "Show Settings"; try { lValue = mSMPSecurity.get_UserRightInfo(strCSharpModuleName, strCSharpModuleSection, strLeafNodeName); } catch (Exception) { } pbEnable = lValue; } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } }
private void LoginPage_Load(object sender, EventArgs e) { var isRemember = Settings.Default.IsRemember; if (isRemember != "true") { chkRemember.Checked = false; } else { var userName = SecurityClass.Decrypt(Settings.Default.UserName); var password = Settings.Default.Password; txtUsername.Text = userName; txtPassword.Text = SecurityClass.Decrypt(password); chkRemember.Checked = true; } }
protected void InitializeQuizSetup() { var parameterTableName = Session["TableName"]; var parameterAction = Session["Action"]; var parameterQuizID = Session["QuizID"]; if (parameterAction != null && parameterTableName != null) { string decoded_parameterTableName = SecurityClass.DecryptString(parameterTableName.ToString(), "TableNamePhrase"); string decoded_action = SecurityClass.DecryptString(parameterAction.ToString(), "ActionPhrase"); tableName = decoded_parameterTableName; action = decoded_action; if (decoded_action == "Create") { ChooseAction(decoded_action, decoded_parameterTableName); } else if ((decoded_action == "Edit" || decoded_action == "Delete") && parameterQuizID != null) { quizid = SecurityClass.DecryptString(parameterQuizID.ToString(), "QuizID"); ChooseAction(decoded_action, decoded_parameterTableName); } else { testLabel.Text = "Error, Select a table"; tableName = ""; action = ""; Response.Redirect("Dashboard.aspx"); } } else { testLabel.Text = "Error, Select a table"; tableName = ""; action = ""; Response.Redirect("Dashboard.aspx"); //Set Error Message and redirect to the dashboard.aspx page. } }
private void Crntusrbtn_Click(object sender, EventArgs e) { ISecurity m_Security; m_Security = new SecurityClass(); Infolist.Items.Clear(); InfoLbl.Text = ""; Securitylist.Items.Clear(); string strCrntUsrRights; strCrntUsrRights = m_Security.CurrentUserRights; if (strCrntUsrRights == "") { Infolist.Items.Add("No current user rights"); } else { Infolist.Items.Add(strCrntUsrRights); } }
private void Accesscstmrbtn_Click(object sender, EventArgs e) { ISecurity m_Security; m_Security = new SecurityClass(); Infolist.Items.Clear(); InfoLbl.Text = ""; Securitylist.Items.Clear(); long lAcesscstmer; lAcesscstmer = m_Security.AccessCustomerMenu; if (lAcesscstmer == 1) { Infolist.Items.Add("Have rights to access customer menu"); } else if (lAcesscstmer == 0) { Infolist.Items.Add("Access to customer menu is denied"); } }
private void AccessSetupbtn_Click(object sender, EventArgs e) { ISecurity m_Security; m_Security = new SecurityClass(); Infolist.Items.Clear(); InfoLbl.Text = ""; Securitylist.Items.Clear(); long lAcessSetup; lAcessSetup = m_Security.AccessSetup; if (lAcessSetup == 1) { Infolist.Items.Add("Have rights to access setup"); } else if (lAcessSetup == 0) { Infolist.Items.Add("Access to setup is denied"); } }
private void Accesstransctnbtn_Click(object sender, EventArgs e) { ISecurity m_Security; m_Security = new SecurityClass(); Infolist.Items.Clear(); InfoLbl.Text = ""; Securitylist.Items.Clear(); long lAcessTransaction; lAcessTransaction = m_Security.AccessTransactionMenu; if (lAcessTransaction == 1) { Infolist.Items.Add("Have rights to access transaction menu"); } else if (lAcessTransaction == 0) { Infolist.Items.Add("Access to transaction menu is denied"); } }
private void Acesssalesbtn_Click(object sender, EventArgs e) { ISecurity m_Security; m_Security = new SecurityClass(); Infolist.Items.Clear(); InfoLbl.Text = ""; Securitylist.Items.Clear(); long lAcessSals; lAcessSals = m_Security.AccessSalesMenu; if (lAcessSals == 1) { Infolist.Items.Add("Have rights to access sales menu"); } else if (lAcessSals == 0) { Infolist.Items.Add("Access to sales menu is denied"); } }
private void DatabaseRytbtn_Click(object sender, EventArgs e) { ISecurity m_Security; m_Security = new SecurityClass(); Infolist.Items.Clear(); InfoLbl.Text = ""; Securitylist.Items.Clear(); long lDatabseRite; lDatabseRite = m_Security.DatabaseRight; if (lDatabseRite == 1) { Infolist.Items.Add("Have database right"); } else if (lDatabseRite == 0) { Infolist.Items.Add("Database right is denied"); } }
private void VwRptBtn_Click(object sender, EventArgs e) { ISecurity m_Security; m_Security = new SecurityClass(); Infolist.Items.Clear(); InfoLbl.Text = ""; Securitylist.Items.Clear(); long lviewRpts; lviewRpts = m_Security.ViewReports; if (lviewRpts == 1) { Infolist.Items.Add("Have rights to view reports"); } else if (lviewRpts == 0) { Infolist.Items.Add("No rights view reports"); } }
private void PrntRptsbtn_Click(object sender, EventArgs e) { ISecurity m_Security; m_Security = new SecurityClass(); Infolist.Items.Clear(); InfoLbl.Text = ""; Securitylist.Items.Clear(); long lPrntrpts; lPrntrpts = m_Security.PrintReports; if (lPrntrpts == 1) { Infolist.Items.Add("Have print rights"); } else if (lPrntrpts == 0) { Infolist.Items.Add("Doesn't have print rights"); } }
public static DirectorySecurity CreateDirSecurity(SecurityClass securityClass) { DirectorySecurity security = new DirectorySecurity(); WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent(); if (windowsIdentity != null) { SecurityIdentifier identity = windowsIdentity.User; if (identity != null) { security.SetOwner(identity); FileSystemAccessRule accessRule = new FileSystemAccessRule(identity, FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow); security.SetAccessRule(accessRule); } } if (securityClass == SecurityClass.Everybody) { SecurityIdentifier everybodyIdentity = new SecurityIdentifier(WellKnownSidType.WorldSid, null); FileSystemAccessRule accessRule = new FileSystemAccessRule(everybodyIdentity, FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow); security.AddAccessRule(accessRule); } return security; }
private string FormatUrl(object o) { SecurityClass security = new SecurityClass(encoding); security.FromFile(PubliCertificate ); string notEncryText="",encryText=""; System.Collections.Generic.Dictionary<string, string> dic = new Dictionary<string, string>(); foreach (System.Reflection.PropertyInfo p in o.GetType().GetProperties()) { dic.Add(p.Name, p.GetValue(o, null).ToString()); } dic.OrderBy(x => x.Key).ThenBy(x => x.Value); foreach (KeyValuePair<string, string> kv in dic) { notEncryText += "&" + kv.Key + "=" + kv.Value; string txt = kv.Value; if (kv.Key == "batchContent") txt = System.Web.HttpUtility.UrlEncode(security.RSAEncrypt(txt)); encryText += "&" + kv.Key + "=" + txt; } notEncryText = notEncryText.Substring(1); string sign = security.MD5(notEncryText.Trim('&')+key); encryText = string.Format("sign={0}&signType={1}", sign, signType) + encryText; return encryText; }
public QueryResult TryGetResult(string batchCurrnum, string batchDate, out string returnPayValue) { QueryResult qr = null; string easypay_url = FormatUrl(new { _input_charset = _input_charset, batchBizid = batchBizid, batchCurrnum = batchCurrnum, batchDate = batchDate, batchVersion = batchVersion }); MyHttpUtility http = new MyHttpUtility(); returnPayValue = http.DoGet("http://entrust.reapal.com/agentpay/payquerybatch?" + easypay_url,false); if (returnPayValue.Substring(0, 6).ToUpper() == "<RESP>") { CheckException(returnPayValue); } else { //解密 SecurityClass security = new SecurityClass(Encoding.GetEncoding("GBK")); returnPayValue = security.RSADecrypt(PrivateKey, "clientok", returnPayValue); qr= Common.QueryResult.FromXml(returnPayValue); } return qr; }