Пример #1
0
    //添加
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        if (this.txtDepartmentName.Text == "")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>alert('部门不能为空');</script>");
            return;
        }
        Department dep = new Department();

        dep.DepartmentId   = Guid.NewGuid().ToString();
        dep.DepartmentName = this.txtDepartmentName.Text;
        dep.Account        = AccountsManager.GetAccountByAccountId(oepr.Account.AccountId);
        dep.IsDefault      = false;
        dep.AddDate        = DateTime.Now.ToString();
        bool b = DepartmentManager.AddDepartment(dep);

        if (b)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>alert('添加成功'); window.location='DepartmentManager.aspx';</script>");
            return;
        }
        else
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>alert('已经存在此部门');</script>");
            return;
        }
    }
Пример #2
0
 public string GetAccountNameById(string id)
 {
     if (AccountsManager.GetAccountByAccountId(id) != null)
     {
         return(AccountsManager.GetAccountByAccountId(id).CompanyName);
     }
     return("");
 }