protected void Page_Load(object sender, EventArgs e)
    {
        //Making textbox unable to edit
        TextBox1.Attributes.Add("readonly", "readonly");
        TextBox2.Attributes.Add("readonly", "readonly");
//------------------------------------------------------
        PageConn pgcon = new PageConn();

        PageConn.strEnc = "3d70f5cff23ed17ip8H9";
        con             = pgcon.dynconn;
        if (!IsPostBack)
        {
            if (Request.QueryString["id1"] != null)
            {
                string id     = Request.QueryString["id1"].ToString().Replace(" ", "+");
                string idcomp = ClsEncDesc.Decrypted(id.ToString());
                ViewState["id2"] = idcomp.ToString();

                SqlCommand     cmd = new SqlCommand("select * from  CompanyAboutUsInputTBL where ID ='" + ViewState["id2"] + "' ", con);
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                DataTable      dt  = new DataTable();
                sda.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    ViewState["compid"] = dt.Rows[0]["CompanyId"].ToString();

                    // Existingpage();// code for displaying existing company details on textbox1
                    //Proposedpage();// code for displaying existing company details on textbox1
                }
                //con.Close();
                Existingpage();
                Proposedpage();
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlCommand cmdlogin = new SqlCommand("SelectUserLogin", connection);

        cmdlogin.CommandType = CommandType.StoredProcedure;
        cmdlogin.Parameters.Add(new SqlParameter("@UID", SqlDbType.NVarChar));
        cmdlogin.Parameters["@UID"].Value = txtuname.Text;
        cmdlogin.Parameters.Add(new SqlParameter("@CD", SqlDbType.NVarChar));
        cmdlogin.Parameters["@CD"].Value = txtcompanyid.Text;

        cmdlogin.Parameters.Add(new SqlParameter("@Pas", SqlDbType.NVarChar));
        cmdlogin.Parameters["@Pas"].Value = ClsEncDesc.Encrypted(txtpass.Text);

        SqlDataAdapter adplogin    = new SqlDataAdapter(cmdlogin);
        DataTable      dtloginuser = new DataTable();

        adplogin.Fill(dtloginuser);

        if (dtloginuser.Rows.Count > 0)
        {
            pnlsecurityquestion.Visible = true;

            Session["userid"] = dtloginuser.Rows[0]["UserID"].ToString();
        }
        else
        {
            pnlsecurityquestion.Visible = false;
            lblmsg.Text = "wrong username or password.";
        }
    }
Example #3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlCommand cmdlogin = new SqlCommand("SelectUserLogin", connection);

        cmdlogin.CommandType = CommandType.StoredProcedure;
        cmdlogin.Parameters.Add(new SqlParameter("@UID", SqlDbType.NVarChar));
        cmdlogin.Parameters["@UID"].Value = txtuname.Text;
        cmdlogin.Parameters.Add(new SqlParameter("@CD", SqlDbType.NVarChar));
        cmdlogin.Parameters["@CD"].Value = txtcompanyid.Text;

        cmdlogin.Parameters.Add(new SqlParameter("@Pas", SqlDbType.NVarChar));
        cmdlogin.Parameters["@Pas"].Value = ClsEncDesc.Encrypted(txtpass.Text);

        SqlDataAdapter adplogin    = new SqlDataAdapter(cmdlogin);
        DataTable      dtloginuser = new DataTable();

        adplogin.Fill(dtloginuser);

        if (dtloginuser.Rows.Count > 0)
        {
            pnlsecurityquestion.Visible = true;
            Panel2.Visible    = false;
            Session["userid"] = dtloginuser.Rows[0]["UserID"].ToString();
            lblmsg.Text       = "";

            fillquestion1();
            string  strquestion = "Select SecurityQuestionMaster.*,SecurityQuestion.Id as ansid,SecurityQuestion.SequrityQueId,SecurityQuestion.UserId,SecurityQuestion.Answer from SecurityQuestionMaster inner join SecurityQuestion on SecurityQuestionMaster.id = SecurityQuestion.SequrityQueId where SecurityQuestion.UserId = '" + Session["userid"] + "' and SecurityQuestion.QuestionNo='1'";
            DataSet dsquestion  = (DataSet)fillddl(strquestion);
            if (dsquestion.Tables[0].Rows.Count > 0)
            {
                ddlquestion1.SelectedIndex = ddlquestion1.Items.IndexOf(ddlquestion1.Items.FindByValue(dsquestion.Tables[0].Rows[0]["SequrityQueId"].ToString()));
            }

            fillquestion2();

            string  strquestion2 = "Select SecurityQuestionMaster.*,SecurityQuestion.Id as ansid,SecurityQuestion.SequrityQueId,SecurityQuestion.UserId,SecurityQuestion.Answer from SecurityQuestionMaster inner join SecurityQuestion on SecurityQuestionMaster.id = SecurityQuestion.SequrityQueId where SecurityQuestion.UserId = '" + Session["userid"] + "' and SecurityQuestion.QuestionNo='2'";
            DataSet dsquestion2  = (DataSet)fillddl(strquestion2);

            if (dsquestion2.Tables[0].Rows.Count > 0)
            {
                ddlquestion2.SelectedIndex = ddlquestion2.Items.IndexOf(ddlquestion2.Items.FindByValue(dsquestion2.Tables[0].Rows[0]["SequrityQueId"].ToString()));
            }

            fillquestion3();
            string  strquestion3 = "Select SecurityQuestionMaster.*,SecurityQuestion.Id as ansid,SecurityQuestion.SequrityQueId,SecurityQuestion.UserId,SecurityQuestion.Answer from SecurityQuestionMaster inner join SecurityQuestion on SecurityQuestionMaster.id = SecurityQuestion.SequrityQueId where SecurityQuestion.UserId = '" + Session["userid"] + "' and SecurityQuestion.QuestionNo='3'";
            DataSet dsquestion3  = (DataSet)fillddl(strquestion3);


            if (dsquestion3.Tables[0].Rows.Count > 0)
            {
                ddlquestion3.SelectedIndex = ddlquestion3.Items.IndexOf(ddlquestion3.Items.FindByValue(dsquestion3.Tables[0].Rows[0]["SequrityQueId"].ToString()));
            }
        }
        else
        {
            pnlsecurityquestion.Visible = false;
            lblmsg.Text = "Incorrect username or password. Please try again.";
        }
    }
    public static Boolean Usercon(string tablename, string tblforeignkeyid, String countId, string std, string etd, String CID, String Inque)
    {
        PageConn pgcon = new PageConn();

        SqlConnection con = pgcon.dynconn;
        Boolean       ins = true;
        SqlCommand    cmd = new SqlCommand();
        DataTable     dt  = new DataTable();

        SqlCommand cmdt = new SqlCommand();
        DataTable  dtt  = new DataTable();
        // "Select DocumentImageMaster.*,DoucmentMaster.* from DocumentImageMaster inner join DocumentImageMaster.DocumentMasterId=DoucmentMaster.DocumentId where DoucmentMaster.DocumentId='@DocumentId and CID=@CID"
        // "Select DocumentImageMaster.* from DocumentImageMaster where DocumentMasterId='@DocumentId"
        string forkey = "";

        if (tblforeignkeyid.Length > 0)
        {
            forkey = " and  ForeignkeyrecordId='" + ClsEncDesc.Encrypted(tblforeignkeyid) + "'";
        }
        string adf = "Select ClientProductTableMaster.*,ClientProductRecordsAllowed.* from  ClientProductTableMaster inner join ClientProductRecordsAllowed on ClientProductRecordsAllowed.ClientProductTblId=ClientProductTableMaster.Id where TableName='" + ClsEncDesc.Encrypted(tablename) + "' and PricePlanId='" + ClsEncDesc.Encrypted(HttpContext.Current.Session["PriceId"].ToString()) + "'" + forkey;

        cmd = new SqlCommand(adf, PageConn.busclient());
        SqlDataAdapter ad = new SqlDataAdapter(cmd);

        ad.Fill(dt);
        if (dt.Rows.Count > 0)
        {
            string pera = "";

            if (Convert.ToString(dt.Rows[0]["ForeignkeyrecordName"]) != "")
            {
                pera = "and " + ClsEncDesc.Decrypted(Convert.ToString(dt.Rows[0]["ForeignkeyrecordName"])) + "=" + tblforeignkeyid;
            }
            try
            {
                string adrt = "Select Count(" + tablename + "." + countId + ") from  " + Inque + " where " + CID + "='" + HttpContext.Current.Session["Comid"].ToString() + "' " + pera + std + etd;

                cmdt = new SqlCommand(adrt, con);
                SqlDataAdapter adt = new SqlDataAdapter(cmdt);
                adt.Fill(dtt);
                if (Convert.ToString(dtt.Rows[0][0]) != "")
                {
                    string pagerecod = ClsEncDesc.Decrypted(dt.Rows[0]["RecordsAllowed"].ToString());
                    if (Convert.ToInt32(pagerecod) <= Convert.ToInt32(dtt.Rows[0][0]))
                    {
                        ins = false;
                    }
                }
            }
            catch
            {
                ins = true;
            }
        }
        return(ins);
    }
