protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            hlBack.NavigateUrl = "Department.aspx?active=" + Request.QueryString["active"];

            if (Request.QueryString["id"] != null)
            {
                ViewState["pk_Department"] = MojoCube.Api.Text.Security.DecryptString(Request.QueryString["id"]);

                MojoCube.Web.User.Department department = new MojoCube.Web.User.Department();
                department.GetData(int.Parse(ViewState["pk_Department"].ToString()));

                txtName.Text     = department.DepartmentName;
                txtPhone1.Text   = department.Phone1;
                txtFax.Text      = department.Fax;
                txtEmail.Text    = department.Email;
                txtAddress.Text  = department.Address;
                txtSortID.Text   = department.SortID.ToString();
                txtWorkTime.Text = department.Monday;

                this.Title = "部门编辑:" + txtName.Text.Trim();
            }
            else
            {
                this.Title = "部门编辑";
            }
        }
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GridBind();

            //用户信息
            MojoCube.Web.User.List list = new MojoCube.Web.User.List();
            list.GetData(int.Parse(Session["UserID"].ToString()));

            lblFullName.Text = list.FullName;

            txtName.Text        = list.UserName;
            txtPhone1.Text      = list.Phone1;
            txtNickName.Text    = list.NickName;
            txtFullName.Text    = list.FullName;
            txtEmail1.Text      = list.Email1;
            txtAddress1.Text    = list.Address1;
            txtEducation.Text   = list.Education;
            txtSchool.Text      = list.School;
            txtBankAccount.Text = list.BankAccount;
            txtIDNumber.Text    = list.IDNumber;
            txtBirthday.Text    = DateTime.Parse(list.Birthday).ToString("yyyy-MM-dd");
            txtNote.Text        = list.Note;
            MojoCube.Web.Sql.ddlFindByValue(ddlSkin, list.Skin);
            MojoCube.Web.Sql.ddlFindByValue(ddlSex, list.Sex.ToString());

            if (list.ImagePath1 != "")
            {
                imgPortrait.ImageUrl = "~/Files.aspx?image=" + MojoCube.Api.Text.Security.EncryptString(list.ImagePath1) + "&cut=200,200";
            }
            else
            {
                imgPortrait.ImageUrl = "~/Images/user.png";
            }

            //职位
            MojoCube.Web.User.Position position = new MojoCube.Web.User.Position();
            position.GetData(list.Position);
            lblPosition.Text = position.Title;

            //部门
            MojoCube.Web.User.Department department = new MojoCube.Web.User.Department();
            department.GetData(list.fk_Department);
            lblDepartment.Text = department.DepartmentName;

            lblEducation.Text = list.School + " " + list.Education;
            lblPhone.Text     = list.Phone1;
            lblAddress.Text   = list.Address1;
            lblNote.Text      = list.Note;

            this.Title = "用户面板";
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtName.Text.Trim() == "")
        {
            AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("danger", "请填写名称");
            return;
        }

        MojoCube.Web.User.Department department = new MojoCube.Web.User.Department();

        //修改
        if (ViewState["pk_Department"] != null)
        {
            department.GetData(int.Parse(ViewState["pk_Department"].ToString()));

            department.DepartmentName = txtName.Text.Trim();
            department.Phone1         = txtPhone1.Text.Trim();
            department.Fax            = txtFax.Text.Trim();
            department.Email          = txtEmail.Text.Trim();
            department.Address        = txtAddress.Text.Trim();
            department.SortID         = MojoCube.Web.String.ToInt(txtSortID.Text.Trim());
            department.ModifyUser     = int.Parse(Session["UserID"].ToString());
            department.ModifyDate     = DateTime.Now.ToString();
            department.Monday         = txtWorkTime.Text.Trim();
            department.Tuesday        = txtWorkTime.Text.Trim();
            department.Wednesday      = txtWorkTime.Text.Trim();
            department.Thursday       = txtWorkTime.Text.Trim();
            department.Friday         = txtWorkTime.Text.Trim();
            department.UpdateData(department.pk_Department);
        }
        //新增
        else
        {
            department.DepartmentName = txtName.Text.Trim();
            department.Phone1         = txtPhone1.Text.Trim();
            department.Phone2         = string.Empty;
            department.Fax            = txtFax.Text.Trim();
            department.Email          = txtEmail.Text.Trim();
            department.Address        = txtAddress.Text.Trim();
            if (Request.QueryString["parentId"] != null)
            {
                department.ParentID = int.Parse(MojoCube.Api.Text.Security.DecryptString(Request.QueryString["parentId"]));
                department.LevelID  = 1;
            }
            else
            {
                department.ParentID = 0;
                department.LevelID  = 0;
            }
            department.SortID     = MojoCube.Web.String.ToInt(txtSortID.Text.Trim());
            department.TypeID     = 0;
            department.Province   = 0;
            department.City       = 0;
            department.County     = 0;
            department.Zone       = 0;
            department.Manager    = 0;
            department.fk_Company = 0;
            department.CreateUser = int.Parse(Session["UserID"].ToString());
            department.CreateDate = DateTime.Now.ToString();
            department.ModifyUser = 0;
            department.ModifyDate = DateTime.Now.ToString();
            department.Monday     = txtWorkTime.Text.Trim();
            department.Tuesday    = txtWorkTime.Text.Trim();
            department.Wednesday  = txtWorkTime.Text.Trim();
            department.Thursday   = txtWorkTime.Text.Trim();
            department.Friday     = txtWorkTime.Text.Trim();
            department.Saturday   = string.Empty;
            department.Sunday     = string.Empty;
            department.InsertData();
        }

        Response.Redirect("Department.aspx?active=" + Request.QueryString["active"]);
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (this.Page.Title != "")
            {
                MojoCube.Web.User.Log.AddLog(this.Page.Title);
            }

            //用户信息
            MojoCube.Web.User.List user = new MojoCube.Web.User.List();
            user.GetData(int.Parse(Session["UserID"].ToString()));

            LeftMenu.InnerHtml      = CreateLeftMenu();
            MyHistory.InnerHtml     = CreateHistory(user.ShowHistory);
            lblYear.Text            = DateTime.Now.Year.ToString();
            hlCopyright.NavigateUrl = "http://www.mojocube.com/";
            hlCopyright.Text        = "MojoCube";
            hlCopyright.Target      = "_blank";
            Welcome.InnerHtml       = DateTime.Now.ToString("yyyy年MM月dd日") + ", " + MojoCube.Api.Date.Get.ChineseWeek();

            ViewState["Skin"] = user.Skin;

            lblFullName1.Text = lblFullName2.Text = user.FullName;
            if (user.ImagePath1 != "")
            {
                imgPortrait1.ImageUrl = imgPortrait2.ImageUrl = imgPortrait3.ImageUrl = "~/Admin/Files.aspx?image=" + MojoCube.Api.Text.Security.EncryptString(user.ImagePath1);
            }
            else
            {
                imgPortrait1.ImageUrl = imgPortrait2.ImageUrl = imgPortrait3.ImageUrl = "~/Admin/Images/user.png";
            }

            //职位
            MojoCube.Web.User.Position position = new MojoCube.Web.User.Position();
            position.GetData(user.Position);
            lblPosition.Text = position.Title;

            //部门
            MojoCube.Web.User.Department department = new MojoCube.Web.User.Department();
            department.GetData(user.fk_Department);
            lblDepartment.Text = department.DepartmentName;

            //角色
            MojoCube.Web.Role.Name role = new MojoCube.Web.Role.Name();
            role.GetData(user.RoleValue);
            lblRoleName.Text = role.RoleName_CHS;
        }

        this.Page.Title = "MojoCube";

        //界面皮肤
        if (ViewState["Skin"] != null)
        {
            skin = ViewState["Skin"].ToString();
        }
        else
        {
            skin = "blue";
        }
        skinCss = "<link rel=\"stylesheet\" href=\"../Skins/dist/css/skins/skin-" + skin + ".min.css\" /><link rel=\"stylesheet\" href=\"../Skins/plugins/iCheck/flat/" + skin + ".css\" />";
    }