当前位置: 首页>>代码示例>>C#>>正文


C# Admin类代码示例

本文整理汇总了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;
 }
开发者ID:handup,项目名称:Public-hospital,代码行数:27,代码来源:AdminService.cs

示例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("该输入所有数据.");
            }
        }
开发者ID:IrisLinSQ,项目名称:007,代码行数:32,代码来源:Register.cs

示例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>");
        }
    }
开发者ID:dalinhuang,项目名称:my-project-step,代码行数:31,代码来源:Change_Admin_Password.aspx.cs

示例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;
 }
开发者ID:handup,项目名称:Public-hospital,代码行数:28,代码来源:AdminService.cs

示例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();
        }
开发者ID:amcginlay,项目名称:L-16-OOD-01-NET,代码行数:28,代码来源:Program.cs

示例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 "";
     }
 }
开发者ID:harvey-chennnnn,项目名称:Customs-,代码行数:31,代码来源:DesData.aspx.cs

示例7: AssignNewJob

 public AssignNewJob(Admin obj)
 {
     InitializeComponent();
     assignnewjobbyadminidtext.Text = obj.adminId;
     assignnewjobbyadminidtext.ReadOnly = true;
      
 }
开发者ID:namespaceahr,项目名称:SFdevHRMS,代码行数:7,代码来源:AssignNewJob.cs

示例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;
 }
开发者ID:itvijaykumar,项目名称:MRTest,代码行数:26,代码来源:Sample1_Controller.cs

示例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);
        }
    }
开发者ID:windygu,项目名称:asxinyunet,代码行数:31,代码来源:WebFormEntityAccessorTest.aspx.cs

示例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>");
     }
 }
开发者ID:maxijoga10,项目名称:Trivias,代码行数:28,代码来源:abmAdmins.aspx.cs

示例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;
        }
    }
开发者ID:rkchauhan,项目名称:Net-Banking-in-DotNet-LW,代码行数:26,代码来源:Admin.cs

示例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();
        }
开发者ID:haroldocampo,项目名称:KChOTS_OnlineTrainingSystem,代码行数:28,代码来源:AdminController.cs

示例13: EvaluatePerformance

        public EvaluatePerformance(Admin obj)
        {
            InitializeComponent();
            evaluatebyadmintext.Text = obj.adminId;
            evaluatebyadmintext.ReadOnly = true;

        }
开发者ID:namespaceahr,项目名称:SFdevHRMS,代码行数:7,代码来源:EvaluatePerformance.cs

示例14: Create

        public Admin Create(Admin admin)
        {
            Context.Admins.Add(admin);
            Context.SaveChanges();

            return admin;
        }
开发者ID:Wijithapaw,项目名称:BlankProject,代码行数:7,代码来源:AdminService.cs

示例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>");

            }
        }
    }
开发者ID:huaminglee,项目名称:OnlinePublish,代码行数:29,代码来源:modifypwd.aspx.cs


注:本文中的Admin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。