コード例 #1
0
    protected void btnLuu_Click(object sender, EventArgs e)
    {
        cls_GiaoVien cls = new cls_GiaoVien();
        cls_security md5 = new cls_security();
        //string passWord = txtPass.Text.Trim();
        //string passmd5 = md5.HashCode(txtPass.Text);
        string bophan = rdGV.SelectedValue;

        if (checknull() == false)
        {
            alert.alert_Warning(Page, "Nhập đầy đủ thông tin!", "");
        }
        else
        {
            if (Session["_id"].ToString() == "0")
            {
                bool gt = true;
                if (rdGroup.SelectedValue == "2")
                {
                    gt = false;
                }

                if (cls.Linq_Them(txttensanpham.Text, gt, bophan, txtEmail.Text, txtPhone.Text, txtAccount.Text))
                {
                    alert.alert_Success(Page, "Thêm thành công", "");
                }
                else
                {
                    alert.alert_Error(Page, "Thêm thất bại", "");
                }
            }
            else
            {
                bool gt = true;
                if (rdGroup.SelectedValue == "2")
                {
                    gt = false;
                }
                if (cls.Linq_Sua(Convert.ToInt32(Session["_id"].ToString()), txttensanpham.Text, gt, txtEmail.Text, txtPhone.Text, txtAccount.Text))
                {
                    alert.alert_Success(Page, "Cập nhật thành công", "");
                }
                else
                {
                    alert.alert_Error(Page, "Cập nhật thất bại", "");
                }
            }
        }
        popupControl.ShowOnPageLoad = false;
        loadDataGiaoVien();
    }