本文整理匯總了C#中Admin類的典型用法代碼示例。如果您正苦於以下問題:C# Admin類的具體用法?C# Admin怎麽用?C# Admin使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Admin類屬於命名空間,在下文中一共展示了Admin類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SaveAdmin
public bool SaveAdmin(ref Admin admin,
ref string message)
{
var result = true;
if (!AdminCheck(ref admin, ref message))
{
result = false;
}
else
{
try
{
var adminBDO = new AdminBDO();
TranslateAdminDTOToAdminBDO(admin,
adminBDO);
result = adminLogic.InsertAdmin(
ref adminBDO, ref message);
}
catch (Exception e)
{
var msg = e.Message;
throw new FaultException<AdminFault>
(new AdminFault(msg), msg);
}
}
return result;
}
示例2: button2_Click
private void button2_Click(object sender, EventArgs e)
{
string id = textBox1.Text.Trim();
string password = textBox2.Text.Trim();
string againPw = textBox3.Text.Trim();
if (id != "" && password != "" && againPw != "")
{
if (SqlAdmin.exitById(id))
{
MessageBox.Show("該用戶名已經存在。");
return;
}
else if (password != againPw)
{
MessageBox.Show("請確保兩段密碼相同.");
}
else
{
Admin admin = new Admin(id,password);
SqlAdmin.addAdmin(admin);
MessageBox.Show("注冊成功.");
Login loginView = new Login();
loginView.Show();
this.Dispose();
}
}
else
{
MessageBox.Show("該輸入所有數據.");
}
}
示例3: btConfirm_Click
/// <summary>
/// 處理確定按鈕點擊事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btConfirm_Click(object sender, EventArgs e)
{
Admin admin = new Admin();
MD5CryptoServiceProvider HashMD5 = new MD5CryptoServiceProvider();
string oldPwd =
ASCIIEncoding.ASCII.GetString(HashMD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(tbOldPwd.Text)));
string newPwd1 =
ASCIIEncoding.ASCII.GetString(HashMD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(tbNewPwd1.Text)));
string newPwd2 =
ASCIIEncoding.ASCII.GetString(HashMD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(tdNewPwd2.Text)));
if (admin.ChangePassword(Session["UserName"].ToString(), oldPwd, newPwd1, newPwd2))
{
//胡媛媛修改,修改跳轉語句的位置,2010-01-15
Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
"<script>alert('修改成功!');window.location='./index.aspx'</script>");
//Response.Redirect("./index.aspx");
//胡媛媛修改,修改跳轉語句的位置,2010-01-15
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
"<script>alert('對不起,您修改密碼失敗,原因可能是您輸入的原密碼不正確或是兩次輸入的新密碼不一致!')</script>");
}
}
示例4: GetAdmin
public Admin GetAdmin(int id)
{
AdminBDO adminBDO = null;
try
{
adminBDO = adminLogic.GetAdmin(id);
}
catch (Exception e)
{
var msg = e.Message;
var reason = "GetAdmin exception";
throw new FaultException<AdminFault>
(new AdminFault(msg), reason);
}
if (adminBDO == null)
{
var msg =
string.Format("No admin found for id {0}",
id);
var reason = "GetAdmin empty";
throw new FaultException<AdminFault>
(new AdminFault(msg), reason);
}
var admin = new Admin();
TranslateAdminBDOToAdminDTO(adminBDO,
admin);
return admin;
}
示例5: Main
static void Main(string[] args)
{
//Base class
UserController userController = new UserController();
userController.Login("John.Smith", "secret");
//userController.SetPermissions("John.Smith");
//inherits from userController so gets its methods
AdminController adminController = new AdminController();
adminController.Login("Jane.Doe", "pass123");
adminController.SetPermissions("Jane.Doe");
//inherits from adminController so get its methods and all the methods inherited from userController
AdminController superAdminController = new SuperAdminController();
superAdminController.Login("Joe.Bloggs", "password");
superAdminController.SetPermissions("Joe.Bloggs");
Admin admin = new Admin();
admin.name = "Jane.Doe";
admin.role = "admin";
Seller seller = new Seller();
seller.name = "John.Smith";
seller.role = "Seller";
//AbstractUser user = new AbstractUser(); // Oooops, no can do!
//IDatabaseConnection connection1 = new IDatabaseConnection(); // Not possible!
IDatabaseConnection connection2 = new MicrosoftDbConnection();
Console.ReadLine();
}
示例6: DoRequest
public string DoRequest(Admin.Model.DesList dmodel)
{
try
{
HttpWebRequest request = null;
//ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
string url = "http://interface.angeletsoft.cn/interface_ent.php";
request = WebRequest.Create(url) as HttpWebRequest;
//request.ProtocolVersion = HttpVersion.Version10;
request.ContentType = "application/json";
request.Method = "POST";
request.UserAgent = DefaultUserAgent;
//string form = "{\"FunctionCode\":\"GET_STATUS_BYID\",\"ID\":\"1\"}";
string form = "{\"FunctionCode\":\"EXEUTE_ORDER\",\"Body\":{\"Sender\":\"" + dmodel.Sender + "\",\"Receiver\":\"" + dmodel.Receiver + "\",\"CmdOrder\":\"DEL\",\"OrderCotent\":\"D\",\"STATUS\":\"0\",\"IsValid\":\"1\"}}";
byte[] data = Encoding.UTF8.GetBytes(form);
request.ContentLength = data.Length;
using (Stream stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
stream.Close();
}
HttpWebResponse wr = request.GetResponse() as HttpWebResponse;
string cs = wr.CharacterSet;
StreamReader reader = new StreamReader(wr.GetResponseStream(), Encoding.GetEncoding(cs));
return reader.ReadToEnd();
}
catch (Exception)
{
return "";
}
}
示例7: AssignNewJob
public AssignNewJob(Admin obj)
{
InitializeComponent();
assignnewjobbyadminidtext.Text = obj.adminId;
assignnewjobbyadminidtext.ReadOnly = true;
}
示例8: AssociateController
public AssociateController(
IMembershipService membershipService,
IMembershipService associateMembershipService,
IAssociateService associateService,
IDocumentService documentService,
IReferenceService referenceService,
IEmployeeService employeeService,
IProspectService prospectService,
IPrincipal user,
IClientProjectSharedService clientProjectSharedService,
IIndividualService individualService,
IRoleService roleService,
Admin.Services.IEmailService emailService)
: base(membershipService, associateService, user)
{
this.associateService = associateService;
this.documentService = documentService;
this.referenceService = referenceService;
this.employeeService = employeeService;
this.prospectService = prospectService;
this.associateMembershipService = associateMembershipService;
this.clientProjectSharedService = clientProjectSharedService;
this.individualService = individualService;
this.roleService = roleService;
this.emailService = emailService;
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
IEntityAccessor accessor = EntityAccessorFactory.Create(EntityAccessorTypes.WebForm);
Admin admin = Admin.FindAll()[0];
accessor
.SetConfig(EntityAccessorOptions.AllFields, true)
.SetConfig(EntityAccessorOptions.ItemPrefix, "field")
.SetConfig(EntityAccessorOptions.Container, this)
.Write(admin, null);
Admin admin2 = new Admin();
accessor.Read(admin2, null);
Debug.Assert(admin.ID == admin2.ID);
Debug.Assert(admin.Name == admin2.Name);
Debug.Assert(admin2.DisplayName == null); // Label隻能寫不能讀
Debug.Assert(admin2.FriendName == admin2.FriendName);
Debug.Assert(admin.Logins == admin2.Logins);
Debug.Assert(admin.IsEnable == admin2.IsEnable);
Debug.Assert(Math.Abs((admin.LastLogin - admin2.LastLogin).Ticks) < TimeSpan.FromSeconds(1).Ticks);
Debug.Assert(admin.RoleID == admin2.RoleID);
Debug.Assert(admin.RoleName == admin2.RoleName);
Debug.Assert(admin.SSOUserID == admin2.SSOUserID);
}
}
示例10: btnAlta_Click
protected void btnAlta_Click(object sender, EventArgs e)
{
bool est = false;
if (chkPuede.Checked == true)
{
est = true;
}
try
{
cargarWCF();
unAdmin = new Admin();
unAdmin.CI = Convert.ToInt32(txtCi.Text.Trim());
unAdmin.NOM_COMPLETO = txtNombre.Text.Trim();
unAdmin.USUARIO = txtUsuario.Text.Trim();
unAdmin.PASS = txtPass.Text.Trim();
unAdmin.ESTADISTICAS = est;
trivias.AltaUsuario((Usuarios)unAdmin);
Response.Write("<div id=\"exito\" class=\"alert alert-success\">EXITO AL REGISTRAR ADMINISTRADOR</div>"
+ "<script type=\"text/javascript\">window.onload=function(){alertBootstrap();};</script>");
trivias.Close();
Limpiar();
}
catch (Exception ex)
{
Response.Write("<div id=\"error\" class=\"alert alert-danger\">" + ex.Message + "</div>" +
"<script type=\"text/javascript\">window.onload=function(){alertBootstrap();};</script>");
}
}
示例11: GetAll_DataByEmail
public static Admin GetAll_DataByEmail(string email)
{
Connection con = new Connection();
string strConnString = con.GetConnString();
using(SqlConnection SqlCon = new SqlConnection(strConnString))
{
SqlCommand SqlComm = new SqlCommand("", SqlCon);
SqlCon.Open();
string query = string.Format("SELECT id, name, email, password FROM admin WHERE email='"+ email +"'");
SqlComm.CommandText = query;
SqlDataReader reader = SqlComm.ExecuteReader();
Admin adminDataByEmail = null;
while(reader.Read())
{
int Id = reader.GetInt32(0);
string Name = reader.GetString(1);
string Email = reader.GetString(2);
string Pass = reader.GetString(3);
adminDataByEmail = new Admin(Id, Name, Email, Pass);
}
return adminDataByEmail;
}
}
示例12: CreateAdmin
public ActionResult CreateAdmin(Admin admin)
{
if (!Application.IsAuthenticated && Application.AdminType != 1) {
ViewBag.Header = "Authorization Level Too Low";
ViewBag.Message = "Your authorization is not valid for this type of operation";
return View("Message", "_LayoutGuest");
}
if (!admin.Email.IsEmail()) {
ViewBag.Header = "Inputs were incorrect";
ViewBag.Message = "Please go back to the form and input the correct data";
return View("Message", "_LayoutAdmin");
}
//Airah's Code
using (KnowledgeChannelEntities context = new KnowledgeChannelEntities()) {
if (ModelState.IsValid) {
admin.Password = Encrypt.ComputeHash(admin.Password, "SHA512", null);
admin.DateCreated = DateTime.Now;
context.AddToAdmins(admin);
context.SaveChanges();
return RedirectToAction("ViewAdmins");
}
}
return View();
}
示例13: EvaluatePerformance
public EvaluatePerformance(Admin obj)
{
InitializeComponent();
evaluatebyadmintext.Text = obj.adminId;
evaluatebyadmintext.ReadOnly = true;
}
示例14: Create
public Admin Create(Admin admin)
{
Context.Admins.Add(admin);
Context.SaveChanges();
return admin;
}
示例15: Bt_Update_Click
protected void Bt_Update_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
Admin admin = new Admin();
admin.LoadInfo(Request.Cookies["userID"].Value.ToString());
if (txtPwdold.Text == admin.adminPwd)
{
string xwhere = "where adminID=" + SQLString.GetQuotedString(Request.Cookies["userID"].Value.ToString());
Hashtable ht = new Hashtable();
ht.Add("adminPwd", SQLString.GetQuotedString(txtPwdnew.Text));
if (admin.Update(ht, xwhere))
{
Response.Write("<Script Language=JavaScript>alert(\"密碼修改成功!\")</Script>");
}
else
{
Response.Write("<Script Language=JavaScript>alert(\"密碼修改失敗!\")</Script>");
}
}
else
{
Response.Write("<Script Language=JavaScript>alert(\"舊密碼錯誤!\")</Script>");
}
}
}