Ejemplo n.º 1
0
    public string addUserType(string typeName, string isactive)
    {
        usertypeManager objUserType = new usertypeManager();
        string          sortor      = Convert.ToString(CommonFunctions.GetLastSortCount("adminType", "sortorder"));

        if (typeName != "" && isactive != "")
        {
            objUserType.typeName  = typeName;
            objUserType.sortorder = Convert.ToInt32(sortor);
            objUserType.isactive  = Convert.ToByte(isactive);
            objUserType.InsertItem();

            return("success");
        }
        else
        {
            return("fail");
        }
    }
Ejemplo n.º 2
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        lblmsgs.Text = "";
        if (Page.IsValid)
        {
            objusertype.typeName  = Server.HtmlEncode(txtadmintype.Text);
            objusertype.sortorder = Convert.ToInt32(txtsortorder.Text);
            objusertype.isactive  = Convert.ToByte(chkvisible.Checked);

            if (Request.QueryString["flag"] == "edit")
            {
                objusertype.adminTypeId = Convert.ToInt32(Request.QueryString["id"]);
                if (objusertype.TitleExist())
                {
                    lblmsg.Visible = true;
                    lblmsgs.Text   = "User type already exists.";
                    return;
                }

                objusertype.UpdateItem(Convert.ToInt32(hfprevsort.Value), Convert.ToInt32(txtsortorder.Text));
                Response.Redirect("viewusertype.aspx?flag=edit&key=" + Request.QueryString["key"]);
            }
            else
            {
                objusertype.adminTypeId = 0;
                if (objusertype.TitleExist())
                {
                    lblmsg.Visible = true;
                    lblmsgs.Text   = "User Type already exists.";
                    return;
                }

                objusertype.InsertItem();
                Response.Redirect("viewusertype.aspx?flag=add&key=" + Request.QueryString["key"]);
            }
        }
    }