protected void btnEdit_Click(object sender, EventArgs e)
        {
            string pid = Request.QueryString["pid"];

            if (!string.IsNullOrEmpty(pid))
            {
                Valuer v = new Valuer();
                v.SavePageObjects(this.Page, pid, "personal", "0");
                Response.Redirect("personal.aspx?pid=" + pid);
            }
        }
        protected void btnAccount_Click(object sender, EventArgs e)
        {
            string pid = AddAccount();

            if (pid != "0")
            {
                Valuer v = new Valuer();
                v.SavePageObjects(this.Page, pid, "personal", "0");
                Response.Redirect("personal.aspx?pid=" + pid);
            }
            else
            {
                Response.Write("<script>alert('Sorry. The National-code has been registered.')</script>");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["username"] == null)
            {
                Response.Redirect("default.aspx");
            }

            if (Engine.GetUserPermission(Request.Cookies["username"].Value) == "1")
            {
                divPezeshk.Style.Add("display", "none");
                divPezeshk2.Style.Add("display", "none");
            }


            string pid = Request.QueryString["pid"];

            if (string.IsNullOrEmpty(pid))            //new user
            {
                after.Visible = false;
                Valuer v = new Valuer();
                v.EnablePageObjects(this.Page);
            }

            if (!IsPostBack)
            {
                if (Session["nationalcode"] is string)
                {
                    txtNationalCode.Value   = Session["nationalcode"].ToString();
                    txtFirstName.Value      = Session["firstname"].ToString();
                    txtLastName.Value       = Session["lastname"].ToString();
                    txtFathersName.Value    = Session["fathersname"].ToString();
                    Session["nationalcode"] = null;
                    Session["firstname"]    = null;
                    Session["lastname"]     = null;
                    Session["fathersname"]  = null;
                }

                if (!string.IsNullOrEmpty(pid))
                {
                    before.Visible = false;
                    LoadAccount(pid);
                    Valuer v = new Valuer();
                    v.LoadPageObjects(this.Page, pid, "personal", "0");
                    LoadComponent(pid);
                }
            }
        }