protected void BindCusRequests()
    {
        try
        {
            objBAL = new ClsBAL();
            ObjDataset = (DataSet)objBAL.GetCusRequests();
            if (ObjDataset != null)
            {
                if (ObjDataset.Tables.Count > 0)
                {

                    if (ObjDataset.Tables[0].Rows.Count > 0)
                    {
                        ddlPageSize.Enabled = lbtnXport2Xcel.Enabled = true;
                    }
                    else
                    {
                        ddlPageSize.Enabled = lbtnXport2Xcel.Enabled = false;
                    }
                    ViewState["CusRequests"] = ObjDataset.Tables[0];
                    GvCusRequests.DataSource = ObjDataset.Tables[0];
                    GvCusRequests.DataBind();
                }
            }
        }
        catch (Exception ex)
        {

            throw ex;
        }
    }
 public static String GetDestinations(String sourceId)
 {
     try
     {
         ClsBAL objBAL = new ClsBAL();
         DataSet ObjDataset = objBAL.GetDestinations(sourceId);
         StringBuilder sbDestinations = new StringBuilder();
         if (ObjDataset != null)
         {
             if (ObjDataset.Tables.Count > 0)
             {
                 DataTable dtDestinations = ObjDataset.Tables[0];
                 HttpContext.Current.Session["sesDTDestinations"] = dtDestinations;
                 sbDestinations.Append("<select id=\"ddldestinationsDiv\" name=\"ddldestinationsDiv\" style=\"width:130px;\" >");
                 sbDestinations.Append("<option value=''>----------</option>");
                 if (dtDestinations.Rows.Count > 0)
                 {
                     foreach (DataRow item in dtDestinations.Rows)
                     {
                         sbDestinations.Append("<option value=" + item["ID"].ToString() + ">" + item["DestinationName"].ToString() + "</option>");
                     }
                 }
                 sbDestinations.Append("</select>");
             }
         }
         return sbDestinations.ToString();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 protected void btnRegister_Click(object sender, EventArgs e)
 {
     try
     {
         ClsBAL objManabusBal = new ClsBAL();
         string message = "";
         message = objManabusBal.UpdateAgentByAgent(txtAgentName.Text.Trim().ToString(),
               ddlType.SelectedItem.Text.ToString(),
               Convert.ToDateTime(txtDateOfBirth.Text.ToString()),
               txtCity.Text.Trim().ToString(),
               ddlState.SelectedItem.Text.ToString(),
               txtAddress.Text.Trim().ToString(),
               txtPinCode.Text.Trim().ToString(),
               txtMobileNo.Text.Trim().ToString(),
               txtAlternateMobileNo.Text.Trim().ToString(),
               txtLandlineNo.Text.Trim().ToString(),
               txtEmailId.Text.Trim().ToString(),
               txtPAN.Text.Trim().ToString(),
               "",
               "",
               "",
               Convert.ToInt32(Session["UserID"].ToString()),
               Convert.ToInt32(Session["UserID"].ToString()), Convert.ToInt32(txtCommissionPercentage.Text.ToString()));
         lblMsg.InnerHtml = message;
     }
     catch (Exception ex)
     {
         lblMsg.InnerHtml = ex.Message;
         throw;
     }
 }
    protected void btnupdate_Click(object sender, EventArgs e)
    {
        try
        {
            objBAL = new ClsBAL();
            objBAL.ID = Convert.ToInt32(lblId.Text);
            objBAL.api = ddlApi.SelectedItem.Text;
            objBAL.sourceId = Convert.ToInt32(ddlOperator.SelectedItem.Value);
            objBAL.percentage = txtCancelPercenatge.Text;
            objBAL.beforeTime = txtBeforeTime.Text;
            if (objBAL.UpdateCancelPolicy())
            {
                lblMsg.Text = "Updated Successfully";
                lblMsg.ForeColor = System.Drawing.Color.Green;

                txtCancelPercenatge.Text = txtBeforeTime.Text = "";
                ddlApi.SelectedIndex = 0;
                btnupdate.Visible = btnCancel.Visible = false;
                btnsave.Visible = true;
                GetCancelPercentages();
            }
            else
            {
                lblMsg.Text = "Failed to Update.....";
                lblMsg.ForeColor = System.Drawing.Color.Red;
            }
        }
        catch (Exception ex)
        {

            throw ex;
        }
    }
    protected void BindSourcesDests()
    {
        try
        {
            objBAL = new ClsBAL();
            ObjDataset = (DataSet)objBAL.GetSourcesDests();
            if (ObjDataset != null)
            {
                if (ObjDataset.Tables.Count > 0)
                {
                    if (ObjDataset.Tables[0].Rows.Count > 0)
                    {
                        ddllocation.DataSource = ObjDataset.Tables[0];
                        ddllocation.DataTextField = "SourceName";
                        ddllocation.DataBind();
                        ddllocation.Items.Insert(0, "ALL");

                    }

                }
            }

        }
        catch (Exception ex)
        {

            throw ex;
        }
    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        try
        {
            objManabusBAL = new ClsBAL();
            objManabusBAL.name = txtName.Text;
            objManabusBAL.emailId = txtEmail.Text;
            objManabusBAL.mobileNo = txtPhone.Text;
            objManabusBAL.comments = txtComments.Text;
            if (objManabusBAL.AddFeedback())
            {

                lblmsg.Text = "Feedback submitted successfully to admin. Thanks for your feedback.";
                lblmsg.ForeColor = System.Drawing.Color.Green;
                txtName.Text = txtEmail.Text = txtPhone.Text = txtComments.Text = "";
            }
            else
            {
                lblmsg.Text = "Failed to send feedback. Please find try again.";
                lblmsg.ForeColor = System.Drawing.Color.Red;
            }
        }

        catch (Exception ex)
        {
            throw ex;
        }
    }
    protected void btnUploadImage_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["UserID"] != null)
            {
                ClsBAL obj = new ClsBAL();
                byte[] imageByte = null;
                if (fuImage.HasFile)
                {
                    HttpPostedFile postedFile = fuImage.PostedFile;
                    imageByte = new byte[postedFile.ContentLength];
                    if (postedFile.ContentLength > 102400)
                    { lblMsg.InnerHtml = "The size of image must be less than 100KB(102400 bytes)."; return; }
                    postedFile.InputStream.Read(imageByte, 0, postedFile.ContentLength);
                }
                lblMsg.InnerHtml = obj.InsertAgentLogo(Convert.ToInt32(Session["UserID"].ToString()), imageByte);

                Image img = (Image)this.Master.FindControl("imgAgentLogo");
                img.ImageUrl = imgAgentLogo.ImageUrl = "~/ActualImage.ashx?ID=" + Session["UserID"].ToString();
            }
        }
        catch (Exception ex)
        {
            lblMsg.InnerHtml = ex.Message;
            throw;
        }
    }
    protected void BindPromocodes()
    {
        try
        {
            objBAL = new ClsBAL();
            ObjDataset = (DataSet)objBAL.GetPromoCodes();
            if (ObjDataset != null)
            {
                if (ObjDataset.Tables.Count > 0)
                {
                    if (ObjDataset.Tables[0].Rows.Count > 0)
                    {
                        lbtnXport2Xcel.Enabled = true;
                        ViewState["PromoCodes"] = ObjDataset.Tables[0];
                    }
                    gvPromoCodes.DataSource = ObjDataset.Tables[0];
                    gvPromoCodes.DataBind();
                }
            }
        }
        catch (Exception ex)
        {

            throw ex;
        }
    }
    protected void updatebalance()
    {
        DataSet ds = new DataSet();
          ds =  objManabusBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));
          if (ds != null)
          {
              if (ds.Tables.Count > 0)
              {
                  if (ds.Tables[0].Rows.Count > 0)
                  {
                      ClsBAL objBal = new ClsBAL();
                          DateTime? dtime = null;

                      //    string msg = objBal.AddAgentDeposit(Convert.ToInt32(Session["UserID"].ToString())
                      //, Convert.ToDouble(Session["RechargeAmount"].ToString()), "", Convert.ToInt32(Session["UserID"].ToString())
                      //, "Payment Gateway", Session["Order_Id"].ToString().ToString(), "");

                      //    lblMsg.InnerText = msg;
                          lblMsg.InnerText = objBal.InsertDepositUpdateRequest(Convert.ToInt32(Session["UserID"].ToString()), Convert.ToDouble(Session["RechargeAmount"].ToString()),
                              Convert.ToString(""), Session["Order_Id"].ToString(), "Payment Gateway",
                            "", "", System.DateTime.Now,
                             "", Convert.ToInt32(Session["UserID"].ToString()), "Deposited");
                          if (lblMsg.InnerText.ToString() == "Your request has been submitted successfully. Our Team will get back to you.")
                          {
                              lblmessage.Text = "your Amount added Successfully";

                              objBal.Upstatus(Convert.ToInt32(Session["UserID"].ToString()), Convert.ToDouble((Session["RechargeAmount"].ToString())));
                          }

                  }
              }
          }
    }
    protected bool AddCashCoupontest()
    {
        try
        {
            objBAL = new ClsBAL();
            objBAL.couponNo = Convert.ToString(GeneratePassword());
            objBAL.emailId = Convert.ToString(txtEmailID.Text);
            objBAL.Amount = Convert.ToString(txtAmount.Text);
            objBAL.createdBy = Convert.ToInt32(Session["UserID"]);

            if (objBAL.AddCashCoupon(ref lblMsg))
            {
                return true;
            }
            else if (lblMsg.Text == "Already Cash Coupon with this Number Exists")
            {
                return false;
            }
            else
            {
                return false;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    protected bool AddCashCoupon(string Amount, string couponCode, string emailid)
    {
        try
        {
            ObjBAL = new ClsBAL();

            ObjBAL.couponNo = Convert.ToString(couponCode);
            ObjBAL.emailId = Convert.ToString(emailid);
            ObjBAL.Amount = Convert.ToString(Amount);
            ObjBAL.createdBy = null;

            if (ObjBAL.AddCashCoupon(ref lblMsg))
            {
                return true;
            }
            else if (lblMsg.Text == "Already Cash Coupon with this Number Exists")
            {
                return false;
            }
            else
            {
                return false;
            }

        }
        catch (Exception ex)
        {

            throw ex;

        }
    }
    protected bool AddCashCoupon()
    {
        try
        {
            objBAL = new ClsBAL();
            lblCode.Text = "CC" + GeneratePassword();
            objBAL.name = ddlserviceName.SelectedValue;
            objBAL.couponNo = Convert.ToString(txtcahcoupon.Text);
            objBAL.emailId = Convert.ToString(txtEmailID.Text);
            objBAL.Amount = Convert.ToString(txtAmount.Text);
           // objBAL.MinAmount = txtminamt.Text.Trim();
          //  objBAL.MaxAmount = txtmaxamt.Text.Trim();
            objBAL.createdBy = Convert.ToInt32(Session["UserID"]);

            if (objBAL.AddCashCoupon(ref lblMsg))
            {
                return true;
            }
            else if (lblMsg.Text == "Already Cash Coupon with this Number Exists")
            {
                return false;
            }
            else
            {
                return false;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    protected void btnEmp_Click(object sender, EventArgs e)
    {
        try
        {
            ClsBAL obj = new ClsBAL();
            string filename = Path.GetFileName(fuImage.PostedFile.FileName);
            fuImage.SaveAs(Server.MapPath("~/saveresumes/" + filename));
            string pathname = "~/saveresumes/" + filename;

            string filename1 = Path.GetFileName(FileUpload1.PostedFile.FileName);
            FileUpload1.SaveAs(Server.MapPath("~/savedocs/" + filename1));
            string pathname1 = "~/savedocs/" + filename1;

            lblEmp.Text = obj.InsertEmpRequest(txtEmpName.Text.ToString(), txtEmpEmail.Text.ToString(), "", txtEmpMobileNo.Text.ToString(),
                txtEmpCity.Text.ToString(), ddlState.SelectedItem.Text.ToString(), "", "", "Emp", "", "", "", filename, pathname, filename1, pathname1,txtQualification.Text,txtEmpAddress.Text);

            lblEmp.ForeColor = System.Drawing.Color.Green;
            txtEmpName.Text = txtEmpEmail.Text = txtEmpMobileNo.Text = txtEmpCity.Text = txtCorCity.Text = txtComments.Text = txtCorDist.Text =txtEmpAddress.Text= txtEmpPinCode.Text=txtQualification.Text="";
            ddlState.ClearSelection();
            ddlEmpcountry.ClearSelection();

        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
            throw;
        }
    }
 protected void CheckPermission()
 {
     try
     {
         ClsBAL objBAL = new ClsBAL();
         objBAL.ID = Convert.ToInt32(Session["UserID"]);
         objBAL.screenName = "Recharge Status";
         _objDataSet = (DataSet)objBAL.GetPerByUser();
         if (_objDataSet != null)
         {
             if (_objDataSet.Tables[0].Rows.Count > 0)
             {
                 ViewState["UserPermissions"] = _objDataSet.Tables[0];
                 ViewState["Book"] = _objDataSet.Tables[0].Rows[0]["Book"].ToString();
             }
             else
             {
                 ViewState["UserPermissions"] = null;
             }
         }
         else
         {
             ViewState["UserPermissions"] = null;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    protected bool AddPromoCode()
    {
        try
        {
            objBAL = new ClsBAL();
           // lblCode.Text = "PC" + GeneratePromocode();
            objBAL.name = ddlserviceName.SelectedValue;
            objBAL.promoCode = Convert.ToString(txtpromocode.Text);
            objBAL.Amount = txtAmount.Text.ToString();
            objBAL.monthsToExpire = Convert.ToInt32(txtMonthstoexpire.Text);
            //objBAL.MinAmount = txtminamt.Text.Trim();
            //objBAL.MaxAmount = txtmaxamt.Text.Trim();
            objBAL.createdBy = Convert.ToInt32(Session["UserID"].ToString());
            if (objBAL.AddPromoCode(ref lblMsg))
            {
                return true;
            }
            else if (lblMsg.Text == "Already Promo code with this Number Exists")
            {
                return false;
            }
            else
            {
                return false;
            }
        }
        catch (Exception ex)
        {

            throw ex;
        }
    }
Example #16
0
    public static string GenerateHotelRefNo()
    {
        try
        {
            int minPassSize = 4;
            int maxPassSize = 4;
            StringBuilder stringBuilder = new StringBuilder();
            char[] charArray = "0123456789".ToCharArray();
            int newPassLength = new Random().Next(minPassSize, maxPassSize);
            char character;
            Random rnd = new Random(DateTime.Now.Millisecond);
            for (int i = 0; i < newPassLength; i++)
            {
                character = charArray[rnd.Next(0, (charArray.Length - 1))];
                stringBuilder.Append(character);
            }
            string refno = "LJH" + stringBuilder.ToString();

            ClsBAL objBAL = new ClsBAL();
            string strUniqueId = objBAL.GetUniqueId();
            return refno + strUniqueId;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    public void GetHomeDeliveries()
    {
        try
        {
            objBAL = new ClsBAL();
            objBAL.deliveryType = "Home Delivery";
            ObjDataset = (DataSet)objBAL.GetHomeOfficePickups();
            if (ObjDataset != null)
            {
                if (ObjDataset.Tables.Count > 0)
                {
                    if (ObjDataset.Tables[0].Rows.Count > 0)
                    {
                        ViewState["HomeDeliveries"] = ObjDataset.Tables[0];

                        ddlPageSize.Enabled = lbtnXport2Xcel.Enabled = true;
                    }
                    else
                    {
                        ddlPageSize.Enabled = lbtnXport2Xcel.Enabled = false;
                    }
                    GvHomeDelivery.DataSource = ObjDataset.Tables[0];
                    GvHomeDelivery.DataBind();
                }
            }
        }
        catch (Exception ex)
        {

            throw ex;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            objBAL = new ClsBAL();
            string str = objBAL.Updatecancelstatus(Session["refno"].ToString(), "Booked");
            //lblCancel.Text = str;

                BindTicketDetails();

        }
    }
 public string DeductAgentBalance(int agentId, double deductAmount, int createdBy, string mbRefNo, double actualFare, double commisionFare, int commisionPercentage)
 {
     try
     {
         ClsBAL objBAL = new ClsBAL();
         return objBAL.DeductAgentBalance(agentId, deductAmount, createdBy, mbRefNo,
             actualFare, commisionFare, commisionPercentage);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    protected void btnAgentLogin_Click(object sender, EventArgs e)
    {
        try
        {
            ClsBAL objManabusBAL = new ClsBAL();
            objManabusBAL.userName = Convert.ToString(txtAgentName.Text);
            objManabusBAL.password = Convert.ToString(txtAgentPassword.Text);

            if (objManabusBAL.CheckUser() == "Valid User")
            {
                if (Session["Role"] != null)
                {

                     if (Session["Role"].ToString() == "Agent")
                    {
                        System.Data.DataSet ds = objManabusBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));
                        Session["Balance"] = ds.Tables[0].Rows[0]["Balance"].ToString();
                        Session["View"] = "AgentView";
                        string ss = ds.Tables[0].Rows[0]["Status"].ToString();
                        if (ss.ToUpper().ToString() != "HOLD")
                        {
                            Response.Redirect("~/Default.aspx", false);
                        }
                        else
                        {
                            lblEmpMsg.Text = "Your account is on HOLD. Please contact the administrator.";
                            lblEmpMsg.ForeColor = System.Drawing.Color.Red;
                            Session["UserID"] = null;
                        }
                    }

                    else
                    {
                        lblEmpMsg.Text = "UserName / Password Is Incorrect.";
                        lblEmpMsg.ForeColor = System.Drawing.Color.Red;
                    }
                }
            }
            else
            {
                lblEmpMsg.Text = "UserName / Password Is Incorrect.";
                lblEmpMsg.ForeColor = System.Drawing.Color.Red;
            }
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
            throw ex;
        }
    }
 protected void btnChangePassword_Click(object sender, EventArgs e)
 {
     try
     {
         ClsBAL obj = new ClsBAL();
         string msg = obj.ChangePassword(Convert.ToInt32(Session["UserID"].ToString()), txtPassword.Text.Trim().ToString(), Convert.ToInt32(Session["UserID"].ToString()), txtCurrentPassword.Text.Trim().ToString());
         lblMsg.InnerHtml = msg;
     }
     catch (Exception ex)
     {
         lblMsg.InnerHtml = ex.Message;
         throw;
     }
 }
 protected void btnsave_Click(object sender, EventArgs e)
 {
     try
     {
         lblMsg.Text = "";
         objBAL = new ClsBAL();
         bool b= objBAL.AddRating(Convert.ToInt32(ddlOperator.SelectedValue.ToString()), Convert.ToInt32(txtRating.Text.ToString()));
         if (b) { lblMsg.Text = "Saved Successfully."; BindGrid(); }
         else { lblMsg.Text = "Failed."; }
     }
     catch (Exception)
     {
         throw;
     }
 }
    protected void GetTicketDetails()
    {
        try
        {
            if (Session["Ticketrefno"] != null)
            {
                ClsBAL ObjManbusBAL = new ClsBAL();
                ObjManbusBAL.manabusRefNo = Session["Ticketrefno"].ToString();
                DataSet _objDataSetBook = (DataSet)ObjManbusBAL.GetTicketIdByTicketrefNo();
                if (_objDataSetBook != null)
                {
                    if (_objDataSetBook.Tables.Count > 0)
                    {
                        if (_objDataSetBook.Tables[0].Rows.Count > 0)
                        {
                            travelName = _objDataSetBook.Tables[0].Rows[0]["TravelOPName"].ToString().Trim();
                            api = _objDataSetBook.Tables[0].Rows[0]["APIName"].ToString();
                            Name = _objDataSetBook.Tables[0].Rows[0]["FullName"].ToString();
                            SeatNos = _objDataSetBook.Tables[0].Rows[0]["SeatNos"].ToString();
                            Route = _objDataSetBook.Tables[0].Rows[0]["Route"].ToString();
                            LJRefNo = _objDataSetBook.Tables[0].Rows[0]["OnewayMBRefNo"].ToString();
                            PNR = _objDataSetBook.Tables[0].Rows[0]["PNRNumber"].ToString();
                            Boardingpoint = _objDataSetBook.Tables[0].Rows[0]["BoardingPointName"].ToString();
                            BoardingInfo = _objDataSetBook.Tables[0].Rows[0]["BoardingInfo"].ToString();
                            ContactNo = _objDataSetBook.Tables[0].Rows[0]["ContactNo"].ToString();

                            gvView.DataSource = _objDataSetBook.Tables[0];
                            gvView.DataBind();
                            GetCancellationPolicy(api);
                            Mail(_objDataSetBook.Tables[0].Rows[0]["EmailId"].ToString());

                            SMS();

                            ViewState["MailId"] = _objDataSetBook.Tables[0].Rows[0]["EmailId"].ToString();
                            ViewState["BookingId"] = _objDataSetBook.Tables[0].Rows[0]["BookingId"].ToString();
                            ViewState["TentativeId"] = _objDataSetBook.Tables[0].Rows[0]["TentativeId"].ToString();

                        }
                    }
                }
            }

        }
        catch (System.Exception ex)
        {
            throw ex;
        }
    }
    protected void CheckPermission(string pageName, string role)
    {
        try
        {
            pnlMain.Visible = true;
            tdmsg.Style.Add("background-color:#E77471;", "");
            lblMainMsg.Text = " No Permission to this page. Please contact Administrator for further details.";
            lblMainMsg.ForeColor = System.Drawing.Color.Maroon;
            tdmsg.Visible = false;
            if (role == "CSE")
            {
                tdmsg.Visible = true;
                tdmsg.Style.Add("background-color:#E77471;", "");
                pnlMain.Visible = false;

                ClsBAL objBAL = new ClsBAL();
                objBAL.ID = Convert.ToInt32(Session["UserID"]);
                objBAL.screenName = pageName;
                DataSet objDataSet = (DataSet)objBAL.GetPerByUser();
                if (objDataSet != null)
                {
                    if (objDataSet.Tables[0].Rows.Count > 0)
                    {
                        ViewState["UserPermissions"] = objDataSet.Tables[0];
                        ViewState["Book"] = objDataSet.Tables[0].Rows[0]["Book"].ToString();
                    }
                    else { ViewState["UserPermissions"] = null; }
                }
                else { ViewState["UserPermissions"] = null; }

                if (ViewState["UserPermissions"] != null)
                {
                    if (ViewState["Book"] != null)
                    {
                        if (ViewState["Book"].ToString() == "1")
                        {
                            pnlMain.Visible = true;
                            tdmsg.Visible = false;
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    void BindData()
    {
        try
        {
            ClsBAL obj = new ClsBAL();
            DataSet ds = obj.GetAgentRequests1();
            gvEmpRequests.DataSource = ds;

            gvEmpRequests.DataBind();
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
            throw;
        }
    }
    protected void CheckPermission(string pageName, string role)
    {
        try
        {
            tblmain.Visible = true;
            tdmsg.Visible = false;
            if (role == "CSE")
            {
                tdmsg.Visible = true;
                tdmsg.Style.Add("background-color:#E77471;", "");
                tblmain.Visible = false;

                ClsBAL objBAL = new ClsBAL();
                objBAL.ID = Convert.ToInt32(Session["UserID"]);
                objBAL.screenName = pageName;
                DataSet objDataSet = (DataSet)objBAL.GetPerByUser();
                if (objDataSet != null)
                {
                    if (objDataSet.Tables[0].Rows.Count > 0)
                    {
                        ViewState["UserPermissions"] = objDataSet.Tables[0];
                        ViewState["Book"] = objDataSet.Tables[0].Rows[0]["Book"].ToString();
                    }
                    else { ViewState["UserPermissions"] = null; }
                }
                else { ViewState["UserPermissions"] = null; }

                if (ViewState["UserPermissions"] != null)
                {
                    if (ViewState["Book"] != null)
                    {
                        if (ViewState["Book"].ToString() == "1")
                        {
                            tblmain.Visible = true;
                            tdmsg.Visible = false;
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    protected void btnSignIn_Click(object sender, EventArgs e)
    {
        try
        {
            ClsBAL obj = new ClsBAL();
            lblMsg.Text = obj.InsertAgentRequest(txtName.Text.ToString(), txtEmailId.Text.ToString(), txtOrganization.Text.ToString(), txtMobileNo.Text.ToString(),
                 txtCity.Text.ToString(), ddlState.SelectedItem.Text.ToString(), txtComments.Text.ToString(), txtDistrict.Text, "", "","","","","","");
            mail();
            txtName.Text = txtEmailId.Text = txtOrganization.Text = txtMobileNo.Text = txtCity.Text = txtComments.Text = "";
            ddlState.SelectedIndex = 0;

        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
            throw;
        }
    }
    protected void btnSignIn_Click(object sender, EventArgs e)
    {
        try
        {
            ClsBAL obj = new ClsBAL();
            lblMsg.Text = obj.InsertAgentRequest(txtName.Text.ToString(), txtEmailId.Text.ToString(), txtOrganization.Text.ToString(), txtMobileNo.Text.ToString(),
                 txtCity.Text.ToString(), ddlState.SelectedItem.Text.ToString(), txtComments.Text.ToString(), txtDistrict.Text, "Agent", Session["UserID"].ToString(), txtAppointmentTime.Text, ddlStatus.SelectedItem.Text, Session["UserName"].ToString(),txtAddress.Text,txtPincode.Text);
          //  mail();
            txtName.Text = txtEmailId.Text = txtOrganization.Text = txtMobileNo.Text = txtCity.Text = txtComments.Text = "";
            ddlState.SelectedIndex = 0;

        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
            throw;
        }
    }
 protected void btnChangePassword_Click(object sender, EventArgs e)
 {
     try
     {
         if (Session["UserID"] != null)
         {
             ClsBAL obj = new ClsBAL();
             string msg = obj.ChangePassword(Convert.ToInt32(Session["UserID"].ToString()), txtPassword.Text.Trim().ToString(), Convert.ToInt32(Session["UserID"].ToString()), txtCurrentPassword.Text.Trim().ToString());
             lblMsg.InnerHtml = msg;
         }
         else { Response.Redirect("~/Default.aspx", false); }
     }
     catch (Exception ex)
     {
         lblMsg.InnerHtml = ex.Message;
         throw;
     }
 }
    protected void btnCoorporate_Click(object sender, EventArgs e)
    {
        try
        {
            ClsBAL obj = new ClsBAL();
            lblCorporate.Text = obj.InsertAgentRequest(txtCorName.Text.ToString(), txtCorEmail.Text.ToString(), txtcorOrganization.Text.ToString(), txtCorMobileNo.Text.ToString(),
                 txtCorCity.Text.ToString(), ddlCorState.SelectedItem.Text.ToString(), txtComments.Text.ToString(), txtCorDist.Text, "coorporate", "", "", "","","","");
            lblCorporate.ForeColor = System.Drawing.Color.Green;
            txtCorName.Text = txtCorEmail.Text = txtcorOrganization.Text = txtCorMobileNo.Text = txtCorCity.Text = txtComments.Text = txtCorDist.Text = "";
            ddlCorState.ClearSelection();

        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
            throw;
        }
    }