Example #5
0
    public void logindetails()
    {
        string         login = "******" + Session["PartyId"].ToString() + "'";
        SqlCommand     cmd3  = new SqlCommand(login, con);
        SqlDataAdapter da3   = new SqlDataAdapter(cmd3);
        DataTable      dt3   = new DataTable();

        da3.Fill(dt3);
        TextBox12.Text = dt3.Rows[0]["username"].ToString();
        TextBox11.Text = ClsEncDesc.Decrypted(dt3.Rows[0]["password"].ToString());
    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        string     upd    = "Update Login_master Set password='******',username='******' where UserId='" + Session["userid"] + "'";
        SqlCommand cmdupd = new SqlCommand(upd, connection);

        if (connection.State.ToString() != "Open")
        {
            connection.Open();
        }
        cmdupd.ExecuteNonQuery();
        connection.Close();

        string     updateusermaster = "Update User_master set Username='******' where UserID='" + Session["userid"] + "'";
        SqlCommand cmdusermaster    = new SqlCommand(updateusermaster, connection);

        if (connection.State.ToString() != "Open")
        {
            connection.Open();
        }
        cmdusermaster.ExecuteNonQuery();
        connection.Close();

        updateinsertsecurityquestion();


        string  strempcodeid = "select EmployeeMaster.EmployeeMasterID from User_master inner join EmployeeMaster on EmployeeMaster.PartyID=User_master.PartyID  where User_master.UserID = '" + Session["userid"] + "'";
        DataSet dsempcode    = (DataSet)fillddl(strempcodeid);

        if (dsempcode.Tables[0].Rows.Count > 0)
        {
            ViewState["employeeid"] = dsempcode.Tables[0].Rows[0]["EmployeeMasterID"].ToString();

            string     updateempcode  = "Update EmployeeBarcodeMaster set Employeecode='" + txtempcode.Text + "' where Employee_Id='" + ViewState["employeeid"] + "'";
            SqlCommand cmduserempcode = new SqlCommand(updateempcode, connection);
            if (connection.State.ToString() != "Open")
            {
                connection.Open();
            }
            cmduserempcode.ExecuteNonQuery();
            connection.Close();
        }

        lblmsg.Visible = true;
        lblmsg.Text    = "Password updated succesfully";
        pnlsecurityquestion.Visible = false;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //PageConn pgcon = new PageConn();
        //connection = pgcon.dynconn;
        PageConn.strEnc = "3d70f5cff23ed17ip8H9";
        if (!IsPostBack)
        {
            lblmsg.Text = "";
            string str = "SELECT CompanyLoginId from CompanyMaster where Websiteurl='" + Request.Url.Host.ToString() + "' and active='1'";

            SqlCommand     cmd = new SqlCommand(str, licenseconn);
            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();
            adp.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                Session["Comid"] = Convert.ToString(dt.Rows[0]["CompanyLoginId"]);
            }

            string id  = Request.QueryString["to"];
            string id1 = ClsEncDesc.Decrypted(id.ToString().Replace(" ", "+"));
            ViewState["id1"] = id1.ToString();
            string         strmaxid = "Select UserId from PasswordResetRequestTbl where ID='" + id1.ToString() + "'";
            SqlCommand     cmdmax   = new SqlCommand(strmaxid, connection);
            SqlDataAdapter adptmax  = new SqlDataAdapter(cmdmax);
            DataSet        dsmax    = new DataSet();
            adptmax.Fill(dsmax);
            ViewState["maxuserid"] = dsmax.Tables[0].Rows[0]["UserId"].ToString();
            string         str1 = " Select  Distinct CompanyMaster.Compid,CompanyWebsitMaster.MasterEmailId, CompanyWebsitMaster.OutGoingMailServer,CompanyWebsitMaster.WebMasterEmail,CompanyWebsitMaster.EmailMasterLoginPassword, User_master.EmailID,User_master.UserID,CompanyMaster.CompanyLogo,CompanyMaster.CompanyName,CompanyAddressMaster.Email,CompanyAddressMaster.Fax,CompanyAddressMaster.Phone from User_master inner join Party_master on  Party_master.PartyID=User_master.PartyID inner join WareHouseMaster on WareHouseMaster.WareHouseId=Party_master.Whid inner join CompanyMaster on CompanyMaster.Compid=WareHouseMaster.comid inner join CompanyAddressMaster on CompanyAddressMaster.CompanyMasterId=CompanyMaster.CompanyId inner join CompanyWebsitMaster on CompanyWebsitMaster.WHId=WareHouseMaster.WareHouseId where User_master.UserID='" + ViewState["maxuserid"] + "'";
            SqlCommand     cmd1 = new SqlCommand(str1, connection);
            SqlDataAdapter adp1 = new SqlDataAdapter(cmd1);
            DataTable      dt1  = new DataTable();
            adp1.Fill(dt1);
            if (dt1.Rows.Count > 0)
            {
                ViewState["UserID"] = Convert.ToString(dt1.Rows[0]["UserID"]);
                Session["Comid"]    = Convert.ToString(dt1.Rows[0]["Compid"]);
                if (Convert.ToString(dt1.Rows[0]["CompanyLogo"]) != "")
                {
                    img1.ImageUrl = "ShoppingCart/images/" + Convert.ToString(dt1.Rows[0]["CompanyLogo"]);
                }
            }
            fillquestion();
        }
    }
    public string getPageTitle(string PgName)
    {
        PageConn pagecon = new PageConn();

        con = pagecon.dynconn;
        string         str = "Select PageTitle from PageMaster where PageName='" + ClsEncDesc.EncDyn(PgName) + "'";
        SqlCommand     cmd = new SqlCommand(str, PageConn.busclient());
        SqlDataAdapter da  = new SqlDataAdapter(cmd);
        DataTable      dt  = new DataTable();

        da.Fill(dt);
        string pgTitle;

        if (dt.Rows.Count > 0)
        {
            pgTitle = ClsEncDesc.DecDyn(dt.Rows[0]["PageTitle"].ToString());
        }
        else
        {
            pgTitle = "Iwebshop Version1.1";
        }
        return(pgTitle);
    }
    protected void Button6_Click(object sender, EventArgs e)
    {
        int flag2 = attemptcount();

        if (flag2 == 1)
        {
            lbllicensekeyverification.Text = "You have unsuccessfully tried to log in five times. Your account is now locked out for ten minutes.<br/>Please try again after ten minutes.";
        }
        else
        {
            SqlCommand cmdlogin = new SqlCommand("SelectUserLogin", conn);
            cmdlogin.CommandType = CommandType.StoredProcedure;
            cmdlogin.Parameters.Add(new SqlParameter("@UID", SqlDbType.NVarChar));
            cmdlogin.Parameters["@UID"].Value = txtlicensekeyverificationuid.Text;
            cmdlogin.Parameters.Add(new SqlParameter("@CD", SqlDbType.NVarChar));
            cmdlogin.Parameters["@CD"].Value = txtlicensekeyverificationcid.Text;
            cmdlogin.Parameters.Add(new SqlParameter("@Pas", SqlDbType.NVarChar));
            cmdlogin.Parameters["@Pas"].Value = ClsEncDesc.Encrypted(txtlicensekeyverificationpwd.Text);
            SqlDataAdapter adplogin    = new SqlDataAdapter(cmdlogin);
            DataTable      dtloginuser = new DataTable();
            adplogin.Fill(dtloginuser);



            if (dtloginuser.Rows.Count > 0)
            {
                int flag = attemptcount();
                if (flag == 1)
                {
                    lbllicensekeyverification.Text = "You have unsuccessfully tried to log in five times. Your account is now locked out for ten minutes.<br/>Please try again after ten minutes.";
                }
                else
                {
                    Session["userid"] = dtloginuser.Rows[0]["UserID"].ToString();

                    string         strfinal = "select PartytTypeMaster.PartType from User_master inner join Party_master on Party_master.PartyID=User_master.PartyID inner join PartytTypeMaster on PartytTypeMaster.PartyTypeId=Party_master.PartyTypeId  where User_master.UserID='" + Session["userid"] + "' ";
                    SqlDataAdapter adp      = new SqlDataAdapter(strfinal, conn);
                    DataTable      ds       = new DataTable();
                    adp.Fill(ds);

                    if (ds.Rows.Count > 0)
                    {
                        string stradmin = "Admin";
                        if (stradmin == ds.Rows[0]["PartType"].ToString())
                        {
                            pnllicensekeynameoption.Visible = true;
                            lbllicensekeyipaddress.Text     = ViewState["ip"].ToString();

                            string successfull = "1";
                            InsertIpLog(successfull);
                            lblzerocounter.Text            = "0";
                            lbllicensekeyverification.Text = "";
                            Label21.Text = "";
                        }
                        else
                        {
                            pnllicensekeynameoption.Visible = false;
                            lbllicensekeyverification.Text  = "The user ID and password that you have entered is not correct. Please verify the information you have entered and try again.";
                            string successfull = "0";
                            InsertIpLog(successfull);

                            counter();
                        }
                    }
                    else
                    {
                        pnllicensekeynameoption.Visible = false;
                        lbllicensekeyverification.Text  = "The user ID and password that you have entered is not correct. Please verify the information you have entered and try again.";
                        string successfull = "0";
                        InsertIpLog(successfull);
                        counter();
                    }
                }
            }
            else
            {
                pnllicensekeynameoption.Visible = false;
                lbllicensekeyverification.Text  = "The user ID and password that you have entered is not correct. Please verify the information you have entered and try again.";
                string successfull = "0";
                InsertIpLog(successfull);
                counter();
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        int flag2 = attemptcount();

        if (flag2 == 1)
        {
            lblmsg.Text = "You have unsuccessfully tried to log in five times. Your account is now locked out for ten minutes.<br/>Please try again after ten minutes.";
        }
        else
        {
            SqlCommand cmdlogin = new SqlCommand("SelectUserLogin", conn);
            cmdlogin.CommandType = CommandType.StoredProcedure;
            cmdlogin.Parameters.Add(new SqlParameter("@UID", SqlDbType.NVarChar));
            cmdlogin.Parameters["@UID"].Value = txtuserid.Text;
            cmdlogin.Parameters.Add(new SqlParameter("@CD", SqlDbType.NVarChar));
            cmdlogin.Parameters["@CD"].Value = ViewState["cid"].ToString();

            cmdlogin.Parameters.Add(new SqlParameter("@Pas", SqlDbType.NVarChar));
            cmdlogin.Parameters["@Pas"].Value = ClsEncDesc.Encrypted(txtpassword.Text);
            SqlDataAdapter adplogin    = new SqlDataAdapter(cmdlogin);
            DataTable      dtloginuser = new DataTable();
            adplogin.Fill(dtloginuser);


            if (dtloginuser.Rows.Count > 0)
            {
                int flag = attemptcount();
                if (flag == 1)
                {
                    lblmsg.Text = "You have unsuccessfully tried to log in five times. Your account is now locked out for ten minutes.<br/>Please try again after ten minutes.";
                }
                else
                {
                    Session["userid"] = dtloginuser.Rows[0]["UserID"].ToString();

                    string         strfinal = "select PartytTypeMaster.PartType from User_master inner join Party_master on Party_master.PartyID=User_master.PartyID inner join PartytTypeMaster on PartytTypeMaster.PartyTypeId=Party_master.PartyTypeId  where User_master.UserID='" + Session["userid"] + "' ";
                    SqlDataAdapter adp      = new SqlDataAdapter(strfinal, conn);
                    DataTable      ds       = new DataTable();
                    adp.Fill(ds);

                    if (ds.Rows.Count > 0)
                    {
                        string stradmin = "Admin";
                        if (stradmin == ds.Rows[0]["PartType"].ToString())
                        {
                            lblmsg.Text = "";

                            string         strquestion1 = "select SecurityQuestionMaster.* from SecurityQuestion inner join SecurityQuestionMaster on SecurityQuestionMaster.id=SecurityQuestion.SequrityQueId where SecurityQuestion.UserId='" + Session["userid"] + "' and SecurityQuestion.QuestionNo='1' ";
                            SqlDataAdapter adpquestion1 = new SqlDataAdapter(strquestion1, conn);
                            DataTable      dsquestion1  = new DataTable();
                            adpquestion1.Fill(dsquestion1);

                            if (dsquestion1.Rows.Count > 0)
                            {
                                pnlsecurityquestion.Visible = true;
                                lblquestion1.Text           = dsquestion1.Rows[0]["QueName"].ToString();
                                string successfull = "1";
                                InsertIpLog(successfull);

                                lblzerocounter.Text = "0";
                                lblmsg.Text         = "";
                                Label21.Text        = "";
                            }
                            else
                            {
                                pnlsecurityquestion.Visible = false;
                                lblmsg.Text = "Sorry You have set no Security questions /answers , So you can not use this option. Please try other option.";
                                string successfull = "0";
                                InsertIpLog(successfull);
                                counter();
                            }
                        }
                        else
                        {
                            pnlsecurityquestion.Visible = false;
                            lblmsg.Text = "The user ID and password that you have entered is not correct. Please verify the information you have entered and try again.";
                            string successfull = "0";
                            InsertIpLog(successfull);
                            counter();
                        }
                    }


                    else
                    {
                        pnlsecurityquestion.Visible = false;
                        lblmsg.Text = "The user ID and password that you have entered is not correct. Please verify the information you have entered and try again.";
                        string successfull = "0";
                        InsertIpLog(successfull);
                        counter();
                    }
                }
            }
            else
            {
                int flag3 = attemptcount();
                if (flag3 == 1)
                {
                    lblmsg.Text = "You have unsuccessfully tried to log in five times. Your account is now locked out for ten minutes.<br/>Please try again after ten minutes.";;
                }
                else
                {
                    pnlsecurityquestion.Visible = false;
                    lblmsg.Text = "The user ID and password that you have entered is not correct. Please verify the information you have entered and try again.";

                    string successfull = "0";
                    InsertIpLog(successfull);
                    counter();
                }
            }
        }
    }
Example #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageConn pgcon = new PageConn();

        conn = pgcon.dynconn;
        if (!IsPostBack)
        {
            if (Request.QueryString["cid"] != null && Request.QueryString["uid"] != null && Request.QueryString["ip"] != null && Request.QueryString["option"] != null && Request.QueryString["maxid"] != null)
            {
                string cid = ClsEncDesc.Decrypted(Convert.ToString(Request.QueryString["cid"]));
                ViewState["cid"] = cid.ToString();

                string uid = Convert.ToString(Request.QueryString["uid"]);
                ViewState["uid"] = uid.ToString();

                string         stripa = "select Login_master.*,Party_master.Compname from  User_master inner join  Login_master on Login_master.UserID=User_master.UserID inner join Party_master on Party_master.PartyID=User_master.PartyID where Login_master.UserID='" + ViewState["uid"].ToString() + "'  ";
                SqlCommand     cmdipa = new SqlCommand(stripa, conn);
                SqlDataAdapter adpipa = new SqlDataAdapter(cmdipa);
                DataTable      dsipa  = new DataTable();
                adpipa.Fill(dsipa);

                if (dsipa.Rows.Count > 0)
                {
                    ViewState["partyname"] = dsipa.Rows[0]["Compname"].ToString();
                }

                // ViewState["uid"] = uid.ToString();

                string ip = Convert.ToString(Request.QueryString["ip"]);
                ViewState["ip"] = ip.ToString();

                string option = Convert.ToString(Request.QueryString["option"]);
                ViewState["option"] = option.ToString();

                string maxid = (Request.QueryString["maxid"]);
                ViewState["maxid"] = maxid.ToString();

                string         chekeit  = "Select * from Ipaddresschangerequesttbl where Id='" + maxid.ToString() + "' and ipaddresssuceessfullyadded='1'";
                SqlCommand     cmdchek  = new SqlCommand(chekeit, conn);
                SqlDataAdapter adptchek = new SqlDataAdapter(cmdchek);
                DataTable      dtchek   = new DataTable();
                adptchek.Fill(dtchek);
                if (dtchek.Rows.Count > 0)
                {
                    lblmsg1.Text = "You have already added  " + ViewState["ip"].ToString() + " IP address ";
                    lblmsg2.Text = "";
                    lblmsg3.Text = "";
                }
                else
                {
                    string         strhour = "Select * from Ipaddresschangerequesttbl where Id='" + ViewState["maxid"].ToString() + "'";
                    SqlCommand     cmdhour = new SqlCommand(strhour, conn);
                    SqlDataAdapter adphour = new SqlDataAdapter(cmdhour);
                    DataTable      dthour  = new DataTable();
                    adphour.Fill(dthour);

                    TimeSpan t1 = (Convert.ToDateTime(dthour.Rows[0]["datetimeemailgenerated"].ToString()) - Convert.ToDateTime((System.DateTime.Now.ToString())));


                    if (t1.Hours <= -48)
                    {
                        lblmsg1.Text = "You can not use this link as this link is valid up to 48 Hours from the time you you have generated the request. Please do the ip address add process further. ";
                        lblmsg2.Text = "";
                        lblmsg3.Text = "";
                    }

                    else
                    {
                        string         strfinal = "select * from CompanyMaster where Compid='" + cid + "'";
                        SqlDataAdapter adp      = new SqlDataAdapter(strfinal, conn);
                        DataTable      ds       = new DataTable();
                        adp.Fill(ds);
                        if (ds.Rows.Count > 0)
                        {
                            ViewState["CompanyName"] = ds.Rows[0]["CompanyName"].ToString();

                            if (option.ToString() == "0")
                            {
                                pnloptionforcompany.Visible = false;
                                pnloption1user.Visible      = true;
                                lbloption1companyname.Text  = ViewState["CompanyName"].ToString();
                                lbloption1username.Text     = ViewState["uid"].ToString();



                                string         stripmasterid = " select * from IpControlMastertbl where CID='" + ViewState["cid"] + "' ";
                                SqlDataAdapter adpipmasterid = new SqlDataAdapter(stripmasterid, conn);
                                DataTable      dsipmasterid  = new DataTable();
                                adpipmasterid.Fill(dsipmasterid);

                                if (dsipmasterid.Rows.Count > 0)
                                {
                                    string     strinsert = "update Ipaddresschangerequesttbl set datetimeemailverified='" + System.DateTime.Now.ToString() + "' ,verifieduserid='" + ViewState["uid"].ToString() + "',ipaddresssuceessfullyadded='1' where Id='" + ViewState["maxid"].ToString() + "'";
                                    SqlCommand cmdinsert = new SqlCommand(strinsert, conn);
                                    if (conn.State.ToString() != "Open")
                                    {
                                        conn.Open();
                                    }
                                    cmdinsert.ExecuteNonQuery();
                                    conn.Close();



                                    string         strdupliip = " select * from IpControldetailtbl where IpcontrolId='" + dsipmasterid.Rows[0]["IpcontrolId"].ToString() + "' and Cidwise='0' and Userwise='1' and UserId='" + ViewState["uid"].ToString() + "' and Ipaddress='" + ViewState["ip"].ToString() + "'   ";
                                    SqlDataAdapter adpdupliip = new SqlDataAdapter(strdupliip, conn);
                                    DataTable      dsdupliip  = new DataTable();
                                    adpdupliip.Fill(dsdupliip);

                                    if (dsdupliip.Rows.Count > 0)
                                    {
                                        lblmsg1.Text = "The following IP address";
                                        lblmsg2.Text = ViewState["ip"].ToString();
                                        lblmsg3.Text = ", is already on the list of allowed IP addresses to access the website. ";
                                    }
                                    else
                                    {
                                        string insertip = "insert into IpControldetailtbl (IpcontrolId,Cidwise,Userwise,UserId,Ipaddress) values ('" + dsipmasterid.Rows[0]["IpcontrolId"].ToString() + "','0','1','" + ViewState["uid"].ToString() + "','" + ViewState["ip"].ToString() + "')  ";

                                        SqlCommand cmdinsertip = new SqlCommand(insertip, conn);
                                        if (conn.State.ToString() != "Open")
                                        {
                                            conn.Open();
                                        }
                                        cmdinsertip.ExecuteNonQuery();
                                        conn.Close();


                                        lblmsg1.Text = "The following IP address";
                                        lblmsg2.Text = ViewState["ip"].ToString();
                                        lblmsg3.Text = ", has been successfully added to access the website ";

                                        mailgeneteate();
                                    }
                                }
                            }
                            else if (option.ToString() == "1")
                            {
                                pnloptionforcompany.Visible = true;
                                pnloption1user.Visible      = false;

                                lblcompanyname.Text = ViewState["CompanyName"].ToString();


                                string     strinsert = "update Ipaddresschangerequesttbl set datetimeemailverified='" + System.DateTime.Now.ToString() + "' ,verifieduserid='" + ViewState["uid"].ToString() + "',ipaddresssuceessfullyadded='1' where Id='" + ViewState["maxid"].ToString() + "'";
                                SqlCommand cmdinsert = new SqlCommand(strinsert, conn);
                                if (conn.State.ToString() != "Open")
                                {
                                    conn.Open();
                                }
                                cmdinsert.ExecuteNonQuery();
                                conn.Close();

                                string         stripmasterid = " select * from IpControlMastertbl where CID='" + ViewState["cid"] + "' ";
                                SqlDataAdapter adpipmasterid = new SqlDataAdapter(stripmasterid, conn);
                                DataTable      dsipmasterid  = new DataTable();
                                adpipmasterid.Fill(dsipmasterid);

                                if (dsipmasterid.Rows.Count > 0)
                                {
                                    string         strdupliip = " select * from IpControldetailtbl where IpcontrolId='" + dsipmasterid.Rows[0]["IpcontrolId"].ToString() + "' and Cidwise='1' and Userwise='0' and UserId='0' and Ipaddress='" + ViewState["ip"] + "'   ";
                                    SqlDataAdapter adpdupliip = new SqlDataAdapter(strdupliip, conn);
                                    DataTable      dsdupliip  = new DataTable();
                                    adpdupliip.Fill(dsdupliip);

                                    if (dsdupliip.Rows.Count > 0)
                                    {
                                        lblmsg1.Text = "The following IP address";
                                        lblmsg2.Text = ViewState["ip"].ToString();
                                        lblmsg3.Text = ", is already on the list of allowed IP addresses to access the website. ";
                                    }
                                    else
                                    {
                                        string insertip = "insert into IpControldetailtbl (IpcontrolId,Cidwise,Userwise,UserId,Ipaddress) values ('" + dsipmasterid.Rows[0]["IpcontrolId"].ToString() + "','1','0','0','" + ViewState["ip"] + "')  ";

                                        SqlCommand cmdinsertip = new SqlCommand(insertip, conn);
                                        if (conn.State.ToString() != "Open")
                                        {
                                            conn.Open();
                                        }
                                        cmdinsertip.ExecuteNonQuery();
                                        conn.Close();


                                        lblmsg1.Text = "The following IP address";
                                        lblmsg2.Text = ViewState["ip"].ToString();
                                        lblmsg3.Text = ", has been successfully added to access the website ";

                                        mailgeneteate();
                                    }
                                }
                            }
                            else
                            {
                                lblmsg1.Text = "Sorry worng data provided.";
                                lblmsg2.Text = "";
                                lblmsg3.Text = "";
                            }
                        }
                    }
                }
            }
        }
    }
Example #12
0
    public void sendmail(string Toaddress, string username)
    {
        int i = 0;

        try
        {
            string hhhg = "SELECT      Login_master.username, Login_master.password, " +
                          " Login_master.department, Login_master.accesslevel, Login_master.deptid, Login_master.accessid, " +
                          " User_master.Name, Login_master.UserID " +
                          " FROM         Login_master LEFT OUTER JOIN " +
                          " User_master ON Login_master.UserID = User_master.UserID left outer join DepartmentmasterMNC on Login_master.department=DepartmentmasterMNC.Id " +
                          " Where User_master.Name = '" + username.ToString() + "' and  User_master.EmailID='" + Toaddress + "'";
            SqlCommand cm = new SqlCommand(hhhg, con);
            cm.CommandType = CommandType.Text;
            SqlDataAdapter da = new SqlDataAdapter(cm);
            DataTable      ds = new DataTable();
            da.Fill(ds);

            //StringBuilder HeadingTable = new StringBuilder();
            //HeadingTable = (StringBuilder)getSiteAddress();
            StringBuilder HeadingTable = new StringBuilder();
            HeadingTable = (StringBuilder)getSiteAddressWithWh();
            //lblHeading.Text = HeadingTable.ToString();
            //lblHeading.Visible = true;
            // string body = txtBody.Text;

            string AccountInfo = "";
            if (ds.Rows.Count > 0)
            {
                AccountInfo = " <b><span style=\"color: #996600\">ACCOUNT INFORMATION</span></b><br><b>Username:</b>" + Toaddress.ToString() + "<br><b>Password:</b>" + ClsEncDesc.Decrypted(ds.Rows[0]["password"].ToString()) + " ";
            }

            if (RadioButtonList1.SelectedValue == "0")
            {
                lblmsg.Text = " Mail Sent ";
                string welcometext = getWelcometext();
                lblmsg.Text  = " Mail Sent ";
                finalmessage = txtBody.Text;
                body         = "" + HeadingTable + "<br><br> Dear " + ds.Rows[0]["Name"].ToString() + ",<br><br>" + welcometext.ToString() + ",<br><br>" + finalmessage.ToString() + " <br>" + AccountInfo.ToString() + "<br><br><br><br><b> Shopping Cart</b> " +
                               "<br><b>Customer Support</b> " +
                               " <br><br> " +
                               " <span style=\"font-size: 10pt; color: #000000; font-family: Arial\"> " +
                               "Sincerely,</span><br><strong><span style=\"color: #996600\"> " + ViewState["sitename"] + " " +
                               " Team</span></strong>";
            }
            else
            {
                finalmessage = txtBody.Text;
                body         = "" + HeadingTable + "<br><br> Dear " + ds.Rows[0]["Name"].ToString() + ",<br><br>" + finalmessage.ToString() + " <br>" + AccountInfo.ToString() + "<br><br><br><br><b> Shopping Cart</b> " +
                               "<br><b>Customer Support</b> " +
                               " <br><br> " +
                               " <span style=\"font-size: 10pt; color: #000000; font-family: Arial\"> " +
                               "Sincerely,</span><br><strong><span style=\"color: #996600\"> " + ViewState["sitename"] + " " +
                               " Team</span></strong>";
            }
            string strmal = "  SELECT     OutGoingMailServer,WebMasterEmail, EmailMasterLoginPassword, AdminEmail, WHId " +
                            " FROM         CompanyWebsitMaster left outer join CompanyMaster on CompanyWebsitMaster.CompanyId=CompanyMaster.CompanyId WHERE     (WHId = " + Convert.ToInt32(ddlWarehouse.SelectedValue) + ") and CompanyMaster.Compid='" + compid + "' ";
            SqlCommand     cmdma = new SqlCommand(strmal, con);
            SqlDataAdapter adpma = new SqlDataAdapter(cmdma);
            DataTable      dtma  = new DataTable();
            adpma.Fill(dtma);
            if (dtma.Rows.Count > 0)
            {
                string AdminEmail = dtma.Rows[0]["WebMasterEmail"].ToString();         // TextAdminEmail.Text;
                //string AdminEmail = txtusmail.Text;
                String Password = dtma.Rows[0]["EmailMasterLoginPassword"].ToString(); // TextEmailMasterLoginPassword.Text;

                //string body = "Test Mail Server - TestIwebshop";
                MailAddress to   = new MailAddress(Toaddress);
                MailAddress from = new MailAddress(AdminEmail);

                MailMessage objEmail = new MailMessage(from, to);
                objEmail.Subject = txtSubject.Text;

                // if (RadioButtonList1.SelectedValue == "0")
                {
                    objEmail.Body       = body.ToString();
                    objEmail.IsBodyHtml = true;
                }


                objEmail.Priority = MailPriority.High;
                if (ViewState["flag"] != null)
                {
                    Attachment attachFile = new Attachment(Server.MapPath("..\\Attachment\\") + lblfilename.Text);
                    objEmail.Attachments.Add(attachFile);
                }
                SmtpClient client = new SmtpClient();

                client.Credentials = new NetworkCredential(AdminEmail, Password);
                client.Host        = dtma.Rows[0]["OutGoingMailServer"].ToString();

                //client.Credentials = new NetworkCredential(dtma.Rows[0]["AdminEmail"].ToString(), dtma.Rows[0]["EmailMasterLoginPassword"].ToString());//("*****@*****.**", "test");//
                //client.Host = dtma.Rows[0]["OutGoingMailServer"].ToString();
                client.Send(objEmail);
                i += 1;

                lblmsg.Visible = true;
                lblmsg.Text    = i + " Mail Sent ";
            }
            else
            {
                lblmsg.Visible = true;
                lblmsg.Text    = "No Mail Server Available for this Location ";
            }
        }
        catch (Exception tr)
        {
            lblmsg.Visible = true;
            lblmsg.Text    = i + " Mail Sent - " + tr.Message;
        }
    }
Example #13
0
    public void sendmail(string To)
    {
        string         str = " Select  Distinct CompanyMaster.Compid,CompanyWebsitMaster.logourl,CompanyAddressMaster.Website,WareHouseMaster.Name as Wname,CompanyWebsitMaster.MasterEmailId, CompanyWebsitMaster.OutGoingMailServer,CompanyWebsitMaster.WebMasterEmail,CompanyWebsitMaster.EmailMasterLoginPassword, User_master.EmailID,User_master.UserID,CompanyMaster.CompanyLogo,CompanyMaster.CompanyName,CompanyAddressMaster.Address1,CompanyAddressMaster.Address2,CompanyAddressMaster.Email,CompanyAddressMaster.Fax,CompanyAddressMaster.Phone from User_master inner join Party_master on  Party_master.PartyID=User_master.PartyID inner join WareHouseMaster on WareHouseMaster.WareHouseId=Party_master.Whid inner join CompanyMaster on CompanyMaster.Compid=WareHouseMaster.comid inner join CompanyAddressMaster on CompanyAddressMaster.CompanyMasterId=CompanyMaster.CompanyId inner join CompanyWebsitMaster on CompanyWebsitMaster.WHId=WareHouseMaster.WareHouseId where User_master.UserID='" + ViewState["Userid"].ToString() + "'";
        SqlCommand     cmd = new SqlCommand(str, connection);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable      dt  = new DataTable();

        adp.Fill(dt);

        if (dt.Rows.Count > 0)
        {
            string companyid = dt.Rows[0]["Compid"].ToString();

            StringBuilder strhead = new StringBuilder();
            strhead.Append("<table style=\"font-size:14px; font-family:Calibri\" width=\"100%\"> ");
            strhead.Append("<tr><td align=\"left\"> <img src=\"http://" + Request.Url.Host.ToString() + "/Shoppingcart/images/" + Convert.ToString(dt.Rows[0]["logourl"]) + "\" \"border=\"0\" Width=\"176px\" Height=\"106px\" / > </td><td align=\"right\"><b><span style=\"color: #996600\">" + Convert.ToString(dt.Rows[0]["CompanyName"]) + "</span></b><BR>" + Convert.ToString(dt.Rows[0]["Address1"]) + "<BR>" + Convert.ToString(dt.Rows[0]["Address2"]) + "<BR><b>Phone:</b>" + Convert.ToString(dt.Rows[0]["Phone"]) + "<Br><b>Fax:</b>" + Convert.ToString(dt.Rows[0]["Fax"]) + "<Br><b>Email:</b>" + Convert.ToString(dt.Rows[0]["Email"]) + "<Br><b>Website:</b>" + Convert.ToString(dt.Rows[0]["Website"]) + "</td></tr>  ");
            strhead.Append("<br><br></table> ");

            SqlDataAdapter daas = new SqlDataAdapter("select * from Party_master inner join User_master on User_master.PartyID=Party_master.PartyID where User_master.UserID='" + ViewState["Userid"].ToString() + "'", connection);
            DataTable      dtss = new DataTable();
            daas.Fill(dtss);
            string employeenamee = "";
            if (dtss.Rows.Count > 0)
            {
                employeenamee = Convert.ToString(dtss.Rows[0]["Compname"]);
            }

            string body = " <br><br><span style=\"font-size:14px; font-family:Calibri; text-align:left\">Dear " + dt.Rows[0]["Wname"].ToString() + ", </span><br><br> ";
            body = body + "<br><span style=\"font-size:14px; font-family:Calibri; text-align:left\">You have changed your password in the following account:</span><br><br> ";
            body = body + "<table style=\"font-size:14px; font-family:Calibri\"><tr><td><left>Company ID </left></td><td><left>: " + companyid + "</left><br></td></tr>";
            body = body + "<tr><td><left>Username </left></td><td><left>: " + ViewState["username"] + "</left><br></td></tr>";
            body = body + "<tr><td><left>Email ID </left></td><td><left>: " + To + "</left><br></td></tr></table><br>";
            body = body + "<span style=\"font-size:14px; font-family:Calibri; text-align:left\">To Reset your Login information please click <a href=http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/Resetpassworduser.aspx?to=" + ClsEncDesc.Encrypted(ViewState["maxid"].ToString()) + " target=_blank> here</a>, or copy and paste the following link into your browser:</span><br><br>";
            body = body + "<a href=http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/ResetPasswordUser.aspx?to=" + ClsEncDesc.Encrypted(ViewState["maxid"].ToString()) + ">http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/ResetPasswordUser.aspx?to=" + ClsEncDesc.Encrypted(ViewState["maxid"].ToString()) + "</a><br><br>";
            body = body + "<span style=\"font-size:14px; font-family:Calibri; text-align:left\">If you do not want to Reset your Login information, please disregard this email.</span><br><br>";
            body = body + "<span style=\"font-size:14px; font-family:Calibri; text-align:left\">If you have any questions, please contact our technical support team at: [email protected]</span><br>";


            string bodytext = "<br><span style=\"font-size:14px; font-family:Calibri; text-align:left\">Thank you</span><br>";

            StringBuilder support = new StringBuilder();
            support.Append("<table style=\"font-size:14px; font-family:Calibri; text-align:left\" width=\"100%\"> ");
            support.Append("<tr><td align=\"left\"><b><span style=\"color: #996600\">Technical Support Team</span></b><br>" + Convert.ToString(dt.Rows[0]["CompanyName"]) + "<br>" + Convert.ToString(dt.Rows[0]["Address1"]) + "<BR>" + Convert.ToString(dt.Rows[0]["Address2"]) + "<BR><b>Phone:</b>" + Convert.ToString(dt.Rows[0]["Phone"]) + "<Br><b>Fax:</b>" + Convert.ToString(dt.Rows[0]["Fax"]) + "<Br><b>Email:</b>" + Convert.ToString(dt.Rows[0]["Email"]) + "<Br><b>Website:</b>" + Convert.ToString(dt.Rows[0]["Website"]) + "");
            support.Append("<br></table> ");
            string bodyformate = "" + strhead + "<br>" + body + "<br>" + bodytext + "<br>" + support + "";
            try
            {
                string         strdy = " SELECT ClientMaster.OutgoingServerUserID,ClientMaster.OurgoingServerSMTP,ClientMaster.OutgoingServerPassword,ProductMaster.ProductName from CompanyMaster inner join ProductMaster on ProductMaster.ProductId=CompanyMaster.ProductId inner join ClientMaster on ClientMaster.ClientMasterId=ProductMaster.ClientMasterId where CompanyMaster.CompanyLoginId='" + Convert.ToString(dt.Rows[0]["Compid"]) + "'";
                SqlCommand     cmddy = new SqlCommand(strdy, PageConn.licenseconn());
                SqlDataAdapter adpdy = new SqlDataAdapter(cmddy);
                DataTable      dtdy  = new DataTable();
                adpdy.Fill(dtdy);

                if (dtdy.Rows.Count > 0)
                {
                    MailAddress to       = new MailAddress(To);
                    MailAddress from     = new MailAddress(dtdy.Rows[0]["OutgoingServerUserID"].ToString());
                    MailMessage objEmail = new MailMessage(from, to);
                    objEmail.Subject = "Request For Password Reset - " + dt.Rows[0]["Wname"].ToString();

                    objEmail.Body       = bodyformate.ToString();
                    objEmail.IsBodyHtml = true;
                    objEmail.Priority   = MailPriority.High;

                    SmtpClient client = new SmtpClient();
                    client.Credentials = new NetworkCredential(dtdy.Rows[0]["OutgoingServerUserID"].ToString(), dtdy.Rows[0]["OutgoingServerPassword"].ToString());
                    client.Host        = dtdy.Rows[0]["OurgoingServerSMTP"].ToString();
                    client.Send(objEmail);
                    lblmsg.Visible = true;

                    lblmsg.Text = ViewState["Confirmationby"].ToString() + " accepted. A confirmation email has been sent to your email address.";

                    txtuname.Text        = "";
                    ImageButton6.Visible = false;
                }
            }
            catch (Exception e)
            {
                lblmsg.Visible = true;
                lblmsg.Text    = "Error: Failure sending mail.";
                // + e.ToString()
            }
        }
    }
    protected void btnsignin_Click(object sender, EventArgs e)
    {
        Session["Comid"] = txtcompanyid.Text;
        PageConn pgcon = new PageConn();

        con = pgcon.dynconn;
        PageConn.busclient();
        string         str = "select party_master.PartyID,PartytTypeMaster.PartType,User_master.State,party_master. Whid,party_master.Account,party_master. id,Login_master.UserID,Login_master.password,Login_master.username from Party_master inner join User_master on User_master.PartyID=Party_master.PartyID  inner join Login_master on Login_master.UserID = User_master.UserID inner join PartytTypeMaster on  PartytTypeMaster.PartyTypeId=Party_master.PartyTypeId  where (Login_master.username = '******') AND (Login_master.password = '******')and(Party_master.id='" + txtcompanyid.Text + "')";
        SqlCommand     cmd = new SqlCommand(str, con);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataSet        ds  = new DataSet();

        adp.Fill(ds);

        int recordcount = ds.Tables[0].Rows.Count;

        if (recordcount == 0)
        {
            lblError.Text    = "User Name or Password  Incorrect";
            lblError.Visible = true;
        }
        else
        {
            Session["sid"] = ds.Tables[0].Rows[0]["State"].ToString();

            lblError.Visible     = false;
            Session["userid"]    = Convert.ToInt32(ds.Tables[0].Rows[0]["UserID"].ToString());
            Session["Username"]  = txtuname.Text;
            Session["Whid"]      = Convert.ToInt32(ds.Tables[0].Rows[0]["Whid"].ToString());
            Session["PartyID"]   = Convert.ToInt32(ds.Tables[0].Rows[0]["PartyID"].ToString());
            Session["CompanyId"] = Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString());
            Session["PartyId"]   = Convert.ToInt32(ds.Tables[0].Rows[0]["PartyID"].ToString());
            Session["Account"]   = Convert.ToInt32(ds.Tables[0].Rows[0]["Account"].ToString());
            Session["WH"]        = Convert.ToInt32(ds.Tables[0].Rows[0]["Whid"].ToString());
            Session["PartType"]  = Convert.ToInt32(ds.Tables[0].Rows[0]["Whid"].ToString());

            Session["EmployeeId"] = "1850";



            Response.Redirect("PartyAfterLogin.aspx");
        }
    }
    protected void Button1_ClickSyncronice(object sender, EventArgs e)
    {
        ViewState["whid"]  = "1";
        Session["comid"]   = "jobcenter";
        ViewState["comid"] = "jobcenter";
        string         str12 = "select * from Syncr_LicenseEmployee_With_JobcenterId where Jobcenter_Emp_id='" + ViewState["Id"] + "'";
        SqlCommand     cmd1  = new SqlCommand(str12, con_Lice_Job);
        SqlDataAdapter adp1  = new SqlDataAdapter(cmd1);
        DataTable      ds1   = new DataTable();

        adp1.Fill(ds1);
        if (ds1.Rows.Count > 0)
        {
        }
        else
        {
            string         strgetusername = "******";
            SqlCommand     cmdusername    = new SqlCommand(strgetusername, con_Lice_Job);
            SqlDataAdapter adpusername    = new SqlDataAdapter(cmdusername);
            DataTable      dsusername     = new DataTable();
            adpusername.Fill(dsusername);

            if (dsusername.Rows.Count > 0)
            {
                string username;
                string Password;
                int    i = 0;
                int    c = dsusername.Rows.Count + 1;
                username = "******" + c;;
                Password = "******" + dsusername.Rows[0]["PartyID"].ToString() + "++" + c;


                tbUserName.Text = username;
                tbPassword.Text = Password;
            }
            int            flag           = 0;
            string         strusernaemchk = " select * from User_master where Username='******'";
            SqlCommand     cmdusernaemchk = new SqlCommand(strusernaemchk, con_Lice_Job);
            SqlDataAdapter adpusernaemchk = new SqlDataAdapter(cmdusernaemchk);
            DataTable      dsusernaemchk  = new DataTable();
            adpusernaemchk.Fill(dsusernaemchk);

            Session["maxaid"] = "";

            string st153 = "";

            string st1531 = "";
            Session["reportid"]  = "";
            Session["reportid1"] = "";
            ViewState["balid"]   = "";

            string    ins1      = "";
            DataTable datparcat = select("select PartyMasterCategoryNo from PartyMasterCategory where Name='Candidate'");

            if (datparcat.Rows.Count > 0)
            {
                DataTable dtpartytype = select("select PartyTypeId from PartytTypeMaster where compid='" + ViewState["comid"] + "' and PartyCategoryId='" + datparcat.Rows[0]["PartyMasterCategoryNo"].ToString() + "'");
                ViewState["partytypeid"] = dtpartytype.Rows[0]["PartyTypeId"].ToString();
            }


            ins1 = "insert into Party_master(Account,Compname,Contactperson,Address,City,State,Country,Website,GSTno,Incometaxno,Email,Phoneno,DataopID, " +
                   " PartyTypeId,AssignedAccountManagerId,AssignedRecevingDepartmentInchargeId,AssignedPurchaseDepartmentInchargeId,AssignedShippingDepartmentInchargeId,  AssignedSalesDepartmentIncharge,StatusMasterId,Fax,AccountnameID," +
                   " AccountBalanceLimitId,id,Whid,PartyTypeCategoryNo,Zipcode) " +
                   " values ( '" + accid + "','" + txtempname.Text + "','', '','26551','220','222','',  ''  ,'', " +
                   " '" + txtemail.Text + "','" + txtmobileno.Text + "','1', " +
                   " '" + ViewState["partytypeid"] + "' ,'" + 0 + "' ,'" + 0 + "',  '" + 0 + "' , '" + 0 + "' , '" + 0 + "' ,'1' , '' ,'1', " +
                   "'" + ViewState["balid"] + "','" + ViewState["comid"] + "','" + ViewState["whid"] + "','" + datparcat.Rows[0]["PartyMasterCategoryNo"].ToString() + "','" + txtzipcode.Text + "')";


            SqlCommand cmd3 = new SqlCommand(ins1, con_Lice_Job);

            con_Lice_Job.Open();
            cmd3.ExecuteNonQuery();
            con_Lice_Job.Close();

            string sel = "";

            sel = "select max(PartyID) as PartyID from Party_master where Id='" + ViewState["comid"].ToString() + "' and Whid='" + ViewState["whid"] + "'";


            SqlCommand     cmd5 = new SqlCommand(sel, con_Lice_Job);
            SqlDataAdapter da5  = new SqlDataAdapter(cmd5);
            DataSet        ds5  = new DataSet();
            da5.Fill(ds5);

            string phofile = "";

            ViewState["partyidforemail"] = Convert.ToInt32(ds5.Tables[0].Rows[0]["PartyId"].ToString());


            string insdept = "";


            insdept = "Select id from DepartmentmasterMNC where Departmentname='Other' and Whid='" + ViewState["whid"] + "'";


            SqlDataAdapter dadept = new SqlDataAdapter(insdept, con_Lice_Job);
            DataTable      dtdept = new DataTable();
            dadept.Fill(dtdept);

            object dept = "";

            if (dtdept.Rows.Count > 0)
            {
                ViewState["deptid"] = Convert.ToString(dtdept.Rows[0]["id"]);
            }

            else
            {
                SqlCommand cmddept = new SqlCommand("DeptRetIdentity", con_Lice_Job);
                cmddept.CommandType = CommandType.StoredProcedure;
                cmddept.Parameters.AddWithValue("@Departmentname", "Other");
                cmddept.Parameters.AddWithValue("@Companyid", ViewState["comid"].ToString());

                if (Request.QueryString["Id"] != null)
                {
                    cmddept.Parameters.AddWithValue("@Whid", ViewState["whid"]);
                }
                else
                {
                    cmddept.Parameters.AddWithValue("@Whid", ViewState["whid"]);
                }


                cmddept.Parameters.Add(new SqlParameter("@Id", SqlDbType.Int));
                cmddept.Parameters["@Id"].Direction = ParameterDirection.Output;
                cmddept.Parameters.Add(new SqlParameter("@ReturnValue", SqlDbType.Int));
                cmddept.Parameters["@ReturnValue"].Direction = ParameterDirection.ReturnValue;

                if (con_Lice_Job.State.ToString() != "Open")
                {
                    con_Lice_Job.Open();
                }
                dept = (object)cmddept.ExecuteNonQuery();
                dept = cmddept.Parameters["@Id"].Value;
                ViewState["deptid"] = dept;
                con_Lice_Job.Close();
            }


            SqlDataAdapter darole = new SqlDataAdapter("Select Role_id from RoleMaster where Role_name='Candidate' and compid='" + ViewState["comid"].ToString() + "'", con_Lice_Job);
            DataTable      dtrole = new DataTable();
            darole.Fill(dtrole);

            if (dtrole.Rows.Count > 0)
            {
                ViewState["roleid"] = Convert.ToString(dtrole.Rows[0]["Role_id"]);
            }
            else
            {
                SqlCommand cmd3r = new SqlCommand("Insert into RoleMaster (Role_name,ActiveDeactive,compid) values ('Candidate','True','" + ViewState["comid"].ToString() + "')", con_Lice_Job);
                if (con_Lice_Job.State.ToString() != "Open")
                {
                    con_Lice_Job.Open();
                }
                cmd3r.ExecuteNonQuery();
                con_Lice_Job.Close();

                string         strd  = "SELECT  Role_id from RoleMaster WHERE Role_name = 'Candidate' and compid='" + ViewState["comid"].ToString() + "'";
                SqlDataAdapter adrol = new SqlDataAdapter(strd, con_Lice_Job);
                DataTable      dtrol = new DataTable();
                adrol.Fill(dtrol);

                ViewState["roleid"] = Convert.ToString(dtrol.Rows[0]["Role_id"]);
            }

            string         strdesg = "SELECT  DesignationMasterId from DesignationMaster WHERE DesignationName = 'Candidate' and DeptID='" + ViewState["deptid"] + "'";
            SqlDataAdapter dadesg  = new SqlDataAdapter(strdesg, con_Lice_Job);
            DataTable      dtdesg  = new DataTable();
            dadesg.Fill(dtdesg);

            if (dtdesg.Rows.Count > 0)
            {
                ViewState["desgid"] = Convert.ToString(dtdesg.Rows[0]["DesignationMasterId"]);
            }

            else
            {
                SqlCommand cmddegdes = new SqlCommand("Insert into DesignationMaster(DesignationName,DeptID,RoleId) values ('Candidate','" + ViewState["deptid"] + "','" + ViewState["roleid"] + "')", con_Lice_Job);
                if (con_Lice_Job.State.ToString() != "Open")
                {
                    con_Lice_Job.Open();
                }
                cmddegdes.ExecuteNonQuery();
                con_Lice_Job.Close();

                string         strdesg1 = "SELECT  DesignationMasterId from DesignationMaster WHERE DesignationName = 'Candidate' and DeptID='" + ViewState["deptid"] + "'";
                SqlDataAdapter dadesg1  = new SqlDataAdapter(strdesg1, con_Lice_Job);
                DataTable      dtdesg1  = new DataTable();
                dadesg1.Fill(dtdesg1);

                ViewState["desgid"] = Convert.ToString(dtdesg1.Rows[0]["DesignationMasterId"]);
            }

            string strrights = "";



            strrights = "insert into MessageCenterRightsTbl([CompanyID],[BusinessID],[DesignationID],[Business],[AdminRights],[Candidate],[Employee],[Customer],[Vendor],[Others],[Visitor]) values('" + ViewState["comid"].ToString() + "','" + ViewState["whid"] + "','" + ViewState["desgid"].ToString() + "','0','1','0','0','0','0','0','0')";


            SqlCommand cmdrigh = new SqlCommand(strrights, con_Lice_Job);
            if (con_Lice_Job.State.ToString() != "Open")
            {
                con_Lice_Job.Open();
            }
            cmdrigh.ExecuteNonQuery();
            con_Lice_Job.Close();


            SqlDataAdapter daprice = new SqlDataAdapter("select PricePlanId from CompanyMaster where CompanyLoginId='" + ViewState["comid"].ToString() + "'", PageConn.licenseconn());
            DataTable      dtprice = new DataTable();
            daprice.Fill(dtprice);

            if (dtprice.Rows.Count > 0)
            {
                ViewState["priceid"] = Convert.ToString(dtprice.Rows[0]["PricePlanId"]);
            }



            string ins6 = "insert into User_master(Name,Address ,City,State,Country,Phoneno,EmailID ,Username,Department,Accesslevel,PartyID,DesigantionMasterId,Photo,Active,Extention,zipcode)" +
                          " values ('" + txtempname.Text + "','','','','','" + txtphoneno.Text + "','" + txtemail.Text + "','" + tbUserName.Text + "','" + ViewState["deptid"] + "','1','" + Convert.ToInt32(ds5.Tables[0].Rows[0]["PartyId"].ToString()) + "','" + ViewState["desgid"] + "','" + phofile + "' ,'1','','" + txtzipcode.Text + "')";
            SqlCommand cmd6 = new SqlCommand(ins6, con_Lice_Job);

            con_Lice_Job.Open();
            cmd6.ExecuteNonQuery();
            con_Lice_Job.Close();


            string     sel11 = "select max(UserID) as UserID from User_master";
            SqlCommand cmd10 = new SqlCommand(sel11, con_Lice_Job);

            SqlDataAdapter da10 = new SqlDataAdapter(cmd10);

            DataSet ds10 = new DataSet();
            da10.Fill(ds10);


            string     ins7 = "insert into Login_master(UserID,username,password,department,accesslevel,deptid,accessid) values ('" + Convert.ToInt32(ds10.Tables[0].Rows[0]["UserID"]) + "','" + tbUserName.Text + "','" + ClsEncDesc.Encrypted(tbPassword.Text) + "','" + ViewState["deptid"] + "','1','" + ViewState["desgid"] + "','1')";
            SqlCommand cmd9 = new SqlCommand(ins7, con_Lice_Job);
            cmd9.Connection = con_Lice_Job;
            con_Lice_Job.Open();
            cmd9.ExecuteNonQuery();
            con_Lice_Job.Close();

            ViewState["username"] = tbUserName.Text;
            ViewState["password"] = tbPassword.Text;


            string     instrole = "insert into User_Role(User_id,Role_id,ActiveDeactive) values ('" + Convert.ToInt32(ds10.Tables[0].Rows[0]["UserID"]) + "','" + ViewState["roleid"] + "','1')";
            SqlCommand cmdid    = new SqlCommand(instrole, con_Lice_Job);
            cmdid.Connection = con_Lice_Job;
            con_Lice_Job.Open();
            cmdid.ExecuteNonQuery();
            con_Lice_Job.Close();

            string     str112 = "select max(UserID) as userid from Login_master";
            SqlCommand cmd11  = new SqlCommand(str112, con_Lice_Job);

            SqlDataAdapter adp11 = new SqlDataAdapter(cmd11);
            DataTable      ds11  = new DataTable();
            adp11.Fill(ds11);

            int       id   = 0;
            DataTable dtid = new DataTable();

            string iopp = "";
            id = 1;
            string empins = "";


            empins = "Insert into EmployeeMaster(PartyID,DeptID,DesignationMasterId,StatusMasterId,EmployeeTypeId, " +
                     " DateOfJoin,Address,CountryId,StateId,City,ContactNo,Email,AccountId,AccountNo,EmployeeName,Whid,Active,WorkPhone,EducationqualificationID,SpecialSubjectID,yearofexperience,Jobpositionid,sex) " +
                     " values('" + ViewState["partyidforemail"] + "','" + ViewState["deptid"] + "', " +
                     " '" + ViewState["desgid"] + "','','1','" + DateTime.Today + "','','','','', " +
                     " '" + txtmobileno.Text + "','" + txtemail.Text + "','" + id + "','" + accid + "','" + txtempname.Text + "','" + ViewState["whid"] + "','1','','','','','" + ViewState["Jobpositionid"] + "','1')";

            SqlCommand cmdemp = new SqlCommand(empins, con_Lice_Job);
            if (con_Lice_Job.State.ToString() != "Open")
            {
                con_Lice_Job.Open();
            }
            cmdemp.ExecuteNonQuery();
            con_Lice_Job.Close();

            string     str121qq = "select max(EmployeeMasterID) as EmployeeMasterID from EmployeeMaster";
            SqlCommand cmd121qq = new SqlCommand(str121qq, con_Lice_Job);

            SqlDataAdapter adp121qq = new SqlDataAdapter(cmd121qq);
            DataTable      ds121qq  = new DataTable();
            adp121qq.Fill(ds121qq);

            ViewState["emplofff"] = ds121qq.Rows[0]["EmployeeMasterID"].ToString();

            string strware = "";
            strware = "Insert  into EmployeeWarehouseRights (EmployeeId,Whid,AccessAllowed)values('" + ds121qq.Rows[0]["EmployeeMasterID"] + "','" + ViewState["whid"] + "','1')";

            SqlCommand cmd1ware = new SqlCommand(strware, con_Lice_Job);
            if (con_Lice_Job.State.ToString() != "Open")
            {
                con_Lice_Job.Open();
            }
            cmd1ware.ExecuteNonQuery();
            con_Lice_Job.Close();

            string stremp = "";

            ViewState["EducationqualificationID"] = "1007";

            ViewState["SpecialSubjectID"] = "41";

            ViewState["Jobpositionid"] = "4";


            Session["phofile"] = "";
            phofile            = Convert.ToString(Session["phofile"]);

            SqlDataAdapter dacategory = new SqlDataAdapter("select id from CandidateApplicationStatusMaster where PageStatusName='Application received'", con_Lice_Job);
            DataTable      dtcategory = new DataTable();
            dacategory.Fill(dtcategory);

            if (dtcategory.Rows.Count > 0)
            {
                ViewState["StatusMaster"] = dtcategory.Rows[0]["id"].ToString();
            }
            //
            string photopath;

            photopath = "CandidateMale.png";
            stremp    = "Insert into CandidateMaster (PartyID,DeptID,DesignationMasterId,StatusMasterId,EmployeeTypeId,AccountId,AccountNo,CountryId,StateId,City,SuprviserId,EducationqualificationID,SpecialSubjectID,yearofexperience,Jobpositionid,Whid,Compid,Active,LastName,FirstName,MiddleName,CandidateNumber,DOB,CandidatePhotoPath,Address,EffectiveFrom,ContactNo,MobileNo,Sex) " +
                        " values ('" + Convert.ToInt32(ds5.Tables[0].Rows[0]["PartyId"].ToString()) + "','" + ViewState["deptid"] + "','" + ViewState["desgid"] + "','" + ViewState["StatusMaster"] + "','" + "" + "','" + id + "','" + accid + "','' " +
                        " ,'','','" + "" + "','" + ViewState["EducationqualificationID"].ToString() + "','" + ViewState["SpecialSubjectID"].ToString() + "','0','" + ViewState["Jobpositionid"].ToString() + "','" + ViewState["whid"] + "','" + ViewState["comid"].ToString() + "','1','" + txtempname.Text + "','','','" + Convert.ToString(Session["CandidateNumber"]) + "','" + "" + "','" + photopath + "','','" + DateTime.Now.ToShortDateString() + "','" + txtmobileno.Text + "','','1') ";


            SqlCommand cmdemp11 = new SqlCommand(stremp, con_Lice_Job);
            con_Lice_Job.Open();
            cmdemp11.ExecuteNonQuery();
            con_Lice_Job.Close();


            ViewState["PartyMasterId"] = ds5.Tables[0].Rows[0]["PartyId"].ToString();
            Session["userid"]          = ds11.Rows[0]["userid"].ToString();
            Session["username"]        = tbUserName.Text;


            string     str121 = "select max(CandidateId) as EmployeeMasterID from CandidateMaster";
            SqlCommand cmd121 = new SqlCommand(str121, con_Lice_Job);

            SqlDataAdapter adp121 = new SqlDataAdapter(cmd121);
            DataTable      ds121  = new DataTable();
            adp121.Fill(ds121);


            if (ds121.Rows.Count > 0)
            {
                ViewState["EmerEMID"] = ds121.Rows[0]["EmployeeMasterID"].ToString();
            }
            string insert = "";


            insert = "insert into CandidateforFranchiseTBL(CandidateMasterID,RegisteringFranchiseeID,CandidatesPrimaryFranchiseeID,DateandTime,Active)values('" + ViewState["EmerEMID"].ToString() + "','jobcenter','jobcenter','" + DateTime.Now.ToShortDateString() + "','Active')";


            SqlCommand ni = new SqlCommand(insert, con_Lice_Job);
            if (con_Lice_Job.State.ToString() != "Open")
            {
                con_Lice_Job.Open();
            }
            ni.ExecuteNonQuery();
            con_Lice_Job.Close();


            string     insertSyncr = "insert into Syncr_LicenseEmployee_With_JobcenterId(License_Emp_id,Jobcenter_Emp_id)values('" + ViewState["Id"].ToString() + "','" + ViewState["emplofff"].ToString() + "')";
            SqlCommand nisync      = new SqlCommand(insertSyncr, con_Lice_Job);
            if (con_Lice_Job.State.ToString() != "Open")
            {
                con_Lice_Job.Open();
            }
            nisync.ExecuteNonQuery();
            con_Lice_Job.Close();



            // sendmailtoadminforapproval();
            lblmsg.Text    = " sucessfully registered " + tbUserName.Text + "-" + tbPassword.Text;
            lblmsg.Visible = true;
            //clear();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        PageConn pgcon = new PageConn();

        con = pgcon.dynconn;

        if (!IsPostBack)
        {
            Page.Form.Attributes.Add("enctype", "multipart/form-data");

            if (Request.QueryString["Id"] != null)
            {
                DataTable dtname = select("select Name from WarehouseMaster where WarehouseID='" + ClsEncDesc.Decrypted(Request.QueryString["Id"].ToString()) + "'");

                if (dtname.Rows.Count > 0)
                {
                    lblwname.Text = dtname.Rows[0]["Name"].ToString();
                }

                DataTable dtcat = select("select BusinessDetails.BusinessCategory,BusinessDetails.ID,BusinessDetails.year,BusinessDetails.Title,BusinessDetails.kee,BusinessDetails.Corporate,BusinessDetails.Facts,BusinessDetails.noof from BusinessDetails where BusinessDetails.BusinessID='" + ClsEncDesc.Decrypted(Request.QueryString["Id"].ToString()) + "'");

                if (dtcat.Rows.Count > 0)
                {
                    ViewState["IJK"] = dtcat.Rows[0]["ID"].ToString();

                    lblyears.Text     = dtcat.Rows[0]["year"].ToString();
                    lbldetails.Text   = dtcat.Rows[0]["Title"].ToString();
                    lblkey.Text       = dtcat.Rows[0]["kee"].ToString();
                    lblcorporate.Text = dtcat.Rows[0]["Corporate"].ToString();
                    lblfact.Text      = dtcat.Rows[0]["Facts"].ToString();
                    lblnos.Text       = dtcat.Rows[0]["noof"].ToString();

                    if (Convert.ToString(dtcat.Rows[0]["BusinessCategory"]) != "0")
                    {
                        DataTable dtsubsubcat = select("select B_SubCatID,B_SubSubCategory from BusinessSubSubCat where B_SubSubCatID='" + dtcat.Rows[0]["BusinessCategory"].ToString() + "'");

                        DataTable dtsubcat = select("select B_CatID,B_SubCategory from BusinessSubCat where B_SubCatID='" + dtsubsubcat.Rows[0]["B_SubCatID"].ToString() + "'");

                        DataTable dtcat1 = select("select B_Category from BusinessCategory where B_CatID='" + dtsubcat.Rows[0]["B_CatID"].ToString() + "'");

                        lblcategory.Text = dtcat1.Rows[0]["B_Category"].ToString() + " : " + dtsubcat.Rows[0]["B_SubCategory"].ToString() + " : " + dtsubsubcat.Rows[0]["B_SubSubCategory"].ToString();
                    }
                }

                DataTable dtlogo = select("select LogoUrl from CompanyWebsitMaster where whid='" + ClsEncDesc.Decrypted(Request.QueryString["Id"].ToString()) + "'");

                if (dtlogo.Rows.Count > 0)
                {
                    imgLogo.ImageUrl = "~/ShoppingCart/images/" + dtlogo.Rows[0]["LogoUrl"].ToString();
                }

                DataTable dtdetail = select("select CompanyWebsiteAddressMaster.Address1,CompanyWebsiteAddressMaster.Address2,CompanyWebsiteAddressMaster.Zip,CountryMaster.CountryName,StateMasterTbl.StateName,CityMasterTbl.CityName from CompanyWebsiteAddressMaster inner join CountryMaster on CountryMaster.CountryId=CompanyWebsiteAddressMaster.Country inner join StateMasterTbl on StateMasterTbl.StateId=CompanyWebsiteAddressMaster.State inner join CityMasterTbl on CityMasterTbl.CityId=CompanyWebsiteAddressMaster.City where CompanyWebsiteAddressMaster.AddressTypeMasterId='1' and CompanyWebsiteMasterId='" + ClsEncDesc.Decrypted(Request.QueryString["Id"].ToString()) + "'");

                if (dtdetail.Rows.Count > 0)
                {
                    lbladdress.Text = dtdetail.Rows[0]["Address1"].ToString() + "," + dtdetail.Rows[0]["Address2"].ToString();
                    tbZipCode.Text  = dtdetail.Rows[0]["Zip"].ToString();
                    Label18.Text    = dtdetail.Rows[0]["CityName"].ToString();
                    Label17.Text    = dtdetail.Rows[0]["StateName"].ToString();
                    Label16.Text    = dtdetail.Rows[0]["CountryName"].ToString();
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string[] separator1   = new string[] { "." };
        string[] strSplitArr1 = Request.Url.Host.Split(separator1, StringSplitOptions.RemoveEmptyEntries);

        if (strSplitArr1[0].ToString() != "")
        {
            Session["Comid"] = strSplitArr1[0].ToString();
        }
        else
        {
            Session["Comid"] = "jobcenter";
        }
        Session["Comid"] = "jobcenter";
        //Session["Comid"] = "1133";

        PageConn pgcon = new PageConn();

        conn             = pgcon.dynconn;
        connectioninsert = PageConn.UserLog();
        PageConn PCX = new PageConn();

        busiclient = PageConn.busclient();

        string     strdeleteoldest = "delete from NonspecificIpforuser ";
        SqlCommand cmddeleteoldest = new SqlCommand(strdeleteoldest, conn);

        if (conn.State.ToString() != "Open")
        {
            conn.Open();
        }
        cmddeleteoldest.ExecuteNonQuery();


        if (!IsPostBack)
        {
            if (Request.QueryString["ip"] != null && Request.QueryString["maxid"] != null && Request.QueryString["name"] != null)
            {
                string ip = Convert.ToString(Request.QueryString["ip"]);
                ViewState["ip"] = ClsEncDesc.Decrypted(ip.ToString());


                string str = ViewState["ip"].ToString();

                string firsttwo  = str.Substring(0, 2);
                string middletwo = str.Substring(2, str.Length - 4);
                string newonestr = "";
                foreach (char single in middletwo)
                {
                    if (single.ToString() != ":")
                    {
                        newonestr += "*";
                    }
                    else
                    {
                        newonestr += single.ToString();
                    }
                }
                string lasttwo      = str.Substring(str.Length - 2, 2);
                string finaldisplay = firsttwo + newonestr + lasttwo;
                ViewState["finaldisplay"] = finaldisplay.ToString();


                string name = Convert.ToString(Request.QueryString["name"]);
                ViewState["name"] = ClsEncDesc.Decrypted(name.ToString());

                string maxid = (Request.QueryString["maxid"]);
                ViewState["maxid"] = maxid.ToString();



                DataTable dtchek = findmaxidrecord(maxid.ToString());

                if (dtchek.Rows.Count > 0)
                {
                    int requesttype = Convert.ToInt32(dtchek.Rows[0]["Requesttype"].ToString());

                    if (requesttype == 1)
                    {
                        DataTable ipstatus = ipaddressverificationstatus(maxid.ToString());

                        if (ipstatus.Rows.Count > 0)
                        {
                            Label4.Text = "This IP address " + ViewState["finaldisplay"].ToString() + " is already in the list of allowed IP addresses. ";
                        }
                        else
                        {
                            DataTable dtuserdetail = finduserdetail(dtchek.Rows[0]["emailgenerateduserid"].ToString());
                            if (dtuserdetail.Rows.Count > 0)
                            {
                                insertipforuser(dtchek.Rows[0]["emailgenerateduserid"].ToString(), ViewState["ip"].ToString(), ViewState["name"].ToString());
                                mailgeneteate(dtchek.Rows[0]["verifieduserid"].ToString(), dtchek.Rows[0]["emailgenerateduserid"].ToString(), dtuserdetail.Rows[0]["Name"].ToString(), requesttype, dtuserdetail.Rows[0]["Email"].ToString(), dtuserdetail.Rows[0]["Compname"].ToString());
                                Label4.Text  = "You have successfully added the following IP address to the allowed list.";
                                Label2.Text  = dtuserdetail.Rows[0]["Compname"].ToString();
                                Label6.Text  = dtuserdetail.Rows[0]["PartType"].ToString();
                                Label8.Text  = dtuserdetail.Rows[0]["Username"].ToString();
                                Label10.Text = ViewState["finaldisplay"].ToString();
                                Label10.Text = PageMgmt.Decrypted(ViewState["finaldisplay"].ToString());
                            }
                            else
                            {
                            }
                        }
                    }
                    else
                    {
                        DataTable ipstatus = macaddressverificationstatus(maxid.ToString());
                        if (ipstatus.Rows.Count > 0)
                        {
                            Label4.Text = "This computer " + ViewState["finaldisplay"].ToString() + " is already in the list of allowed computers. ";
                        }
                        else
                        {
                            DataTable dtuserdetail = finduserdetail(dtchek.Rows[0]["emailgenerateduserid"].ToString());
                            if (dtuserdetail.Rows.Count > 0)
                            {
                                insertmacforuser(dtchek.Rows[0]["emailgenerateduserid"].ToString(), ViewState["ip"].ToString(), ViewState["name"].ToString());

                                mailgeneteate(dtchek.Rows[0]["verifieduserid"].ToString(), dtchek.Rows[0]["emailgenerateduserid"].ToString(), dtuserdetail.Rows[0]["Name"].ToString(), requesttype, dtuserdetail.Rows[0]["Email"].ToString(), dtuserdetail.Rows[0]["Compname"].ToString());

                                Label4.Text = "You have successfully added the following computer to the allowed list.";

                                Label2.Text  = dtuserdetail.Rows[0]["Compname"].ToString();
                                Label6.Text  = dtuserdetail.Rows[0]["PartType"].ToString();
                                Label8.Text  = dtuserdetail.Rows[0]["Username"].ToString();
                                Label10.Text = ViewState["finaldisplay"].ToString();
                                Label10.Text = PageMgmt.Decrypted(ViewState["finaldisplay"].ToString());
                            }
                            else
                            {
                            }
                        }
                    }
                }
            }
        }
    }
Example #18
0
    public void sendmail()
    {
        string         str21 = "  select distinct  PortalMasterTbl.* from  CompanyMaster inner join PricePlanMaster  on CompanyMaster.PricePlanId=PricePlanMaster.PricePlanId inner join VersionInfoMaster on VersionInfoMaster.VersionInfoId=PricePlanMaster.VersionInfoMasterId inner join ProductMaster on VersionInfoMaster.ProductId=ProductMaster.ProductId inner join ClientMaster on ProductMaster.ClientMasterId=ClientMaster.ClientMasterId inner join Priceplancategory on Priceplancategory.ID=PricePlanMaster.PriceplancatId inner join PortalMasterTbl on PortalMasterTbl.Id=Priceplancategory.PortalId   inner join OrderMaster on CompanyMaster.CompanyLoginId=OrderMaster.CompanyLoginId inner join  OrderPaymentSatus on OrderMaster.OrderId=OrderPaymentSatus.OrderId  inner join StateMasterTbl on StateMasterTbl.StateId=PortalMasterTbl.StateId inner join CountryMaster on StateMasterTbl.CountryId=CountryMaster.CountryId  WHERE(PortalMasterTbl.Id=7)  ";
        SqlCommand     cmd45 = new SqlCommand(str21, PageConn.licenseconn());
        SqlDataAdapter adp45 = new SqlDataAdapter(cmd45);
        DataTable      dt21  = new DataTable();

        adp45.Fill(dt21);

        string aa          = "";
        string bb          = "";
        string cc          = "";
        string ff          = "";
        string ee          = "";
        string dd          = "";
        string ext         = "";
        string tollfree    = "";
        string tollfreeext = "";


        if (Convert.ToString(dt21.Rows[0]["Supportteamphonenoext"].ToString()) != "" && Convert.ToString(dt21.Rows[0]["Supportteamphonenoext"].ToString()) != null)
        {
            ext = "ext " + dt21.Rows[0]["Supportteamphonenoext"].ToString();
        }

        if (Convert.ToString(dt21.Rows[0]["Tollfree"].ToString()) != "" && Convert.ToString(dt21.Rows[0]["Tollfree"].ToString()) != null)
        {
            tollfree = dt21.Rows[0]["Tollfree"].ToString();
        }

        if (Convert.ToString(dt21.Rows[0]["Tollfree"].ToString()) != "" && Convert.ToString(dt21.Rows[0]["Tollfree"].ToString()) != null)
        {
            tollfreeext = "ext " + dt21.Rows[0]["Tollfreeext"].ToString();
        }
        if (dt21.Rows.Count > 0)
        {
            aa = "" + dt21.Rows[0]["Supportteammanagername"].ToString() + "- Support Manager";
            bb = "" + dt21.Rows[0]["PortalName"].ToString() + " ";
            cc = "" + dt21.Rows[0]["Supportteamphoneno"].ToString() + "  " + ext + " ";
            dd = "" + tollfree + " " + tollfreeext + " ";
            ee = "" + dt21.Rows[0]["Portalmarketingwebsitename"].ToString() + "";
        }
        if (dt21.Rows.Count > 0)
        {
            //ViewState["vacid"] = Session["vacanyid"].ToString();
            string file  = "job-center-logo.jpg";
            string body1 = "<br>  <img src=\"http://members.ijobcenter.com/images/" + file + "\" \"border=\"0\" Width=\"90\" Height=\"80\" / > <br>Dear Admin, <br><br>The following message was posted to " + TextBox2.Text + " by " + TextBox1.Text + ". Please review the particulars of the message for authorization.  <br><br>Name: " + TextBox1.Text + " <br>Company Name: " + TextBox2.Text + "<br>Phone No.: " + TextBox3.Text + "<br>Email: " + TextBox4.Text + "<br>Message : " + TextBox5.Text + "<br><br>" +
                           " If you wish to approve this message and permit its posting click <a href=http://www.ijobcenter.com/MessageAuthorizationConfirmation.aspx?id=" + ClsEncDesc.Encrypted(ViewState["id"].ToString()) + " target=_blank > here </a>  or copy and paste the following URL into your internet browser.<br><br>http://www.ijobcenter.com/MessageAuthorizationConfirmation.aspx?id=" + ClsEncDesc.Encrypted(ViewState["id"].ToString()) + " <br><br>If you wish to reject this message and discard its posting click <a href=http://www.ijobcenter.com/MessageAuthorizationConfirmation.aspx?id1=" + ClsEncDesc.Encrypted(ViewState["id"].ToString()) + " target=_blank > here </a>   or copy and paste the following URL into your internet browser.<br><br>http://www.ijobcenter.com/MessageAuthorizationConfirmation.aspx?id1=" + ClsEncDesc.Encrypted(ViewState["id"].ToString()) + " <br><br>Thank you,</span><br><br>IJobCenter Support Team<br>" + aa + "<br>" + bb + "<br>" + cc + "<br>" + ee + "";

            string email       = Convert.ToString(dt21.Rows[0]["UserIdtosendmail"]);
            string displayname = Convert.ToString("IJobCenter");
            string password    = Convert.ToString(dt21.Rows[0]["Password"]);
            string outgo       = Convert.ToString(dt21.Rows[0]["Mailserverurl"]);
            string body        = body1;
            string Subject     = "Enquiry For Ijobcenter";

            MailAddress to       = new MailAddress("*****@*****.**");
            MailAddress from     = new MailAddress(email, displayname);
            MailMessage objEmail = new MailMessage(from, to);
            objEmail.Subject    = Subject.ToString();
            objEmail.Body       = body.ToString();
            objEmail.IsBodyHtml = true;
            objEmail.Priority   = MailPriority.High;
            SmtpClient client = new SmtpClient();
            client.Credentials = new NetworkCredential(email, password);
            client.Host        = outgo;
            client.Send(objEmail);
            clr();
            // Response.Write("<script>alert('Successfully Receive your Message!!')</script> ");
        }
    }
    public void sendmail(string To, string whid, string MasterEmailId, string MasterEmailIdpassword, string OutGoingMailServer, string Displayname, string maxid)
    {
        string         strbus = "select Name from WarehouseMaster where WarehouseID='" + whid.ToString() + "'";
        SqlDataAdapter da     = new SqlDataAdapter(strbus, conn);
        DataTable      dt     = new DataTable();

        da.Fill(dt);

        if (dt.Rows.Count > 0)
        {
            if (Convert.ToString(dt.Rows[0]["Name"]) != "")
            {
                ViewState["buss"] = Convert.ToString(dt.Rows[0]["Name"]);
            }
            else
            {
                ViewState["buss"] = "";
            }
        }

        string         ADDRESSEX = "SELECT distinct CompanyMaster.CompanyLogo, CompanyMaster.CompanyName,CompanyWebsitMaster.Sitename,CompanyWebsitMaster.MasterEmailId,CompanyWebsitMaster.EmailMasterLoginPassword,CompanyWebsitMaster.OutGoingMailServer, CompanyWebsitMaster.EmailSentDisplayName,CompanyWebsitMaster.SiteUrl,CompanyWebsiteAddressMaster.Address1,CompanyWebsiteAddressMaster.Address2,CompanyWebsiteAddressMaster.Phone1, CompanyWebsiteAddressMaster.Phone2, CompanyWebsiteAddressMaster.TollFree1, CompanyWebsiteAddressMaster.Fax,CompanyWebsiteAddressMaster.Email,CompanyMaster.CompanyId,CompanyWebsitMaster.WHid FROM  CompanyMaster LEFT OUTER JOIN AddressTypeMaster RIGHT OUTER JOIN CompanyWebsiteAddressMaster ON AddressTypeMaster.AddressTypeMasterId = CompanyWebsiteAddressMaster.AddressTypeMasterId RIGHT OUTER JOIN CompanyWebsitMaster ON CompanyWebsiteAddressMaster.CompanyWebsiteMasterId = CompanyWebsitMaster.CompanyWebsiteMasterId ON CompanyMaster.CompanyId = CompanyWebsitMaster.CompanyId where CompanyMaster.Compid='" + ViewState["cid"] + "' and WHId='" + whid.ToString() + "'";
        SqlCommand     cmd       = new SqlCommand(ADDRESSEX, conn);
        SqlDataAdapter adp       = new SqlDataAdapter(cmd);
        DataTable      ds        = new DataTable();

        adp.Fill(ds);

        StringBuilder HeadingTable = new StringBuilder();

        HeadingTable.Append("<table width=\"100%\"> ");

        SqlDataAdapter dalogo = new SqlDataAdapter("select logourl from CompanyWebsitMaster where whid='" + whid.ToString() + "'", conn);
        DataTable      dtlogo = new DataTable();

        dalogo.Fill(dtlogo);

        HeadingTable.Append("<tr><td width=\"50%\" style=\"padding-left:10px\" align=\"left\" > <img src=\"../images/" + dtlogo.Rows[0]["logourl"].ToString() + "\" \"border=\"0\" Width=\"200px\" Height=\"125px\" / > </td><td style=\"padding-left:100px\" width=\"50%\" align=\"left\"><b><span style=\"color: #996600\">" + ds.Rows[0]["CompanyName"].ToString() + "</span></b><Br>" + ds.Rows[0]["Address1"].ToString() + "<Br>" + ds.Rows[0]["Address2"].ToString() + "<Br>Toll Free : " + ds.Rows[0]["TollFree1"].ToString() + "<Br>Phone : " + ds.Rows[0]["Phone1"].ToString() + "<Br>Fax :" + ds.Rows[0]["Fax"].ToString() + "<Br>Email :" + ds.Rows[0]["Email"].ToString() + "<Br>Website :" + ds.Rows[0]["SiteUrl"].ToString() + " </td></tr>  ");
        HeadingTable.Append("</table> ");

        string welcometext = getWelcometext();
        string radiooption = "0";
        string AccountInfo = "";

        if (RadioButtonList1.SelectedValue == "0")
        {
            radiooption = "0";
            AccountInfo = " <span style=\"font-size: 10pt; color: #000000; font-family: Arial\"> The user " + ViewState["partyname"].ToString() + "  would like to add the following IP address " + ViewState["ip"] + " to the list of allowed IP addresses for the user only " + ViewState["partyname"].ToString() + ".</span>";
        }
        else
        {
            radiooption = "1";
            AccountInfo = " <span style=\"font-size: 10pt; color: #000000; font-family: Arial\"> The user " + ViewState["partyname"].ToString() + "  would like to add the following IP address " + ViewState["ip"] + " to the list of allowed IP addresses for the whole company " + ViewState["CompanyName"] + ".</span>";
        }
        string currentdate = " <span style=\"font-size: 10pt; color: #000000; font-family: Arial\">" + System.DateTime.Now.ToShortDateString() + " </span>";



        string str1 = " <span style=\"font-size: 10pt; color: #000000; font-family: Arial\"><br><br>If you would like to grant website access from this IP address please click <a href=http://" + Request.Url.Host.ToString() + "/Emailverification.aspx?cid=" + ClsEncDesc.Encrypted(ViewState["cid"].ToString()) + "&uid=" + ViewState["uid"].ToString() + "&ip=" + ViewState["ip"].ToString() + "&option=" + radiooption.ToString() + "&maxid=" + maxid.ToString() + " > here </a></span>.";
        string str2 = "<span style=\"font-size: 10pt; color: #000000; font-family: Arial\"><br><br>Or, copy and paste the below link, into your browser: <br><br>http://" + Request.Url.Host.ToString() + "/Emailverification.aspx?cid=" + ClsEncDesc.Encrypted(ViewState["cid"].ToString()) + "&uid=" + ViewState["uid"].ToString() + "&ip=" + ViewState["ip"].ToString() + "&option=" + radiooption.ToString() + "&maxid=" + maxid.ToString() + " </span>";
        string str3 = "<span style=\"font-size: 10pt; color: #000000; font-family: Arial\"><br><br>If you do not want to proceed with this access, please disregard this email. ";
        string body = "<br>" + HeadingTable + "<br>Dear <strong><span style=\"color: #996600\"> " + ViewState["buss"].ToString() + " </span></strong> ,<br><br>" + welcometext.ToString() + " <br>" + AccountInfo.ToString() + "<br> " + str1 + " <br>" + str2 + " <br><br>" + str3 + " <br> <br> <span style=\"font-size: 10pt; color: #000000; font-family: Arial\"><br>Thank you,<br><br>Security Department<br> " + ViewState["CompanyName"] + "<Br>" + ds.Rows[0]["Address1"].ToString() + "<Br>" + ds.Rows[0]["Address2"].ToString() + "<Br>Toll Free : " + ds.Rows[0]["TollFree1"].ToString() + "<Br>Phone : " + ds.Rows[0]["Phone1"].ToString() + "<Br>Fax :" + ds.Rows[0]["Fax"].ToString() + "<Br>Email :" + ds.Rows[0]["Email"].ToString() + "<Br>Website :" + ds.Rows[0]["SiteUrl"].ToString() + "</span><br><strong><span style=\"color: #996600\"> ";

        MailAddress to       = new MailAddress(To);
        MailAddress from     = new MailAddress("" + MasterEmailId + "", "" + Displayname + "");
        MailMessage objEmail = new MailMessage(from, to);

        objEmail.Subject    = "Request To Add IP Address To Allowed List - " + ViewState["buss"].ToString() + " ";
        objEmail.Body       = body.ToString();
        objEmail.IsBodyHtml = true;
        objEmail.Priority   = MailPriority.Normal;
        SmtpClient client = new SmtpClient();

        client.Credentials = new NetworkCredential("" + MasterEmailId + "", "" + MasterEmailIdpassword + "");
        client.Host        = OutGoingMailServer;
        client.Send(objEmail);
    }
    public void sendmailtoAdmin() // mail send to [email protected] admin
    {
        // Session["Comid"] = "d1989";
        string ADDRESSEX = "";
        string logg      = "";
        string business  = "";

        if (Request.QueryString["Id"] != null)
        {
            ADDRESSEX = "SELECT distinct CompanyMaster.CompanyLogo, CompanyMaster.CompanyName,CompanyWebsitMaster.Sitename,CompanyWebsitMaster.MasterEmailId,CompanyWebsitMaster.EmailMasterLoginPassword,CompanyWebsitMaster.OutGoingMailServer, CompanyWebsitMaster.EmailSentDisplayName,CompanyWebsitMaster.SiteUrl,CompanyWebsiteAddressMaster.Address1,CompanyWebsiteAddressMaster.Address2,CompanyWebsiteAddressMaster.Phone1, CompanyWebsiteAddressMaster.Phone2, CompanyWebsiteAddressMaster.TollFree1, CompanyWebsiteAddressMaster.Fax,CompanyWebsiteAddressMaster.Email,CompanyMaster.CompanyId,CompanyWebsitMaster.WHid FROM  CompanyMaster LEFT OUTER JOIN AddressTypeMaster RIGHT OUTER JOIN CompanyWebsiteAddressMaster ON AddressTypeMaster.AddressTypeMasterId = CompanyWebsiteAddressMaster.AddressTypeMasterId RIGHT OUTER JOIN CompanyWebsitMaster ON CompanyWebsiteAddressMaster.CompanyWebsiteMasterId = CompanyWebsitMaster.CompanyWebsiteMasterId ON CompanyMaster.CompanyId = CompanyWebsitMaster.CompanyId where  WHId='1'";
            ADDRESSEX = "SELECT Id, ProductId, PortalName, DefaultPagename, LogoPath, EmailDisplayname, EmailId, UserIdtosendmail, Password, Mailserverurl, Supportteamemailid, Supportteamphoneno, Supportteammanagername, Portalmarketingwebsitename, Address1, Address2, CountryId, StateId, City, Zip, PhoneNo, Fax, Status, Supportteamphonenoext, Tollfree, Tollfreeext, CompanyCreationOption, DatabaseURL, DatabaseName, PortNo, UserID, UserPassword, PortalRunningCompanyID, Colorportal FROM   dbo.PortalMasterTbl WHERE (ProductId = '2056') AND(Id = '7')";
            logg      = "select LogoUrl from CompanyWebsitMaster where whid='1'";

            business = "select Warehousemaster.Name,CompanyWebsiteAddressMaster.Address1,CompanyWebsiteAddressMaster.Address2,CompanyWebsiteAddressMaster.Phone1,CompanyWebsiteAddressMaster.Email From Warehousemaster inner join CompanyWebsiteAddressMaster on CompanyWebsiteAddressMaster.CompanyWebsiteMasterId=Warehousemaster.WarehouseID where WarehouseID='1'";
        }
        else
        {
            ADDRESSEX = "SELECT distinct CompanyMaster.CompanyLogo, CompanyMaster.CompanyName,CompanyWebsitMaster.Sitename,CompanyWebsitMaster.MasterEmailId,CompanyWebsitMaster.EmailMasterLoginPassword,CompanyWebsitMaster.OutGoingMailServer, CompanyWebsitMaster.EmailSentDisplayName,CompanyWebsitMaster.SiteUrl,CompanyWebsiteAddressMaster.Address1,CompanyWebsiteAddressMaster.Address2,CompanyWebsiteAddressMaster.Phone1, CompanyWebsiteAddressMaster.Phone2, CompanyWebsiteAddressMaster.TollFree1, CompanyWebsiteAddressMaster.Fax,CompanyWebsiteAddressMaster.Email,CompanyMaster.CompanyId,CompanyWebsitMaster.WHid FROM  CompanyMaster LEFT OUTER JOIN AddressTypeMaster RIGHT OUTER JOIN CompanyWebsiteAddressMaster ON AddressTypeMaster.AddressTypeMasterId = CompanyWebsiteAddressMaster.AddressTypeMasterId RIGHT OUTER JOIN CompanyWebsitMaster ON CompanyWebsiteAddressMaster.CompanyWebsiteMasterId = CompanyWebsitMaster.CompanyWebsiteMasterId ON CompanyMaster.CompanyId = CompanyWebsitMaster.CompanyId where WHId='1'";
            ADDRESSEX = " SELECT Id, ProductId, PortalName, DefaultPagename, LogoPath, EmailDisplayname, EmailId, UserIdtosendmail, Password, Mailserverurl, Supportteamemailid, Supportteamphoneno, Supportteammanagername, Portalmarketingwebsitename, Address1, Address2, CountryId, StateId, City, Zip, PhoneNo, Fax, Status, Supportteamphonenoext, Tollfree, Tollfreeext, CompanyCreationOption, DatabaseURL, DatabaseName, PortNo, UserID, UserPassword, PortalRunningCompanyID, Colorportal FROM   dbo.PortalMasterTbl WHERE (ProductId = '2056') AND(Id = '7')";

            logg = "select LogoUrl from CompanyWebsitMaster where whid='1'";

            business = "select Warehousemaster.Name,CompanyWebsiteAddressMaster.Address1,CompanyWebsiteAddressMaster.Address2,CompanyWebsiteAddressMaster.Phone1,CompanyWebsiteAddressMaster.Email From Warehousemaster inner join CompanyWebsiteAddressMaster on CompanyWebsiteAddressMaster.CompanyWebsiteMasterId=Warehousemaster.WarehouseID where WarehouseID='1'";
        }


        SqlCommand     cmd = new SqlCommand(ADDRESSEX, PageConn.licenseconn());
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable      ds  = new DataTable();

        adp.Fill(ds);

        SqlDataAdapter dalog = new SqlDataAdapter(logg, con);
        DataTable      dtlog = new DataTable();

        dalog.Fill(dtlog);

        SqlDataAdapter dabus = new SqlDataAdapter(business, con);
        DataTable      dtbus = new DataTable();

        dabus.Fill(dtbus);

        StringBuilder HeadingTable = new StringBuilder();

        HeadingTable.Append("<table width=\"100%\"> ");

        string file = "job-center-logo-changes 33.png";

        HeadingTable.Append("<tr><td width=\"50%\" style=\" align=\"left\" > <img src=\"http://" + Request.Url.Host.ToString() + "/images/" + file + "\" \"border=\"0\" Width=\"90\" Height=\"80\" / > </td></tr>  ");

        HeadingTable.Append("</table> ");


        //    string loginurl = "";//Request.Url.Host.ToString() + "/Shoppingcart/Admin/ResetPasswordUser.aspx";
        //string accountdetailofparty = "SELECT DISTINCT max(ID)  dbo.VacancyMasterTbl.ID, dbo.VacancyMasterTbl.BusinessID, dbo.VacancyMasterTbl.DesignationID, dbo.VacancyMasterTbl.vacancypositiontypeid, dbo.VacancyMasterTbl.vacancypositiontitleid,                          dbo.VacancyMasterTbl.noofvacancy, dbo.VacancyMasterTbl.startdate, dbo.VacancyMasterTbl.enddate, dbo.VacancyMasterTbl.currencyid, dbo.VacancyMasterTbl.salaryamount,                          dbo.VacancyMasterTbl.salaryperperiodid, dbo.VacancyMasterTbl.worktimings, dbo.VacancyMasterTbl.hours, dbo.VacancyMasterTbl.hoursperperiodid, dbo.VacancyMasterTbl.vacancyftptid,                          dbo.VacancyMasterTbl.status, dbo.VacancyMasterTbl.contactname, dbo.VacancyMasterTbl.contactEmail, dbo.VacancyMasterTbl.contactphoneno, dbo.VacancyMasterTbl.contactAddress,                          dbo.VacancyMasterTbl.applybyemail, dbo.VacancyMasterTbl.applybyphone, dbo.VacancyMasterTbl.applybyvisit, dbo.VacancyMasterTbl.applyonline, dbo.VacancyMasterTbl.countryid,                          dbo.VacancyMasterTbl.stateid, dbo.VacancyMasterTbl.cityid, dbo.VacancyMasterTbl.vacancyduration, dbo.VacancyMasterTbl.comid, dbo.VacancyFTPT.Name AS Term, dbo.VacancyMasterTbl.ID AS candidate,                          dbo.VacancyMasterTbl.ID AS Expr1, CASE WHEN (VacancyMasterTbl.status = '1') THEN 'Active By Ijob' WHEN (VacancyMasterTbl.status = '2') THEN 'Active' ELSE 'Inactive' END AS Statuslabel, CAST(dbo.VacancyMasterTbl.salaryamount AS float) AS salary,                          dbo.SalaryPerPeriodMaster.Name AS sss, LEFT(dbo.VacancyDetailTbl.JobFunction, 100) AS JobFunction, LEFT(dbo.VacancyDetailTbl.QualificationRequirements, 25) AS QualificationRequirements,                          dbo.VacancyDetailTbl.TermsandConditions, dbo.CurrencyMaster.CurrencyName AS ccc, dbo.VacancyFTPT.Name AS vvv, dbo.WareHouseMaster.Name AS wname,                          dbo.DepartmentmasterMNC.Departmentname + ':' + dbo.DesignationMaster.DesignationName AS dname, dbo.VacancyTypeMaster.Name AS vname, dbo.DesignationMaster.DesignationName,                          dbo.DepartmentmasterMNC.Departmentname, dbo.CityMasterTbl.CityName FROM            dbo.VacancyMasterTbl INNER JOIN                          dbo.WareHouseMaster ON dbo.WareHouseMaster.WareHouseId = dbo.VacancyMasterTbl.BusinessID INNER JOIN                         dbo.DesignationMaster ON dbo.DesignationMaster.DesignationMasterId = dbo.VacancyMasterTbl.DesignationID INNER JOIN                         dbo.DepartmentmasterMNC ON dbo.DesignationMaster.DeptID = dbo.DepartmentmasterMNC.id INNER JOIN                         dbo.VacancyTypeMaster ON dbo.VacancyTypeMaster.ID = dbo.VacancyMasterTbl.vacancypositiontypeid INNER JOIN                         dbo.CurrencyMaster ON dbo.CurrencyMaster.CurrencyId = dbo.VacancyMasterTbl.currencyid INNER JOIN                         dbo.VacancyFTPT ON dbo.VacancyFTPT.Id = dbo.VacancyMasterTbl.vacancyftptid INNER JOIN                         dbo.SalaryPerPeriodMaster ON dbo.SalaryPerPeriodMaster.ID = dbo.VacancyMasterTbl.salaryperperiodid INNER JOIN                         dbo.VacancyDetailTbl ON dbo.VacancyMasterTbl.ID = dbo.VacancyDetailTbl.vacancymasterid INNER JOIN                         dbo.CityMasterTbl ON dbo.VacancyMasterTbl.cityid = dbo.CityMasterTbl.CityId where VacancyMasterTbl.comid='" + Session["Comid"] + "' ";
        //SqlCommand cmdpartydetail = new SqlCommand(accountdetailofparty, con);
        //SqlDataAdapter adppartydetail = new SqlDataAdapter(cmdpartydetail);
        //DataTable dspartydetail = new DataTable();

        //adppartydetail.Fill(dspartydetail);

        //string AccountInfo;
        //string Accountdetail = "<br>";

        //AccountInfo = ""; //"The following company has posted a Freelance Project in ijobcenter.com<br> <br><br><b>Vacancy Information: </b><br><br>Company Id: " + Session["comid"] + "<br>Department : " +""+ "<br>Project Name: " +"fgyugfy"+ "<br>Project Duration: " + "uiuhyi9" + "<br> Expected Maximum Project Hours: " + "ftyf" + "<br>";
        //for the position of - " + Label11.Text + <br>You can login to our system to see the status of your job application as well as to contact us.<br>

        //Accountdetail12 = "You may view this listing  click <a href=http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/VacancyDetail.aspx?id=" + Session["vac_MaxId"] + " target=_blank > here </a> Alternatively, you may copy and paste the following URL into your browser <br><br>http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/VacancyDetail.aspx?id=" + Session["vac_MaxId"] + "<br><br><br> ";

        //Accountdetail12 += " Do you wish to Approve this Freelance Project and activate this listing on www.ijobcenter.com?  If yes, click <a href=http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/ApprovalFreelance.aspx?FreelanceIDAcept=" + ClsEncDesc.Encrypted(ViewState["promaxid"].ToString()) + "  target=_blank > Yes </a> Alternatively, Or, " +
        //    " <br> copy and paste the following URL in your browser http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/ApprovalFreelance.aspx?FreelanceIDAcept=" + ClsEncDesc.Encrypted(ViewState["promaxid"].ToString()) + "  ";

        //Accountdetail12 += " <br><br>Do you wish to Reject this Freelance Project If yes, click <a href=http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/ApprovalFreelance.aspx?FreelanceIDReject=" + ClsEncDesc.Encrypted(ViewState["promaxid"].ToString()) + "  target=_blank > Yes </a> Alternatively, Or, " +
        //    " copy and paste the following URL in your browser http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/ApprovalFreelance.aspx?FreelanceIDReject=" + ClsEncDesc.Encrypted(ViewState["promaxid"].ToString()) + "  ";


        string Accountdetail12 = "";

        Accountdetail12 += " " + ViewState["companyname"] + " is requesting that changes be made to their About Us page. You can review the changes and decide whether to approve or reject the requested changes by clicking  <a href=http://www.ijobcenter.com/CompanySiteAboutUsViewforApproval.aspx?id1=" + ClsEncDesc.Encrypted(ViewState["id"].ToString()) + " target=_blank > here </a> or by copy and pasting the following URL into your internet browser.<br/> <br/> www.ijobcenter.com/CompanySiteAboutUsViewforApproval.aspx?id1=" + ClsEncDesc.Encrypted(ViewState["id"].ToString()) + " <br/> </br> <br/> </br> ";


        string ext         = "ext " + ds.Rows[0]["Supportteamphonenoext"].ToString();
        string tollfreeext = "ext " + ds.Rows[0]["Tollfreeext"].ToString();
        string tollfree    = ds.Rows[0]["Tollfree"].ToString();
        string aa          = "" + ds.Rows[0]["Supportteammanagername"].ToString() + "- Support Manager";
        string bb          = "" + ds.Rows[0]["PortalName"].ToString() + " ";
        string cc          = "" + ds.Rows[0]["Supportteamphoneno"].ToString() + "  " + ext + " ";
        string dd          = "" + ds + " " + tollfreeext + " ";
        string ee          = "" + ds.Rows[0]["Portalmarketingwebsitename"].ToString() + "";

        string body = "<br>" + HeadingTable + " Dear <strong><span style=\"color: #996600\"> Admin </span></strong>,<br><br> " + Accountdetail12 + " <br> <span style=\"font-size: 10pt; color: #000000; font-family: Arial\"> " +
                      //   " <br>Thanking you,<br>Sincerely,</span><br><br>Admin Team<br><b>" + dtbus.Rows[0]["Name"].ToString() + "</b><br>" + dtbus.Rows[0]["Address1"].ToString() + "<br>" + dtbus.Rows[0]["Address2"].ToString() + "";
                      " <br>Thanking you, <br>" + aa + "<br>" + bb + "<br>" + cc + "<br>" + ee + "";

        if (ds.Rows[0]["UserIdtosendmail"].ToString() != "" && ds.Rows[0]["Password"].ToString() != "")
        {
            try
            {
                MailAddress to       = new MailAddress("" + ds.Rows[0]["Supportteamemailid"].ToString() + "");
                MailAddress from     = new MailAddress("" + ds.Rows[0]["UserIdtosendmail"] + "", "" + ds.Rows[0]["EmailDisplayname"] + "");
                MailMessage objEmail = new MailMessage(from, to);

                objEmail.Subject = "Company Site About Us Changes Requested";

                objEmail.Body       = body.ToString();
                objEmail.IsBodyHtml = true;
                objEmail.Priority   = MailPriority.Normal;
                SmtpClient client = new SmtpClient();
                client.Credentials = new NetworkCredential("" + ds.Rows[0]["UserIdtosendmail"] + "", "" + ds.Rows[0]["Password"] + "");
                client.Host        = ds.Rows[0]["Mailserverurl"].ToString();

                client.Send(objEmail);
            }
            catch { }
        }
        else
        {
        }
    }
Example #21
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        updateinsertsecurityquestion();

        if (ViewState["Duplication"] == "0")
        {
            if (CheckBox1.Checked == true)
            {
                string     upd    = "Update Login_master Set password='******',username='******' where UserId='" + Session["userid"] + "'";
                SqlCommand cmdupd = new SqlCommand(upd, connection);
                if (connection.State.ToString() != "Open")
                {
                    connection.Open();
                }
                cmdupd.ExecuteNonQuery();
                connection.Close();
            }
            if (CheckBox2.Checked == true)
            {
                string     updateusermaster = "Update User_master set Username='******' where UserID='" + Session["userid"] + "'";
                SqlCommand cmdusermaster    = new SqlCommand(updateusermaster, connection);
                if (connection.State.ToString() != "Open")
                {
                    connection.Open();
                }
                cmdusermaster.ExecuteNonQuery();
                connection.Close();
            }

            if (CheckBox3.Checked == true)
            {
                string  strempcodeid = "select EmployeeMaster.EmployeeMasterID from User_master inner join EmployeeMaster on EmployeeMaster.PartyID=User_master.PartyID  where User_master.UserID = '" + Session["userid"] + "'";
                DataSet dsempcode    = (DataSet)fillddl(strempcodeid);

                if (dsempcode.Tables[0].Rows.Count > 0)
                {
                    ViewState["employeeid"] = dsempcode.Tables[0].Rows[0]["EmployeeMasterID"].ToString();

                    string     updateempcode  = "Update EmployeeBarcodeMaster set Employeecode='" + txtempcode.Text + "' where Employee_Id='" + ViewState["employeeid"] + "'";
                    SqlCommand cmduserempcode = new SqlCommand(updateempcode, connection);
                    if (connection.State.ToString() != "Open")
                    {
                        connection.Open();
                    }
                    cmduserempcode.ExecuteNonQuery();
                    connection.Close();
                }
            }

            txtanswer1.Text = "";
            txtanswer2.Text = "";
            txtanswer3.Text = "";

            lblmsg.Visible = true;
            lblmsg.Text    = "Login information updated successfully.";
            pnlsecurityquestion.Visible = false;
            Panel2.Visible = true;

            Response.Redirect("Shoppingcartlogin.aspx");
        }
        else
        {
            Label4.Visible = true;
            Label4.Text    = "Duplicate question is selected.";
            pnlsecurityquestion.Visible = true;
            Panel2.Visible = false;
        }
    }
Example #22
0
    public void sendmailtoadmin()
    {
        string         str2 = "Select * from  CompanyProductsAndServicesInputTBL where CompanyID='" + Session["Comid"] + "'  and Active='Unapproved'";
        SqlCommand     cmd2 = new SqlCommand(str2, con);
        SqlDataAdapter adp2 = new SqlDataAdapter(cmd2);
        DataTable      ds2  = new DataTable();

        adp2.Fill(ds2);
        string         str3 = "Select * from  CompanyMaster where Compid='" + Session["Comid"] + "' ";
        SqlCommand     cmd3 = new SqlCommand(str3, con);
        SqlDataAdapter adp3 = new SqlDataAdapter(cmd3);
        DataTable      ds3  = new DataTable();

        adp3.Fill(ds3);
        string         str21 = "  select distinct  PortalMasterTbl.* from  CompanyMaster inner join PricePlanMaster  on CompanyMaster.PricePlanId=PricePlanMaster.PricePlanId inner join VersionInfoMaster on VersionInfoMaster.VersionInfoId=PricePlanMaster.VersionInfoMasterId inner join ProductMaster on VersionInfoMaster.ProductId=ProductMaster.ProductId inner join ClientMaster on ProductMaster.ClientMasterId=ClientMaster.ClientMasterId inner join Priceplancategory on Priceplancategory.ID=PricePlanMaster.PriceplancatId inner join PortalMasterTbl on PortalMasterTbl.Id=Priceplancategory.PortalId   inner join OrderMaster on CompanyMaster.CompanyLoginId=OrderMaster.CompanyLoginId inner join  OrderPaymentSatus on OrderMaster.OrderId=OrderPaymentSatus.OrderId inner join StateMasterTbl on StateMasterTbl.StateId=PortalMasterTbl.StateId inner join CountryMaster on StateMasterTbl.CountryId=CountryMaster.CountryId  WHERE(PortalMasterTbl.Id=7)  ";
        SqlCommand     cmd45 = new SqlCommand(str21, PageConn.licenseconn());
        SqlDataAdapter adp45 = new SqlDataAdapter(cmd45);
        DataTable      dt21  = new DataTable();

        adp45.Fill(dt21);

        string aa          = "";
        string bb          = "";
        string cc          = "";
        string ff          = "";
        string ee          = "";
        string dd          = "";
        string ext         = "";
        string tollfree    = "";
        string tollfreeext = "";

        if (dt21.Rows.Count > 0)
        {
            if (Convert.ToString(dt21.Rows[0]["Supportteamphonenoext"].ToString()) != "" && Convert.ToString(dt21.Rows[0]["Supportteamphonenoext"].ToString()) != null)
            {
                ext = "ext " + dt21.Rows[0]["Supportteamphonenoext"].ToString();
            }

            if (Convert.ToString(dt21.Rows[0]["Tollfree"].ToString()) != "" && Convert.ToString(dt21.Rows[0]["Tollfree"].ToString()) != null)
            {
                tollfree = dt21.Rows[0]["Tollfree"].ToString();
            }

            if (Convert.ToString(dt21.Rows[0]["Tollfree"].ToString()) != "" && Convert.ToString(dt21.Rows[0]["Tollfree"].ToString()) != null)
            {
                tollfreeext = "ext " + dt21.Rows[0]["Tollfreeext"].ToString();
            }


            aa = "" + dt21.Rows[0]["Supportteammanagername"].ToString() + "- Support Manager";
            bb = "" + dt21.Rows[0]["PortalName"].ToString() + " ";
            cc = "" + dt21.Rows[0]["Supportteamphoneno"].ToString() + "  " + ext + " ";
            dd = "" + tollfree + " " + tollfreeext + " ";
            ee = "" + dt21.Rows[0]["Portalmarketingwebsitename"].ToString() + "";
            // ff = "" + dt21.Rows[0]["City"].ToString() + " " + dt21.Rows[0]["StateName"].ToString() + " " + dt21.Rows[0]["CountryName"].ToString() + " " + dt21.Rows[0]["Zip"].ToString() + " ";
        }
        // string tomail = //txtConfirmEmail.Text;
        if (dt21.Rows.Count > 0)
        {
            string file = "job-center-logo.jpg";
            // string body1 = "<br>Dear " + dt1.Rows[0][0].ToString() + " <br><br> " + txtmsg.Text + "<br><br> Your security code is: <br> Candidate Secuirity code :" + dt1.Rows[0][2].ToString() + " <br> Test Center Code: " + dt1.Rows[0][3].ToString() + " <br><br> With Regards,<br> IJobcenter ";
            string body1 = "<br>  <img src=\"http://members.ijobcenter.com/images/" + file + "\" \"border=\"0\" Width=\"90\" Height=\"80\" / > <br>Dear Admin, <br><br>" + ViewState["COMPANY"] + " is requesting that changes be made to their Products and Services Input page. You can review the changes and decide whether to approve or reject the requested changes by clicking <a href=http://www.ijobcenter.com/CompanySiteProductandServicesApproval.aspx?comid=" + ClsEncDesc.Encrypted(Session["Comid"].ToString()) + "&id=" + ClsEncDesc.Encrypted(ViewState["productid"].ToString()) + " target=_blank >here </a> or by copy and pasting the following URL into your internet browser.<br><br>http://www.ijobcenter.com/CompanySiteProductandServicesApproval.aspx?comid=" + ClsEncDesc.Encrypted(Session["Comid"].ToString()) + "&id=" + ClsEncDesc.Encrypted(ViewState["productid"].ToString()) + " <br><br><br><br>Thank you,<br>" + aa + "<br>" + bb + "<br>" + cc + "<br>" + ee + "<br>";

            string email       = Convert.ToString(dt21.Rows[0]["UserIdtosendmail"]);
            string displayname = Convert.ToString("IJobCenter");
            string password    = Convert.ToString(dt21.Rows[0]["Password"]);
            string outgo       = Convert.ToString(dt21.Rows[0]["Mailserverurl"]);
            string body        = body1;
            string Subject     = "Approval for new Products and Services details ";


            MailAddress to       = new MailAddress("*****@*****.**");//[email protected]("*****@*****.**");//
            MailAddress from     = new MailAddress(email, displayname);
            MailMessage objEmail = new MailMessage(from, to);
            objEmail.Subject = Subject.ToString();
            objEmail.Body    = body.ToString();


            //string path = "http://members.ijobcenter.com/Account/jobcenter/UploadedDocuments/"+dt15.Rows[0][0].ToString()+"";
            //System.Net.Mail.Attachment attachment;
            //attachment = new System.Net.Mail.Attachment(path);
            //objEmail.Attachments.Add(attachment);

            objEmail.IsBodyHtml = true;
            objEmail.Priority   = MailPriority.High;
            SmtpClient client = new SmtpClient();
            client.Credentials = new NetworkCredential(email, password);
            client.Host        = outgo;
            client.Send(objEmail);
        }
    }
Example #23
0
    protected void ImageButton1_Click(object sender, EventArgs e)
    {
        string strinsert = "insert into PasswordResetRequestTbl(Whid,UserId,RequestTimeanddate,Successful,EmailGenerated,passwordchanged)" +
                           " values('" + ViewState["Whid"] + "','" + ViewState["Userid"] + "','" + System.DateTime.Now.ToString() + "','1','1','0')";
        SqlCommand cmdinsert = new SqlCommand(strinsert, connection);

        if (connection.State.ToString() != "Open")
        {
            connection.Open();
        }
        cmdinsert.ExecuteNonQuery();
        connection.Close();

        string email = ViewState["emailid"].ToString();

        string         strquestion  = "Select SecurityQuestionMaster.*,SecurityQuestion.UserId,SecurityQuestion.Answer from SecurityQuestionMaster inner join SecurityQuestion on SecurityQuestionMaster.id = SecurityQuestion.SequrityQueId where SecurityQuestion.UserId = '" + ViewState["Userid"] + "'";
        SqlCommand     cmdquestion  = new SqlCommand(strquestion, connection);
        SqlDataAdapter adptquestion = new SqlDataAdapter(cmdquestion);
        DataSet        dsquestion   = new DataSet();

        adptquestion.Fill(dsquestion);

        if (dsquestion.Tables[0].Rows.Count > 0)
        {
            string ans1 = dsquestion.Tables[0].Rows[0]["Answer"].ToString();
            string ans2 = dsquestion.Tables[0].Rows[1]["Answer"].ToString();
            string ans3 = dsquestion.Tables[0].Rows[2]["Answer"].ToString();


            if (ans1 == txtans1.Text && ans2 == txtans2.Text && ans3 == txtans3.Text)
            {
                DateTime       datet    = DateTime.Now.AddMinutes(-10);
                string         chekeit  = "Select * from PasswordResetRequestTbl where UserId='" + ViewState["Userid"] + "' and   RequestTimeanddate Between   CAST('" + datet + "'as Datetime) and  CAST('" + DateTime.Now.ToString() + "' as Datetime)";
                SqlCommand     cmdchek  = new SqlCommand(chekeit, connection);
                SqlDataAdapter adptchek = new SqlDataAdapter(cmdchek);
                DataTable      dtchek   = new DataTable();
                adptchek.Fill(dtchek);
                if (dtchek.Rows.Count > 5)
                {
                    lblmsg.Text = "You have attempted 5 times in last 10 minutes so this facility is blocked for 15 minutes,you can try after sometime";
                }
                else
                {
                    string         maxid = "select MAX(ID) as ID from PasswordResetRequestTbl where UserId='" + ViewState["Userid"] + "'";
                    SqlCommand     cmd   = new SqlCommand(maxid, connection);
                    SqlDataAdapter adpt  = new SqlDataAdapter(cmd);
                    DataSet        ds    = new DataSet();
                    adpt.Fill(ds);

                    ViewState["maxid"] = ds.Tables[0].Rows[0]["ID"].ToString();

                    if (email != "")
                    {
                        sendmail(email);

                        Panel2.Visible       = false;
                        Panel1.Visible       = false;
                        ImageButton6.Visible = false;

                        Response.Redirect("http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/ResetPassword.aspx?to=" + ClsEncDesc.Encrypted(ViewState["maxid"].ToString()) + "");
                    }
                    else
                    {
                        Panel2.Visible       = false;
                        Panel1.Visible       = false;
                        ImageButton6.Visible = false;

                        lblmsg.Text = "As no Email is set, Email Notification is not sent.";

                        Response.Redirect("http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/ResetPassword.aspx?to=" + ClsEncDesc.Encrypted(ViewState["maxid"].ToString()) + "");
                    }
                }
            }
            else
            {
                lblmsg.Text = "Your answer is incorrect kindly try to answer again";
            }
        }
        else
        {
            string         maxid = "select MAX(ID) as ID from PasswordResetRequestTbl where UserId='" + ViewState["Userid"] + "'";
            SqlCommand     cmd   = new SqlCommand(maxid, connection);
            SqlDataAdapter adpt  = new SqlDataAdapter(cmd);
            DataSet        ds    = new DataSet();
            adpt.Fill(ds);
            ViewState["maxid"] = ds.Tables[0].Rows[0]["ID"].ToString();
            sendmail(email);

            Panel2.Visible       = false;
            Panel1.Visible       = false;
            ImageButton6.Visible = false;
        }
    }
Example #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageConn pgcon = new PageConn();

        connection = pgcon.dynconn;

        if (!IsPostBack)
        {
            if (Request.QueryString["to"] != null)
            {
                string str = "SELECT CompanyLoginId from CompanyMaster where Websiteurl='" + Request.Url.Host.ToString() + "' and active='1'";

                SqlCommand     cmd = new SqlCommand(str, PageConn.licenseconn());
                SqlDataAdapter adp = new SqlDataAdapter(cmd);
                DataTable      dt  = new DataTable();
                adp.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    Session["Comid"] = Convert.ToString(dt.Rows[0]["CompanyLoginId"]);
                }

                string         strmaxid = "Select UserId from PasswordResetRequestTbl where ID='" + ClsEncDesc.Decrypted(Request.QueryString["to"]) + "'";
                SqlCommand     cmdmax   = new SqlCommand(strmaxid, connection);
                SqlDataAdapter adptmax  = new SqlDataAdapter(cmdmax);
                DataSet        dsmax    = new DataSet();
                adptmax.Fill(dsmax);

                if (dsmax.Tables[0].Rows.Count > 0)
                {
                    ViewState["maxuserid"] = Convert.ToInt32(dsmax.Tables[0].Rows[0]["UserId"]);
                }
                string         str1 = " Select  Distinct CompanyMaster.Compid,CompanyWebsitMaster.MasterEmailId, CompanyWebsitMaster.OutGoingMailServer,CompanyWebsitMaster.WebMasterEmail,CompanyWebsitMaster.EmailMasterLoginPassword, User_master.EmailID,User_master.UserID,CompanyMaster.CompanyLogo,CompanyMaster.CompanyName,CompanyAddressMaster.Email,CompanyAddressMaster.Fax,CompanyAddressMaster.Phone from User_master inner join Party_master on  Party_master.PartyID=User_master.PartyID inner join WareHouseMaster on WareHouseMaster.WareHouseId=Party_master.Whid inner join CompanyMaster on CompanyMaster.Compid=WareHouseMaster.comid inner join CompanyAddressMaster on CompanyAddressMaster.CompanyMasterId=CompanyMaster.CompanyId inner join CompanyWebsitMaster on CompanyWebsitMaster.WHId=WareHouseMaster.WareHouseId where User_master.UserID='" + ViewState["maxuserid"] + "'";
                SqlCommand     cmd1 = new SqlCommand(str1, connection);
                SqlDataAdapter adp1 = new SqlDataAdapter(cmd1);
                DataTable      dt1  = new DataTable();
                adp1.Fill(dt1);
                if (dt1.Rows.Count > 0)
                {
                    ViewState["UserID"] = Convert.ToString(dt1.Rows[0]["UserID"]);
                    Session["Comid"]    = Convert.ToString(dt1.Rows[0]["Compid"]);
                    if (Convert.ToString(dt1.Rows[0]["CompanyLogo"]) != "")
                    {
                        img1.ImageUrl = "ShoppingCart/images/" + Convert.ToString(dt1.Rows[0]["CompanyLogo"]);
                    }
                }

                pnlsecurityquestion.Visible = true;
                Panel2.Visible = false;

                fillquestion1();
                string  strquestion = "Select SecurityQuestionMaster.*,SecurityQuestion.Id as ansid,SecurityQuestion.SequrityQueId,SecurityQuestion.UserId,SecurityQuestion.Answer from SecurityQuestionMaster inner join SecurityQuestion on SecurityQuestionMaster.id = SecurityQuestion.SequrityQueId where SecurityQuestion.UserId = '" + Session["userid"] + "' and SecurityQuestion.QuestionNo='1'";
                DataSet dsquestion  = (DataSet)fillddl(strquestion);
                if (dsquestion.Tables[0].Rows.Count > 0)
                {
                    ddlquestion1.SelectedIndex = ddlquestion1.Items.IndexOf(ddlquestion1.Items.FindByValue(dsquestion.Tables[0].Rows[0]["SequrityQueId"].ToString()));
                }

                fillquestion2();

                string  strquestion2 = "Select SecurityQuestionMaster.*,SecurityQuestion.Id as ansid,SecurityQuestion.SequrityQueId,SecurityQuestion.UserId,SecurityQuestion.Answer from SecurityQuestionMaster inner join SecurityQuestion on SecurityQuestionMaster.id = SecurityQuestion.SequrityQueId where SecurityQuestion.UserId = '" + Session["userid"] + "' and SecurityQuestion.QuestionNo='2'";
                DataSet dsquestion2  = (DataSet)fillddl(strquestion2);

                if (dsquestion2.Tables[0].Rows.Count > 0)
                {
                    ddlquestion2.SelectedIndex = ddlquestion2.Items.IndexOf(ddlquestion2.Items.FindByValue(dsquestion2.Tables[0].Rows[0]["SequrityQueId"].ToString()));
                }

                fillquestion3();
                string  strquestion3 = "Select SecurityQuestionMaster.*,SecurityQuestion.Id as ansid,SecurityQuestion.SequrityQueId,SecurityQuestion.UserId,SecurityQuestion.Answer from SecurityQuestionMaster inner join SecurityQuestion on SecurityQuestionMaster.id = SecurityQuestion.SequrityQueId where SecurityQuestion.UserId = '" + Session["userid"] + "' and SecurityQuestion.QuestionNo='3'";
                DataSet dsquestion3  = (DataSet)fillddl(strquestion3);


                if (dsquestion3.Tables[0].Rows.Count > 0)
                {
                    ddlquestion3.SelectedIndex = ddlquestion3.Items.IndexOf(ddlquestion3.Items.FindByValue(dsquestion3.Tables[0].Rows[0]["SequrityQueId"].ToString()));
                }
            }
            else if (Request.QueryString["cid"] != null && Request.QueryString["uid"] != null && Request.QueryString["pwd"] != null)
            {
                string cid = Convert.ToString(Request.QueryString["cid"]);
                string uid = Convert.ToString(Request.QueryString["uid"]);
                string pwd = Convert.ToString(Request.QueryString["pwd"]);

                Session["Comid"] = cid;

                PageConn pgcon1 = new PageConn();
                connection1 = pgcon1.dynconn;

                pwd = ClsEncDesc.Decrypted(pwd);

                SqlCommand cmdlogin = new SqlCommand("SelectUserLogin", connection1);
                cmdlogin.CommandType = CommandType.StoredProcedure;
                cmdlogin.Parameters.Add(new SqlParameter("@UID", SqlDbType.NVarChar));
                cmdlogin.Parameters["@UID"].Value = uid;
                cmdlogin.Parameters.Add(new SqlParameter("@CD", SqlDbType.NVarChar));
                cmdlogin.Parameters["@CD"].Value = cid;
                cmdlogin.Parameters.Add(new SqlParameter("@Pas", SqlDbType.NVarChar));
                cmdlogin.Parameters["@Pas"].Value = ClsEncDesc.Encrypted(pwd);

                SqlDataAdapter adplogin    = new SqlDataAdapter(cmdlogin);
                DataTable      dtloginuser = new DataTable();
                adplogin.Fill(dtloginuser);

                if (dtloginuser.Rows.Count > 0)
                {
                    panelforcandidate.Visible   = false;
                    pnlsecurityquestion.Visible = true;
                    Panel2.Visible    = false;
                    Session["userid"] = dtloginuser.Rows[0]["UserID"].ToString();
                    lblmsg.Text       = "";

                    fillquestion111();

                    string  strquestion = "Select SecurityQuestionMaster.*,SecurityQuestion.Id as ansid,SecurityQuestion.SequrityQueId,SecurityQuestion.UserId,SecurityQuestion.Answer from SecurityQuestionMaster inner join SecurityQuestion on SecurityQuestionMaster.id = SecurityQuestion.SequrityQueId where SecurityQuestion.UserId = '" + Session["userid"] + "' and SecurityQuestion.QuestionNo='1'";
                    DataSet dsquestion  = (DataSet)fillddl123(strquestion);
                    if (dsquestion.Tables[0].Rows.Count > 0)
                    {
                        ddlquestion1.SelectedIndex = ddlquestion1.Items.IndexOf(ddlquestion1.Items.FindByValue(dsquestion.Tables[0].Rows[0]["SequrityQueId"].ToString()));
                    }

                    fillquestion222();

                    string  strquestion2 = "Select SecurityQuestionMaster.*,SecurityQuestion.Id as ansid,SecurityQuestion.SequrityQueId,SecurityQuestion.UserId,SecurityQuestion.Answer from SecurityQuestionMaster inner join SecurityQuestion on SecurityQuestionMaster.id = SecurityQuestion.SequrityQueId where SecurityQuestion.UserId = '" + Session["userid"] + "' and SecurityQuestion.QuestionNo='2'";
                    DataSet dsquestion2  = (DataSet)fillddl123(strquestion2);

                    if (dsquestion2.Tables[0].Rows.Count > 0)
                    {
                        ddlquestion2.SelectedIndex = ddlquestion2.Items.IndexOf(ddlquestion2.Items.FindByValue(dsquestion2.Tables[0].Rows[0]["SequrityQueId"].ToString()));
                    }

                    fillquestion333();

                    string  strquestion3 = "Select SecurityQuestionMaster.*,SecurityQuestion.Id as ansid,SecurityQuestion.SequrityQueId,SecurityQuestion.UserId,SecurityQuestion.Answer from SecurityQuestionMaster inner join SecurityQuestion on SecurityQuestionMaster.id = SecurityQuestion.SequrityQueId where SecurityQuestion.UserId = '" + Session["userid"] + "' and SecurityQuestion.QuestionNo='3'";
                    DataSet dsquestion3  = (DataSet)fillddl123(strquestion3);

                    if (dsquestion3.Tables[0].Rows.Count > 0)
                    {
                        ddlquestion3.SelectedIndex = ddlquestion3.Items.IndexOf(ddlquestion3.Items.FindByValue(dsquestion3.Tables[0].Rows[0]["SequrityQueId"].ToString()));
                    }
                }
                else
                {
                    pnlsecurityquestion.Visible = false;
                    lblmsg.Text = "Incorrect username or password. Please try again.";
                }
            }
            else
            {
                pnlsecurityquestion.Visible = false;
                Panel2.Visible = true;
            }
        }
    }
 protected void Timekeepingfillpageaccesscheck()
 {
     try
     {
         DataTable drt = selectbusdy("SELECT distinct " + PageConn.busdatabase + ".dbo.RoleMenuAccessRightTbl.MenuId,PageMaster.PageName FROM MainMenuMaster inner join " + PageConn.busdatabase + ".dbo.RoleMenuAccessRightTbl on " + PageConn.busdatabase + ".dbo.RoleMenuAccessRightTbl.MenuId=MainMenuMaster.MainMenuId inner join PageMaster on PageMaster.MainMenuId=" + PageConn.busdatabase + ".dbo.RoleMenuAccessRightTbl.MenuId  inner join pageplaneaccesstbl on pageplaneaccesstbl.Pageid=PageMaster.PageId  INNER JOIN  " + PageConn.busdatabase + ".dbo.User_Role ON " + PageConn.busdatabase + ".dbo.RoleMenuAccessRightTbl.RoleId = " + PageConn.busdatabase + ".dbo.User_Role.Role_id INNER JOIN " + PageConn.busdatabase + ".dbo.User_master ON " + PageConn.busdatabase + ".dbo.User_Role.User_id = " + PageConn.busdatabase + ".dbo.User_master.UserID where pageplaneaccesstbl.Priceplanid='" + ClsEncDesc.EncDyn(Session["PriceId"].ToString()) + "' and PageMaster.PageName='timekeepingafterlogin.aspx' and PageMaster.VersionInfoMasterId='" + ClsEncDesc.EncDyn(Session["verId"].ToString()) + "' and  " + PageConn.busdatabase + ".dbo.User_master.UserID ='" + Session["userid"] + "'");
         if (drt.Rows.Count <= 0)
         {
             drt = selectbusdy("SELECT PageMaster.PageName FROM PageMaster inner join " + PageConn.busdatabase + ".dbo.RolePageAccessRightTbl on " + PageConn.busdatabase + ".dbo.RolePageAccessRightTbl.PageId=PageMaster.PageId inner join pageplaneaccesstbl on pageplaneaccesstbl.Pageid=PageMaster.PageId INNER JOIN " + PageConn.busdatabase + ".dbo.User_Role ON " + PageConn.busdatabase + ".dbo.RolePageAccessRightTbl.RoleId = " + PageConn.busdatabase + ".dbo.User_Role.Role_id INNER JOIN " + PageConn.busdatabase + ".dbo.User_master ON " + PageConn.busdatabase + ".dbo.User_Role.User_id = " + PageConn.busdatabase + ".dbo.User_master.UserID where pageplaneaccesstbl.Priceplanid='" + Session["PriceId"] + "' and PageMaster.PageName='timekeepingafterlogin.aspx' and PageMaster.VersionInfoMasterId='" + ClsEncDesc.EncDyn(Session["verId"].ToString()) + "' and  " + PageConn.busdatabase + ".dbo.User_master.UserID ='" + Session["userid"] + "'");
             if (drt.Rows.Count <= 0)
             {
                 drt = selectbusdy("SELECT distinct PageMaster.PageName FROM MainMenuMaster inner join  SubMenuMaster on SubMenuMaster.MainMenuId=MainMenuMaster.MainMenuId inner join " + PageConn.busdatabase + ".dbo.RoleSubMenuAccessRightTbl on " + PageConn.busdatabase + ".dbo.RoleSubMenuAccessRightTbl.SubMenuId=SubMenuMaster.SubMenuId inner join PageMaster on PageMaster.SubMenuId=" + PageConn.busdatabase + ".dbo.RoleSubMenuAccessRightTbl.SubMenuId  inner join pageplaneaccesstbl on pageplaneaccesstbl.Pageid=PageMaster.PageId  INNER JOIN  " + PageConn.busdatabase + ".dbo.User_Role ON " + PageConn.busdatabase + ".dbo.RoleSubMenuAccessRightTbl.RoleId = " + PageConn.busdatabase + ".dbo.User_Role.Role_id INNER JOIN " + PageConn.busdatabase + ".dbo.User_master ON " + PageConn.busdatabase + ".dbo.User_Role.User_id = " + PageConn.busdatabase + ".dbo.User_master.UserID where pageplaneaccesstbl.Priceplanid='" + ClsEncDesc.EncDyn(Session["PriceId"].ToString()) + "' and PageMaster.PageName='timekeepingafterlogin.aspx' and PageMaster.VersionInfoMasterId='" + ClsEncDesc.EncDyn(Session["verId"].ToString()) + "' and  " + PageConn.busdatabase + ".dbo.User_master.UserID ='" + Session["userid"] + "'");
                 if (drt.Rows.Count <= 0)
                 {
                     Button6.Visible = false;
                 }
                 else
                 {
                     Button6.Visible = true;
                 }
             }
             else
             {
                 Button6.Visible = true;
             }
         }
         else
         {
             Button6.Visible = true;
         }
     }
     catch (Exception ex)
     {
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        PageConn pgcon = new PageConn();

        con = pgcon.dynconn;

        if (!Page.IsPostBack)
        {
            if (Request.QueryString["ID"] != null && Request.QueryString["CID"] != null)
            {
                int id  = Convert.ToInt32(ClsEncDesc.Decrypted(Request.QueryString["ID"].ToString()));
                int cid = Convert.ToInt32(ClsEncDesc.Decrypted(Request.QueryString["CID"].ToString()));


                string str = "select companyjobposition.companyid,companyjobposition.jobtypeid,companyjobposition.jobtitleid,companyjobposition.skills,companyjobposition.notes,companyjobposition.datetime,companyjobposition.sms,companyjobposition.email,companyjobposition.phone,companyjobposition.online," +
                             " VacancyPositionTitleMaster.VacancyPositionTitle from companyjobposition" +
                             " inner join VacancyPositionTitleMaster ON   VacancyPositionTitleMaster.ID=companyjobposition.jobtitleid where  companyjobposition.companyid='" + cid.ToString() + "'";

                SqlCommand     cmd = new SqlCommand(str, con);
                SqlDataAdapter da  = new SqlDataAdapter(cmd);
                DataTable      dt  = new DataTable();
                da.Fill(dt);

                // lblduration.Text=dt.Rows[0]["
                lblvactitle.Text = dt.Rows[0]["VacancyPositionTitle"].ToString();

                //string st = "select VacancyMasterTbl.*,[CityMasterTbl].[CityName],StateMasterTbl.[StateName],CountryMaster.[CountryName],"+
                //" VacancyTypeMaster.ID,VacancyTypeMaster.Name from VacancyMasterTbl inner join VacancyTypeMaster  on VacancyTypeMaster.ID=VacancyMasterTbl.vacancypositiontypeid"+
                //" inner join CityMasterTbl on CityMasterTbl.CityId=VacancyMasterTbl.cityid"+
                //" inner join StateMasterTbl on StateMasterTbl.StateId=VacancyMasterTbl.stateid"+
                //" inner join CountryMaster on CountryMaster.CountryId=VacancyMasterTbl.countryid"+
                //" where VacancyMasterTbl.comid='" + cid.ToString() + "'";
                string st = "select companyjoblocation.*,[CityMasterTbl].[CityName],StateMasterTbl.[StateName],CountryMaster.[CountryName]" +
                            " from companyjoblocation" +
                            " inner join CityMasterTbl on CityMasterTbl.CityId=companyjoblocation.city" +
                            " inner join StateMasterTbl on StateMasterTbl.StateId=companyjoblocation.state" +
                            " inner join CountryMaster on CountryMaster.CountryId=companyjoblocation.country" +
                            " where companyjoblocation.companyid='" + cid.ToString() + "'";

                SqlDataAdapter dat = new SqlDataAdapter(st, con);
                DataTable      dta = new DataTable();
                dat.Fill(dta);
                lblcountry.Text = dta.Rows[0]["CountryName"].ToString();
                lblstate.Text   = dta.Rows[0]["StateName"].ToString();
                lblcity.Text    = dta.Rows[0]["CityName"].ToString();

                string st2 = "select companyjobposition.*,VacancyTypeMaster.Name,VacancyPositionTitleMaster.VacancyPositionTitle from companyjobposition" +
                             " inner join VacancyTypeMaster on VacancyTypeMaster.ID=companyjobposition.jobtypeid" +
                             " inner join VacancyPositionTitleMaster on VacancyPositionTitleMaster.ID=companyjobposition.jobtitleid" +
                             " where companyjobposition.companyid='" + cid.ToString() + "'";
                SqlDataAdapter da2 = new SqlDataAdapter(st2, con);
                DataTable      dt2 = new DataTable();
                da2.Fill(dt2);

                lblvactype.Text             = dt2.Rows[0]["Name"].ToString();
                lblscriptreq.Text           = dt2.Rows[0]["skills"].ToString();
                lblothertermscondition.Text = dt2.Rows[0]["notes"].ToString();
                if (Convert.ToBoolean(dt2.Rows[0]["email"]) == true)
                {
                    // CheckBox3.Visible = true;
                    lblemail.Visible = true;
                }
                else
                {
                    //CheckBox3.Visible = false;
                    lblemail.Visible = false;
                }
                if (Convert.ToBoolean(dt2.Rows[0]["phone"]) == true)
                {
                    // CheckBox1.Visible = true;
                    lblphone.Visible = true;
                }
                else
                {
                    // CheckBox1.Visible = false;
                    lblphone.Visible = false;
                }
                if (Convert.ToBoolean(dt2.Rows[0]["sms"]) == true)
                {
                    //CheckBox4.Visible = true;
                    lblsms.Visible = true;
                }
                else
                {
                    //CheckBox4.Visible = false;
                    lblsms.Visible = false;
                }
                if (Convert.ToBoolean(dt2.Rows[0]["online"]) == true)
                {
                    //  CheckBox2.Visible = true;
                    lblapplyonline.Visible = true;
                }
                else
                {
                    //CheckBox2.Visible = false;
                    lblapplyonline.Visible = false;
                }

                string         st3 = "select companyremuneration2.*,CurrencyMaster.CurrencyName from companyremuneration2 inner join  CurrencyMaster on CurrencyMaster.CurrencyId=companyremuneration2.currency where companyid='" + cid.ToString() + "'";
                SqlDataAdapter da3 = new SqlDataAdapter(st3, con);
                DataTable      dt3 = new DataTable();
                da3.Fill(dt3);
                lblsal1.Text = dt3.Rows[0]["CurrencyName"].ToString();
                lblsal2.Text = dt3.Rows[0]["amount"].ToString();
                if (dt3.Rows[0]["period"].ToString() == "0")
                {
                    lblsal3.Text = "Hour";
                }
                if (dt3.Rows[0]["period"].ToString() == "1")
                {
                    lblsal3.Text = "Day";
                }
                if (dt3.Rows[0]["period"].ToString() == "2")
                {
                    lblsal3.Text = "Week";
                }
                if (dt3.Rows[0]["period"].ToString() == "3")
                {
                    lblsal3.Text = "Month";
                }


                string st4 = "select companyjobtimings.*,TimeZoneMaster.Name+':'+TimeZoneMaster.ShortName+':'+TimeZoneMaster.gmt AS BatchTimeZone from companyjobtimings" +
                             " inner join TimeZoneMaster on TimeZoneMaster.ID=companyjobtimings.timezone   where companyjobtimings.companyid='" + cid.ToString() + "' and TimeZoneMaster.status='1'";
                SqlDataAdapter da4 = new SqlDataAdapter(st4, con);
                DataTable      dt4 = new DataTable();
                da4.Fill(dt4);
                lblfrmtim.Text = dt4.Rows[0]["fromtime"].ToString();
                if (dt4.Rows[0]["fromAMPM"].ToString() == "False")
                {
                    lblfrmampm.Text = "AM";
                }
                if (dt4.Rows[0]["fromAMPM"].ToString() == "True")
                {
                    lblfrmampm.Text = "PM";
                }
                lbltotim.Text = dt4.Rows[0]["totime"].ToString();

                if (dt4.Rows[0]["toAMPM"].ToString() == "False")
                {
                    lbltoampm.Text = "AM";
                }
                if (dt4.Rows[0]["toAMPM"].ToString() == "True")
                {
                    lbltoampm.Text = "PM";
                }

                lbltimzone.Text = dt4.Rows[0]["BatchTimeZone"].ToString();

                lbllastjob.Text = dt4.Rows[0]["days"].ToString();

                //string st1 = "select VacancyDetailTbl.* from VacancyDetailTbl inner join VacancyMasterTbl on VacancyMasterTbl.ID=VacancyDetailTbl.vacancymasterid where VacancyMasterTbl.comid='" + cid.ToString() + "'";
                //SqlDataAdapter da1 = new SqlDataAdapter(st1, con);
                //DataTable dt1 = new DataTable();
                //da1.Fill(dt1);
                //lbljobfun.Text = dt1.Rows[0]["JobFunction"].ToString();
                //lblqualifi.Text = dt1.Rows[0]["QualificationRequirements"].ToString();
                //lblTandC.Text = dt1.Rows[0]["TermsandConditions"].ToString();
            }
        }
    }
    //public string getWelcometext()
    //{


    //    string str = "SELECT EmailContentMaster.EmailContent, EmailContentMaster.EntryDate, CompanyWebsitMaster.SiteUrl, EmailTypeMaster.EmailTypeId " +
    //                " FROM CompanyWebsitMaster INNER JOIN " +
    //                  " EmailContentMaster ON CompanyWebsitMaster.CompanyWebsiteMasterId = EmailContentMaster.CompanyWebsiteMasterId INNER JOIN " +
    //                  " EmailTypeMaster ON EmailContentMaster.EmailTypeId = EmailTypeMaster.EmailTypeId " +
    //                " WHERE     (EmailTypeMaster.EmailTypeId = 1)  and (EmailTypeMaster.Compid='" + Session["Comid"].ToString() + "')" +
    //                " ORDER BY EmailContentMaster.EntryDate DESC ";
    //    SqlCommand cmd = new SqlCommand(str, connection);

    //    SqlDataAdapter adp = new SqlDataAdapter(cmd);
    //    DataTable ds = new DataTable();
    //    adp.Fill(ds);
    //    string welcometext = "";
    //    if (ds.Rows.Count > 0)
    //    {
    //        welcometext = ds.Rows[0]["EmailContent"].ToString();

    //    } return welcometext;

    //}
    public void sendmail(string To)
    {
        string         str = " Select  Distinct CompanyMaster.Compid,CompanyWebsitMaster.MasterEmailId,CompanyWebsitMaster.SiteUrl,CompanyWebsitMaster.Sitename, CompanyWebsitMaster.OutGoingMailServer,CompanyWebsitMaster.WebMasterEmail,CompanyWebsitMaster.EmailMasterLoginPassword, User_master.EmailID,User_master.UserID,CompanyMaster.CompanyLogo,CompanyMaster.CompanyName,CompanyAddressMaster.Email,CompanyAddressMaster.Fax,CompanyAddressMaster.Phone from User_master inner join Party_master on  Party_master.PartyID=User_master.PartyID inner join WareHouseMaster on WareHouseMaster.WareHouseId=Party_master.Whid inner join CompanyMaster on CompanyMaster.Compid=WareHouseMaster.comid inner join CompanyAddressMaster on CompanyAddressMaster.CompanyMasterId=CompanyMaster.CompanyId inner join CompanyWebsitMaster on CompanyWebsitMaster.WHId=WareHouseMaster.WareHouseId where User_master.EmailID='" + To + "'";
        SqlCommand     cmd = new SqlCommand(str, connection);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable      dt  = new DataTable();

        adp.Fill(dt);
        if (dt.Rows.Count > 0)
        {
            StringBuilder strhead = new StringBuilder();
            strhead.Append("<table style=\"font-size:14px; font-family:Calibri\" width=\"100%\"> ");
            strhead.Append("<tr><td align=\"left\"> <img src=\"ShoppingCart/images/" + Convert.ToString(dt.Rows[0]["CompanyLogo"]) + "\" \"border=\"0\" Width=\"176px\" Height=\"106px\" / > </td><td align=\"right\"><b><span style=\"color: #996600\">" + Convert.ToString(dt.Rows[0]["CompanyName"]) + "</span></b><Br><b>" + dt.Rows[0]["Sitename"].ToString() + "</b><BR><b>Phone Number:</b>" + Convert.ToString(dt.Rows[0]["Phone"]) + "<Br><b>Fax Number:</b>" + Convert.ToString(dt.Rows[0]["Fax"]) + "<Br><b>Email:</b>" + Convert.ToString(dt.Rows[0]["Email"]) + "<Br><b>Website:</b>" + dt.Rows[0]["SiteUrl"].ToString() + " </td></tr>  ");
            strhead.Append("<br><br></table> ");
            // StringBuilder strAddress = new StringBuilder();

            //string body = " <br><br><left>Did you Request a password reset for your account ("+To+")?</left><br><br> ";
            //body =body + "if you requested this password reset, go here:<br>";
            //body = body + "<a href=http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/Resetpassword.aspx?to="+To+">http://" +Request.Url.Host.ToString()+"/Shoppingcart/admin/Resetpassword.aspx?to="+To+"</a><br>";

            SqlDataAdapter daas = new SqlDataAdapter("select employeename from employeemaster inner join User_master on User_master.PartyID=EmployeeMaster.PartyID where username='******'", connection);
            DataTable      dtss = new DataTable();
            daas.Fill(dtss);

            string employeenameee = "";
            if (dtss.Rows.Count > 0)
            {
                employeenameee = Convert.ToString(dtss.Rows[0]["employeename"]);
            }
            else
            {
                employeenameee = "";
            }

            string         sel  = "select max(PartyID) as PartyID from Party_master where Id='" + Convert.ToInt32(Session["Comid"]) + "'";
            SqlCommand     cmd5 = new SqlCommand(sel, connection);
            SqlDataAdapter da5  = new SqlDataAdapter(cmd5);
            DataSet        ds5  = new DataSet();
            da5.Fill(ds5);

            SqlDataAdapter daas3 = new SqlDataAdapter("select EmployeeNo from EmployeePayrollMaster inner join employeemaster on  employeemaster.EmployeeMasterID=EmployeePayrollMaster.EmpId inner join User_master  on User_master.PartyID=EmployeeMaster.PartyID where username='******'", connection);
            DataTable      dtss3 = new DataTable();
            daas3.Fill(dtss3);

            string employeenum = "";
            if (dtss3.Rows.Count > 0)
            {
                employeenum = Convert.ToString(dtss3.Rows[0]["EmployeeNo"]);
            }
            else
            {
                employeenum = "";
            }

            SqlDataAdapter daas4 = new SqlDataAdapter("select Employeecode from EmployeeBarcodeMaster inner join employeemaster on employeemaster.EmployeeMasterID=EmployeeBarcodeMaster.Employee_Id inner join User_master on User_master.PartyID=EmployeeMaster.PartyID where username='******'", connection);
            DataTable      dtss4 = new DataTable();
            daas4.Fill(dtss4);

            string employeecodee = "";
            if (dtss4.Rows.Count > 0)
            {
                employeecodee = Convert.ToString(dtss4.Rows[0]["Employeecode"]);
            }
            else
            {
                employeecodee = "";
            }

            ViewState["partyidforemail"] = Convert.ToInt32(ds5.Tables[0].Rows[0]["PartyId"].ToString());

            string         accountdetailofparty = "select Party_master.*,CountryMaster.CountryName,StateMasterTbl.StateName,CityMasterTbl.CityName from Party_master  left outer join CountryMaster on CountryMaster.CountryId=Party_master.Country left outer join StateMasterTbl on StateMasterTbl.StateId=Party_master.State left outer join CityMasterTbl on CityMasterTbl.CityId=Party_master.City inner join User_master on User_master.PartyID=Party_master.PartyID where Party_master.id='" + Convert.ToInt32(Session["Comid"]) + "' and Party_master.PartyID='" + ViewState["partyidforemail"] + "' ";
            SqlCommand     cmdpartydetail       = new SqlCommand(accountdetailofparty, connection);
            SqlDataAdapter adppartydetail       = new SqlDataAdapter(cmdpartydetail);
            DataTable      dspartydetail        = new DataTable();
            string         Accountdetail12      = "";
            adppartydetail.Fill(dspartydetail);

            string country = Convert.ToString(dspartydetail.Rows[0]["CountryName"]);
            string state   = Convert.ToString(dspartydetail.Rows[0]["StateName"]);
            string city    = Convert.ToString(dspartydetail.Rows[0]["CityName"]);
            string zipcode = Convert.ToString(dspartydetail.Rows[0]["Zipcode"]);
            string address = Convert.ToString(dspartydetail.Rows[0]["Address"]);
            string phonnum = Convert.ToString(dspartydetail.Rows[0]["Phoneno"]);
            string emaail  = Convert.ToString(dspartydetail.Rows[0]["Email"]);


            //if (dspartydetail.Rows.Count > 0)
            //{
            Accountdetail12 = "<br><br>Below are your contact details. If you find any information that is incorrect, please change them from My Personal Profile page.<br> <br>Employee Name: " + employeenameee + "<br>Employee Number: " + employeenum + "<br>Employee Code: " + employeecodee + " <br>Address: " + address + " <br>City, State/Province, Country : " + country + "," + state + "," + city + "<br>ZIP/Postal Code: " + zipcode + "<br>Phone Number: " + phonnum + "<br>Email: " + emaail + " ";
            //<strong><span style=\"color: #996600\"></span></strong>
            //}

            string loginurl = Request.Url.Host.ToString() + "/Shoppingcart/Admin/ResetPasswordUser.aspx";

            SqlDataAdapter daas1 = new SqlDataAdapter("select username,password from Login_master where username='******'", connection);
            DataTable      dtss1 = new DataTable();
            daas1.Fill(dtss1);



            if (dtss1.Rows.Count > 0)
            {
                string pwd = dtss1.Rows[0]["password"].ToString();
                pwd1 = ClsEncDesc.Decrypted(pwd);
            }

            string body = " <br><br><span style=\"font-size:14px; font-family:Calibri; text-align:left\">Dear " + employeenameee + ", </span><br><br> ";
            body = body + "<br><br><span style=\"font-size:14px; font-family:Calibri; text-align:left\">You have requested to change your login information. Please click <a href=http://itimekeeper.com/shoppingcart/admin/resetpassworduser.aspx target=_blank > here</a> to change your information now, or click on the link below.</span><br> ";
            body = body + "<br><br><span style=\"font-size:14px; font-family:Calibri; text-align:left\">http://" + loginurl + " </span><br><br> ";
            body = body + "<table style=\"font-size:14px; font-family:Calibri\"><tr><td><left>Company Name : " + Convert.ToString(dt.Rows[0]["CompanyName"]) + "</left><br></td></tr>";
            //body = body + "<tr><td><left>Login URL: </left></td><td><left>: " + loginurl + "</left><br></td></tr>";
            body = body + "<tr><td><left>Company ID : " + Session["Comid"] + "</left><br></td></tr>";
            body = body + "<tr><td><left>Temporary User ID : " + dtss1.Rows[0]["username"].ToString() + "</left><br></td></tr>";
            body = body + "<tr><td><left>Temporary Password : "******"</left><br><br></td></tr>";
            body = body + "<tr><td><left>Please ensure that you change your user ID and password as soon as possible, for your own account security.</left><br><br></td></tr>";
            body = body + "<tr><td><left>" + Accountdetail12 + "</left></td></tr>";
            //body = body + "<span style=\"font-size:14px; font-family:Calibri; text-align:left\">To change the password, please click on the link below</span><br>";
            //body = body + "<a href=http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/Resetpassword.aspx?to=" + ClsEncDesc.Encrypted(ViewState["maxid"].ToString()) + ">http://" + Request.Url.Host.ToString() + "/Shoppingcart/admin/Resetpassword.aspx?to=" + ClsEncDesc.Encrypted(ViewState["maxid"].ToString()) + "</a><br><br>";
            //body = body + "<span style=\"font-size:14px; font-family:Calibri; text-align:left\">If you have not sent any such password change request,just ignore this email.</span><br><br>";
            //body = body + "<span style=\"font-size:14px; font-family:Calibri; text-align:left\">If you have any other technical question, Please do not hesitate to contact by email our technical</span><br>";
            //body = body + "<span style=\"font-size:14px; font-family:Calibri; text-align:left\">Support team at [email protected]</span><br><br>";



            string bodytext = "<br><span style=\"font-size:14px; font-family:Calibri; text-align:left\">Thank you and have a great day.<br><br>Sincerely,<br><br>The Admin Team at " + Convert.ToString(dt.Rows[0]["CompanyName"]) + "</span>";
            // " + dt.Rows[0]["Sitename"].ToString() + "
            StringBuilder support = new StringBuilder();
            support.Append("<table style=\"font-size:14px; font-family:Calibri; text-align:left\" width=\"100%\"> ");
            support.Append("<tr><td align=\"left\"><b><span style=\"color: #996600\">" + Session["productname"] + "</span></b>");
            support.Append("<br></table> ");
            string bodyformate = "" + strhead + "<br>" + body + "<br>" + bodytext + "<br>" + support + "";
            try
            {
                string         strdy = " SELECT ClientMaster.OutgoingServerUserID,ClientMaster.OurgoingServerSMTP,ClientMaster.OutgoingServerPassword from CompanyMaster inner join ProductMaster on ProductMaster.ProductId=CompanyMaster.ProductId inner join ClientMaster on ClientMaster.ClientMasterId=ProductMaster.ClientMasterId where CompanyMaster.CompanyLoginId='" + Convert.ToString(dt.Rows[0]["Compid"]) + "'";
                SqlCommand     cmddy = new SqlCommand(strdy, PageConn.licenseconn());
                SqlDataAdapter adpdy = new SqlDataAdapter(cmddy);
                DataTable      dtdy  = new DataTable();
                adpdy.Fill(dtdy);
                if (dtdy.Rows.Count > 0)
                {
                    MailAddress to       = new MailAddress(To);
                    MailAddress from     = new MailAddress(dtdy.Rows[0]["OutgoingServerUserID"].ToString());
                    MailMessage objEmail = new MailMessage(from, to);
                    objEmail.Subject = "" + Session["productname"] + " - " + Convert.ToString(dt.Rows[0]["CompanyName"]) + " - Request for Password Reset";

                    objEmail.Body       = bodyformate.ToString();
                    objEmail.IsBodyHtml = true;
                    objEmail.Priority   = MailPriority.High;

                    SmtpClient client = new SmtpClient();
                    client.Credentials = new NetworkCredential(dtdy.Rows[0]["OutgoingServerUserID"].ToString(), dtdy.Rows[0]["OutgoingServerPassword"].ToString());
                    client.Host        = dtdy.Rows[0]["OurgoingServerSMTP"].ToString();
                    client.Send(objEmail);
                    lblmsg.Visible       = true;
                    lblmsg.Text          = "You will get your password by Email";
                    txtuname.Text        = "";
                    Panel2.Visible       = false;
                    ImageButton6.Visible = false;
                }
            }
            catch (Exception e)
            {
                lblmsg.Visible = true;
                //lblmsg.Text = e.ToString();
                lblmsg.Text = "Email Id or User Name is invalid for this Company";
            }
        }
    }
Example #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageConn pgcon = new PageConn();

        con = pgcon.dynconn;
        Session["Comid"] = "jobcenter";
        if (!Page.IsPostBack)
        {
            if (Request.QueryString["Id"] != null)
            {
                id = Convert.ToString(Request.QueryString["Id"]);
                id = ClsEncDesc.Decrypted(id.ToString());

                string inf = "select TblFreeLanceProjectMaster.* from TblFreeLanceProjectMaster where FreeLanceProject_Id ='" + id + "'";

                SqlDataAdapter dainf = new SqlDataAdapter(inf, con);
                DataTable      dtinf = new DataTable();
                dainf.Fill(dtinf);

                //ViewState["whid"] = Convert.ToString(dtinf.Rows[0]["BusinessID"]);
                //ViewState["vacancypositiontypeid"] = Convert.ToString(dtinf.Rows[0]["vacancypositiontypeid"]);
                //ViewState["vacancypositiontitleid"] = Convert.ToString(dtinf.Rows[0]["vacancypositiontitleid"]);

                string strii = " SELECT DISTINCT dbo.TblFreeLanceProjectMaster.FreeLanceProject_Id, dbo.TblFreeLanceProjectMaster.FreeLanceProject_DeptId, dbo.TblFreeLanceProjectMaster.FreeLanceProject_ProjectTitle, dbo.TblFreeLanceProjectMaster.FreeLanceProject_ProjectDescription, dbo.TblFreeLanceProjectMaster.FreeLanceProject_StartDate, dbo.TblFreeLanceProjectMaster.FreeLanceProject_EndDate, dbo.TblFreeLanceProjectMaster.FreeLanceProject_TargetEndDate, dbo.TblFreeLanceProjectMaster.FreeLanceProject_ProjectStatus, dbo.TblFreeLanceProjectMaster.FreeLanceProject_ProjectStatus_Id, " +
                               " dbo.TblFreeLanceProjectMaster.Active, dbo.TblFreeLanceProjectMaster.BusinessID, dbo.TblFreeLanceProjectMaster.DesignationID, dbo.TblFreeLanceProjectMaster.ProjectADVTDisplayStartDate, dbo.TblFreeLanceProjectMaster.ProjectADVTDisplayEndDate, dbo.TblFreeLanceProjectMaster.CurrencyID, dbo.TblFreeLanceProjectMaster.SalaryAmount, dbo.TblFreeLanceProjectMaster.SalaryPerPeriodID, dbo.TblFreeLanceProjectMaster.ExpectedProjectHours, dbo.TblFreeLanceProjectMaster.ProjectDuration, dbo.TblFreeLanceProjectMaster.Hours, dbo.TblFreeLanceProjectMaster.HoursPerPeriodID, dbo.TblFreeLanceProjectMaster.comid, dbo.TblFreelanceProjectDetail.ID, dbo.TblFreelanceProjectDetail.QualificationRequirements, " +
                               " dbo.TblFreelanceProjectDetail.TermsAndConditions, dbo.TblFreelanceProjectDetail.ProjectDescription, dbo.VacancyTypeMaster.Name " +
                               " FROM   dbo.TblFreeLanceProjectMaster LEFT OUTER JOIN  dbo.TblFreelanceProjectDetail ON dbo.TblFreeLanceProjectMaster.FreeLanceProject_Id = dbo.TblFreelanceProjectDetail.FreelanceProjectMasterID LEFT OUTER JOIN  dbo.VacancyTypeMaster ON dbo.TblFreeLanceProjectMaster.FreeLanceProject_DeptId = dbo.VacancyTypeMaster.ID LEFT OUTER JOIN  dbo.WareHouseMaster ON dbo.TblFreeLanceProjectMaster.comid = dbo.WareHouseMaster.comid " +
                               " where TblFreeLanceProjectMaster.FreeLanceProject_Id='" + id + "'";
                SqlDataAdapter da = new SqlDataAdapter(strii, con);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    lblprojectcatagory.Text = Convert.ToString(dt.Rows[0]["Name"]);

                    lblprojecttitle.Text = Convert.ToString(dt.Rows[0]["FreeLanceProject_ProjectTitle"]);

                    lblprojectstartdate.Text = Convert.ToString(dt.Rows[0]["FreeLanceProject_StartDate"]);

                    lblprojectenddate.Text = Convert.ToString(dt.Rows[0]["FreeLanceProject_TargetEndDate"]);
                    try
                    {
                    }
                    catch (Exception ex)
                    {
                    }

                    lblprojectduration.Text = Convert.ToString(dt.Rows[0]["ProjectDuration"]);

                    lblprojectdurationmax.Text = Convert.ToString(dt.Rows[0]["ExpectedProjectHours"]);

                    lblNo.Text = Convert.ToString(dt.Rows[0]["Hours"]);

                    lblAmount.Text = Convert.ToString(dt.Rows[0]["SalaryAmount"]);

                    //lblDay1.Text = Convert.ToString(dt.Rows[0]["Hours"]);

                    lblprojectDesc.Text = Convert.ToString(dt.Rows[0]["FreeLanceProject_ProjectDescription"]);

                    lblqualifi.Text = Convert.ToString(dt.Rows[0]["QualificationRequirements"]);

                    lblTandC.Text = Convert.ToString(dt.Rows[0]["TermsAndConditions"]);
                }
                SqlDataAdapter dasl = new SqlDataAdapter("select CurrencyMaster.CurrencyName from CurrencyMaster inner join TblFreeLanceProjectMaster on TblFreeLanceProjectMaster.CurrencyID = CurrencyMaster.CurrencyId where FreeLanceProject_Id='" + id + "'", con);
                DataTable      dtsl = new DataTable();
                dasl.Fill(dtsl);

                if (dtsl.Rows.Count > 0)
                {
                    lblCurrency.Text = Convert.ToString(dtsl.Rows[0]["CurrencyName"]);
                }
                SqlDataAdapter dasl11 = new SqlDataAdapter("select SalaryPerPeriodMaster.Name from SalaryPerPeriodMaster inner join TblFreeLanceProjectMaster on TblFreeLanceProjectMaster. SalaryPerPeriodID = SalaryPerPeriodMaster.ID where FreeLanceProject_Id='" + id + "'", con);
                DataTable      dtsl11 = new DataTable();
                dasl11.Fill(dtsl11);

                if (dtsl11.Rows.Count > 0)
                {
                    lblDay.Text = Convert.ToString(dtsl11.Rows[0]["Name"]);
                }

                //SqlDataAdapter day123 = new SqlDataAdapter("select SalaryPerPeriodMaster.Name from SalaryPerPeriodMaster inner join TblFreeLanceProjectMaster on TblFreeLanceProjectMaster. SalaryPerPeriodID = SalaryPerPeriodMaster.ID where FreeLanceProject_Id='" + id + "'", con);
                //DataTable day123 = new DataTable();
                //dasl11.Fill(day123);

                //if (dtsl11.Rows.Count > 0)
                //{
                //    lblDay1.Text = Convert.ToString(dtsl11.Rows[0]["Name"]);
                //}
                fillattach();
            }
        }
    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        string         chekeit  = "Select * from PasswordResetRequestTbl where ID='" + ClsEncDesc.Decrypted(Request.QueryString["to"]) + "' and passwordchanged='1'";
        SqlCommand     cmdchek  = new SqlCommand(chekeit, connection);
        SqlDataAdapter adptchek = new SqlDataAdapter(cmdchek);
        DataTable      dtchek   = new DataTable();

        adptchek.Fill(dtchek);
        if (dtchek.Rows.Count > 0)
        {
            lblmsg.Text = "You have already changed your password.";
        }
        else
        {
            string         strhour = "Select * from PasswordResetRequestTbl where ID='" + ClsEncDesc.Decrypted(Request.QueryString["to"]) + "'";
            SqlCommand     cmdhour = new SqlCommand(strhour, connection);
            SqlDataAdapter adphour = new SqlDataAdapter(cmdhour);
            DataTable      dthour  = new DataTable();
            adphour.Fill(dthour);


            // DateTime datet = DateTime.Now.AddHours(-48);

            TimeSpan t1 = (Convert.ToDateTime(dthour.Rows[0]["RequestTimeanddate"].ToString()) - Convert.ToDateTime((System.DateTime.Now.ToString())));
            if (t1.Hours == -48)
            {
                lblmsg.Text = "You have already changed password last 48 hours so you can not change your password now, try after sometime.";
            }
            else
            {
                if (txtpass.Text.ToString() == txtresetpass.Text.ToString())
                {
                    string     upd    = "Update Login_master Set password='******' where UserId='" + Convert.ToString(ViewState["UserID"]) + "'";
                    SqlCommand cmdupd = new SqlCommand(upd, connection);
                    if (connection.State.ToString() != "Open")
                    {
                        connection.Open();
                    }
                    int success = cmdupd.ExecuteNonQuery();
                    if (Convert.ToBoolean(success) == true)
                    {
                        string     strinsert = "update PasswordResetRequestTbl set passwordchanged='1' where ID ='" + ClsEncDesc.Decrypted(Request.QueryString["to"]) + "'";
                        SqlCommand cmdinsert = new SqlCommand(strinsert, connection);
                        if (connection.State.ToString() != "Open")
                        {
                            connection.Open();
                        }
                        cmdinsert.ExecuteNonQuery();
                        connection.Close();
                        lblmsg.Visible = true;
                        lblmsg.Text    = "Password updated successfully";
                        Panel2.Visible = false;
                        Panel1.Visible = false;
                    }
                    else
                    {
                        lblmsg.Visible = true;
                        lblmsg.Text    = " Password not updated successfully";
                    }
                    connection.Close();
                }
                else
                {
                    lblmsg.Visible = true;
                    lblmsg.Text    = "Confirm password not match";
                }
                txtpass.Text      = "";
                txtresetpass.Text = "";
            }
        }
    }
    protected void LoadPdf(int Docid)
    {
        DataTable dt = new DataTable();

        dt = clsDocument.SelectDoucmentMasterByID(Docid);

        if (dt.Rows.Count > 0)
        {
            string docname = dt.Rows[0]["DocumentName"].ToString();
            ViewState["decname"] = docname.ToString();
            string filepath = Server.MapPath("~//Account//" + Session["comid"] + "//UploadedDocuments//" + docname);
            string strft    = "Select FileStorage.* from FileStorage Where B='" + ClsEncDesc.EncDyn(Session["comid"].ToString()) + "' and H='" + ClsEncDesc.EncDyn("True") + "'";

            SqlCommand     cmdft = new SqlCommand(strft, con);
            SqlDataAdapter adpft = new SqlDataAdapter(cmdft);
            DataTable      dtft  = new DataTable();
            adpft.Fill(dtft);

            if (dtft.Rows.Count > 0)
            {
                FileInfo filec = new FileInfo(filepath);
                if (!filec.Exists)
                {
                    datatransftp(docname, filepath);
                    System.Threading.Thread.Sleep(1000);
                    FileInfo filecup = new FileInfo(filepath);
                    if (filecup.Exists)
                    {
                        string filepathu = Server.MapPath("~//Account//pdftoimage.exe");
                        System.Diagnostics.ProcessStartInfo pti = new System.Diagnostics.ProcessStartInfo(filepathu);

                        pti.UseShellExecute = false;
                        pti.Arguments       = filepathu + " -i UploadedDocuments//" + docname + " " + "-o" + " " + "DocumentImage//";//+ " " + "-r" + "VNKSURDLWQOVHPGH";


                        pti.RedirectStandardOutput = true;
                        pti.RedirectStandardInput  = true;
                        pti.RedirectStandardError  = true;

                        pti.WorkingDirectory = Server.MapPath("~//Account//" + Session["comid"] + "//");
                        System.Diagnostics.Process ps = Process.Start(pti);
                        System.Threading.Thread.Sleep(1000);
                    }
                }
            }
            int    length    = docname.Length;
            string docnameIn = docname.Substring(0, length - 4);


            ViewState["path"] = filepath.ToString();
            DataTable  dt1  = new DataTable();
            DataColumn dcom = new DataColumn();
            dcom.ColumnName = "image";
            dcom.DataType   = System.Type.GetType("System.String");
            dt1.Columns.Add(dcom);
            string Location             = Server.MapPath("~//Account//" + Session["comid"] + "//DocumentImage//");
            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(Location);

            foreach (System.IO.FileInfo f in dir.GetFiles(docnameIn.ToString() + "*.*"))
            {
                DataRow drow = dt1.NewRow();
                drow["image"] = "~/Account/" + Session["comid"] + "/DocumentImage/" + f.Name.ToString();
                dt1.Rows.Add(drow);
            }
            DataList1.DataSource = dt1;
            DataList1.DataBind();
            DataTable dtfill = (DataTable)Session["grdcopy"];
            GridView2.DataSource = dtfill;
            GridView2.DataBind();
        }
    }