protected void Approve()
 {
     System.Text.StringBuilder strUserIds = new System.Text.StringBuilder();
     foreach (GridViewRow i in grdAgent.Rows)
     {
         CheckBox c1 = (CheckBox)i.FindControl("chkSelect");
         if (c1.Checked == true)
         {
             string UserId = grdAgent.DataKeys[i.RowIndex].Values[0].ToString() + ",";
             strUserIds.Append(UserId);
         }
     }
     if (strUserIds.Length > 0)
     {
         strUserIds.Remove(strUserIds.Length - 1, 1);
         oUserAcount = new UserAcount
         {
             Flag     = 4,
             UserIds  = strUserIds.ToString(),
             IsActive = true
         };
         oPUserAcount   = new PUserAcount();
         ds             = oPUserAcount.UserAcount(oUserAcount);
         lblMsg.Visible = true;
         lblMsg.Text    = ds.Tables[0].Rows[0][0].ToString();
         Bind();
     }
     else
     {
         lblMsg.Visible  = true;
         lblMsg.Text     = "No agent is selected.";
         lblMsg.CssClass = "valid";
         return;
     }
 }
        protected void UserAuthentication()
        {
            oUserAcount = new UserAcount
            {
                Flag     = 2,
                EMail    = txtEMail.Text,
                Password = txtPassword.Text,
            };
            oPUserAcount = new PUserAcount();
            ds           = oPUserAcount.UserAcount(oUserAcount);
            string s = ds.Tables[0].Rows[0][0].ToString();

            string[] Param = s.Split(new string[] { "*" }, StringSplitOptions.None);
            if (Param.Length == 3)
            {
                Session["User_ID"]   = Param[0];
                Session["User_Type"] = Param[1];
                Session["Login"]     = Param[2];

                if (Param[1] == "4")
                {
                    Response.Redirect("~/Administration/AgentApprove.aspx");
                }
            }
            else
            {
                lblFailureText.Visible = true;
                lblFailureText.Text    = s;
            }
        }
        protected void UserAuthentication()
        {
            oUserAcount = new UserAcount
            {
                Flag     = 2,
                EMail    = txtEMail.Text,
                Password = txtPassword.Text,
            };
            oPUserAcount = new PUserAcount();
            ds           = oPUserAcount.UserAcount(oUserAcount);
            string s = ds.Tables[0].Rows[0][0].ToString();

            string[] Param = s.Split(new string[] { "*" }, StringSplitOptions.None);
            if (Param.Length == 3)
            {
                Session["User_ID"]   = Param[0];
                Session["User_Type"] = Param[1];
                Session["Login"]     = Param[2];
                liAcount.Visible     = true;
                tblLogin.Visible     = true;
                divImage.Visible     = true;
                if (Param[1] == "4")
                {
                    //Admin

                    Response.Redirect("~/Administration/UserProfile.aspx");
                }
                else if (Param[1] == "3")
                {
                    //POS

                    Response.Redirect("~/Booking/BookingCounter.aspx");
                }
                else
                {
                    //Normal User,Agent,POS  Session["Booking_Quoto"]
                    if (Param[1] == "2")
                    {
                        Session["Booking_Quoto_Name"] = "Gen"; //Agent
                        Session["Booking_Quoto"]      = 1;     //Agent
                    }
                    else
                    {
                        Session["Booking_Quoto_Name"] = "Agent"; //Agent
                        Session["Booking_Quoto"]      = 2;       //Agent
                    }
                    SetVisibilty();
                    Response.Redirect("~/Default.aspx");
                }
            }
            else
            {
                lblFailureText.Visible = true;
                lblFailureText.Text    = s;
                //Response.Redirect("~/Default.aspx");
            }
        }
 protected void Bind()
 {
     oUserAcount = new UserAcount
     {
         Flag     = 3,
         IsActive = false
     };
     oPUserAcount        = new PUserAcount();
     ds                  = oPUserAcount.UserAcount(oUserAcount);
     grdAgent.DataSource = ds;
     grdAgent.DataBind();
 }
 protected void EditProfile()
 {
     oUserAcount = new UserAcount
     {
         Flag             = 6,
         UserID           = Convert.ToDouble(Session["User_ID"].ToString()),
         FirstName        = txtFirstName.Text,
         LastName         = txtLastName.Text,
         MobileNo         = Convert.ToDouble(txtMobileNo.Text),
         City             = txtCity.Text,
         Address1         = txtAddress1.Text != string.Empty ? txtAddress1.Text : null,
         PinCode          = txtPinCode.Text != string.Empty ? Convert.ToDouble(txtPinCode.Text) : (double?)null,
         PanNo            = txtPanNo.Text,
         FaxNo            = txtFaxNo.Text != string.Empty ? Convert.ToDouble(txtFaxNo.Text) : (double?)null,
         OrganizationName = txtOrganizationName.Text,
     };
     oPUserAcount   = new PUserAcount();
     ds             = oPUserAcount.UserAcount(oUserAcount);
     lblmsg.Visible = true;
     lblmsg.Text    = ds.Tables[0].Rows[0][0].ToString();
 }
        protected void PrepareEntity(Enum Mode, string par = "")
        {
            int UserType = int.Parse(ViewState["RegisterAs"].ToString());

            oUserAcount = new UserAcount
            {
                Flag             = 1,
                UserType         = UserType,
                FirstName        = txtFirstName.Text,
                LastName         = txtLastName.Text,
                EMail            = txtEmail.Text,
                Password         = txtPassword.Text,
                MobileNo         = Convert.ToDouble(txtMobileNo.Text),
                City             = txtCity.Text,
                Address1         = txtAddress1.Text != string.Empty ? txtAddress1.Text : null,
                PinCode          = txtPinCode.Text != string.Empty ? Convert.ToDouble(txtPinCode.Text) : (double?)null,
                PanNo            = txtPanNo.Text,
                FaxNo            = txtFaxNo.Text != string.Empty ? Convert.ToDouble(txtFaxNo.Text) : (double?)null,
                OrganizationName = txtOrganizationName.Text,
                IsActive         = UserType != 2 ? true : false
            };
            oPUserAcount = new PUserAcount();
            if (Mode.Equals(DMLFlags.Insert))
            {
                ds = oPUserAcount.UserAcount(oUserAcount);
            }
            msg.Text         = ds.Tables[0].Rows[0][0].ToString();
            tblMain.Visible  = false;
            tblSave.Visible  = false;
            tblAgent.Visible = false;
            pMsgInfo.Visible = false;
            tblMsg.Visible   = true;
            if (msg.Text.Contains("successfully"))
            {
                if (UserType == 2)
                {
                    msg.Text = msg.Text + " And submitted to site admin for approval.";
                }
            }
        }
        protected void ShowProfile()
        {
            oUserAcount = new UserAcount
            {
                Flag   = 5,
                UserID = Convert.ToInt32(Session["User_ID"].ToString())
            };
            oPUserAcount = new PUserAcount();
            ds           = oPUserAcount.UserAcount(oUserAcount);


            txtFirstName.Text        = ds.Tables[0].Rows[0]["FirstName"].ToString();
            txtLastName.Text         = ds.Tables[0].Rows[0]["LastName"].ToString();
            txtEmail.Text            = ds.Tables[0].Rows[0]["EMail"].ToString();
            txtCity.Text             = ds.Tables[0].Rows[0]["City"] != null ? ds.Tables[0].Rows[0]["City"].ToString():string.Empty;
            txtMobileNo.Text         = ds.Tables[0].Rows[0]["MobileNo"].ToString();
            txtOrganizationName.Text = ds.Tables[0].Rows[0]["OrganizationName"] != null ? ds.Tables[0].Rows[0]["OrganizationName"].ToString() : string.Empty;
            txtPinCode.Text          = ds.Tables[0].Rows[0]["PinCode"] != null ? ds.Tables[0].Rows[0]["PinCode"].ToString(): string.Empty;
            txtPanNo.Text            = ds.Tables[0].Rows[0]["PanNo"] != null ? ds.Tables[0].Rows[0]["PanNo"].ToString() : string.Empty;
            txtFaxNo.Text            = ds.Tables[0].Rows[0]["FaxNo"] != null ? ds.Tables[0].Rows[0]["FaxNo"].ToString() : string.Empty;
            txtAddress1.Text         = ds.Tables[0].Rows[0]["Address1"] != null ? ds.Tables[0].Rows[0]["Address1"].ToString() : string.Empty;
        }