Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string assss = "32";

        assss = PageMgmt.Encrypted("Inventorycategorymaster.aspx");
        assss = PageMgmt.Decrypted("lpSVW07ER8Q=");

        Session.Clear();
        if (!IsPostBack)
        {
            lblmsg.Visible = false;
        }



        con = PageConn.licenseconn();


//        string str = @" DECLARE @Pivot_Column [nvarchar](max);
//                        DECLARE @Query [nvarchar](max);
//                        SELECT @Pivot_Column= COALESCE(@Pivot_Column+',','')+ QUOTENAME(CategoryName) FROM
//                        (SELECT DISTINCT [CategoryName] FROM PageAccessToPricePlanCategory Where CategoryName IS NOT NULL)Tab
//                        SELECT @Query='SELECT PageId,PageName, '+@Pivot_Column+'FROM
//                        (SELECT PageId,PageName, [CategoryName] , Id   FROM PageAccessToPricePlanCategory )Tab1
//                        PIVOT
//                        (
//                        SUM(Id) FOR CategoryName IN ('+@Pivot_Column+')) AS Tab2
//                        ORDER BY Tab2.PageName'
//                        EXEC  sp_executesql  @Query ";//
//        SqlCommand cmd = new SqlCommand(str, con);
//        SqlDataAdapter adp = new SqlDataAdapter(cmd);
//        DataTable dt = new DataTable();
//        adp.Fill(dt);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string aaaa = PageMgmt.Encrypted("asasas");

            if (Request.QueryString["compid"] != null || Request.QueryString["ProdMasCodeId"] != null || Request.QueryString["CodeVersionId"] != null || Request.QueryString["CodeTypeID"] != null)
            {
                lbl_codetypeid.Text    = PageMgmt.Encrypted(Request.QueryString["CodeTypeID"].ToString());
                lbl_codeversionno.Text = PageMgmt.Encrypted(Request.QueryString["CodeVersionId"].ToString());
                string compid = PageMgmt.Encrypted(Request.QueryString["compid"]);
                lbl_ProdMasCodeId.Text = PageMgmt.Encrypted(Request.QueryString["ProdMasCodeId"].ToString());
                string         str = " SELECT CompanyMaster.*,PortalMasterTbl.id as portlID, PortalMasterTbl.PortalName,PricePlanMaster.VersionInfoMasterId,PricePlanMaster.Producthostclientserver, dbo.ClientMaster.ServerId AS ClientServerid from dbo.CompanyMaster INNER JOIN dbo.PricePlanMaster ON dbo.PricePlanMaster.PricePlanId = dbo.CompanyMaster.PricePlanId INNER JOIN dbo.PortalMasterTbl ON dbo.PricePlanMaster.PortalMasterId1 = dbo.PortalMasterTbl.Id INNER JOIN dbo.VersionInfoMaster ON dbo.PricePlanMaster.VersionInfoMasterId = dbo.VersionInfoMaster.VersionInfoId INNER JOIN dbo.ProductMaster ON dbo.VersionInfoMaster.ProductId = dbo.ProductMaster.ProductId INNER JOIN dbo.ClientMaster ON dbo.ProductMaster.ClientMasterId = dbo.ClientMaster.ClientMasterId  where CompanyLoginId='" + compid + "' ";
                SqlCommand     cmd = new SqlCommand(str, con);
                SqlDataAdapter adp = new SqlDataAdapter(cmd);
                DataTable      ds  = new DataTable();
                adp.Fill(ds);
                if (ds.Rows.Count > 0)
                {
                    lbl_CompServerID.Text   = ds.Rows[0]["ServerId"].ToString();
                    lbl_ClientServerID.Text = ds.Rows[0]["ClientServerid"].ToString();
                    lbl_versionid.Text      = ds.Rows[0]["VersionInfoMasterId"].ToString();
                    ServerConn1(ds.Rows[0]["ServerId"].ToString(), ds.Rows[0]["ClientServerid"].ToString(), lbl_ProdMasCodeId.Text, ds.Rows[0]["Encryptkeycomp"].ToString(), compid, ds.Rows[0]["VersionInfoMasterId"].ToString());
                }
            }
        }
    }
Exemple #3
0
    protected void Button4_Click(object sender, EventArgs e)
    {
        string str = " select Login_master.username,Login_master.password FROM Login_master inner join User_master on User_master.UserID = Login_master.UserID  inner join Party_master on Party_master.PartyID = User_master.PartyID inner join EmployeeMaster on EmployeeMaster.PartyID=Party_master.PartyID  where EmployeeMaster.EmployeeMasterID='" + ViewState["ID"] + "'";

        SqlDataAdapter da = new SqlDataAdapter(str, con);
        DataTable      dt = new DataTable();

        da.Fill(dt);

        string oldpass  = PageMgmt.Encrypted(dt.Rows[0]["password"].ToString());
        string username = dt.Rows[0]["username"].ToString();
        string Password = TextBox2.Text;

        if (oldpass == Password && username == TextBox1.Text)
        {
            TextBox2.Text = "";
            TextBox1.Text = "";

            SqlCommand cmd = new SqlCommand("update GatepassDetails set TimeLeft='" + System.DateTime.Now.ToShortTimeString().Substring(0, 5) + "' where GatePassID='" + ViewState["gateid"] + "'", con);
            if (con.State.ToString() != "Open")
            {
                con.Open();
            }
            cmd.ExecuteNonQuery();
            con.Close();

            fillgriddata();

            string te = "frmgatepassreturn.aspx?gatepass="******"gateid"];
            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open('" + te + "');", true);
        }
        else
        {
            Label5.Text = "User Name or Password Possibally Incorrect.";
            ModalPopupExtenderAddnew.Show();
        }
    }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["rankey"] != null && Request.QueryString["seid"] != null && Request.QueryString["prodid"] != null && Request.QueryString["coid"] != null && Request.QueryString["paname"] != null && Request.QueryString["portid"] != null)//portid
        {
            string         str1321 = "select * from ServerMasterTbl where Id= '" + Request.QueryString["seid"].ToString() + "' ";
            SqlCommand     cgw1    = new SqlCommand(str1321, con);//license
            SqlDataAdapter adgw1   = new SqlDataAdapter(cgw1);
            DataTable      dt1     = new DataTable();
            adgw1.Fill(dt1);
            if (dt1.Rows.Count > 0)
            {
                encstr = dt1.Rows[0]["Enckey"].ToString();
                string portid    = Decrypted(Request.QueryString["portid"].ToString());
                string productid = Decrypted(Request.QueryString["prodid"].ToString());
                string codeid    = Decrypted(Request.QueryString["coid"].ToString());
                string page      = Request.QueryString["paname"].ToString().Replace(" ", "+");
                string pagename  = Decrypted(page.ToString());
                if (portid.ToString() == "1")
                {
                    string port = dt1.Rows[0]["FTPportfordefaultIISpath"].ToString();
                    try
                    {
                        delectport(port);
                    }
                    catch
                    {
                    }
                    ExecuteBatFile(port);

                    string     strServerstatusmaster = " Insert Into PortSecurityTbl (serverid,portnumber,portopendatetime)  values ('" + Request.QueryString["seid"].ToString() + "','" + port + "','" + DateTime.Now.ToShortDateString() + "')";
                    SqlCommand cmd = new SqlCommand(strServerstatusmaster, con);
                    if (con.State.ToString() != "Open")
                    {
                        con.Open();
                    }
                    cmd.ExecuteNonQuery();
                    con.Close();

                    Response.Redirect("http://" + dt1.Rows[0]["Busiwizsatellitesiteurl"].ToString() + "/" + pagename.ToString() + "?ftpurl=" + PageMgmt.Encrypted(dt1.Rows[0]["FTPforMastercode"].ToString()) + "&userid=" + PageMgmt.Encrypted(dt1.Rows[0]["FTPuseridforDefaultIISpath"].ToString()) + "&password="******"FtpPasswordforDefaultIISpath"].ToString()) + "&portno=" + PageMgmt.Encrypted(dt1.Rows[0]["FTPportfordefaultIISpath"].ToString()) + "&productid=" + PageMgmt.Encrypted(productid.ToString()) + "&serverid=" + PageMgmt.Encrypted(Request.QueryString["seid"].ToString()) + "&codeid=" + PageMgmt.Encrypted(codeid.ToString()) + "");
                }
                else if (portid.ToString() == "2")
                {
                    string port = dt1.Rows[0]["Default_FTPPort"].ToString();
                    try
                    {
                        delectport(port);
                    }
                    catch
                    {
                    }
                    ExecuteBatFile(port);

                    string     strServerstatusmaster = " Insert Into PortSecurityTbl (serverid,portnumber,portopendatetime)  values ('" + Request.QueryString["seid"].ToString() + "','" + port + "','" + DateTime.Now.ToShortDateString() + "')";
                    SqlCommand cmd = new SqlCommand(strServerstatusmaster, con);
                    if (con.State.ToString() != "Open")
                    {
                        con.Open();
                    }
                    cmd.ExecuteNonQuery();
                    con.Close();

                    Response.Redirect("http://" + dt1.Rows[0]["Busiwizsatellitesiteurl"].ToString() + "/" + pagename.ToString() + "?ftpurl=" + PageMgmt.Encrypted(dt1.Rows[0]["Default_FTPUrl"].ToString()) + "&userid=" + PageMgmt.Encrypted(dt1.Rows[0]["Default_FTPUserId"].ToString()) + "&password="******"Default_FTPPassword"].ToString()) + "&portno=" + PageMgmt.Encrypted(dt1.Rows[0]["Default_FTPPort"].ToString()) + "&productid=" + PageMgmt.Encrypted(productid.ToString()) + "&serverid=" + PageMgmt.Encrypted(Request.QueryString["seid"].ToString()) + "&codeid=" + PageMgmt.Encrypted(codeid.ToString()) + "");
                }
                else if (portid.ToString() == "3")
                {
                    string port = dt1.Rows[0]["MDF_FTPPort"].ToString();
                    try
                    {
                        delectport(port);
                    }
                    catch
                    {
                    }
                    ExecuteBatFile(port);
                    string     strServerstatusmaster = " Insert Into PortSecurityTbl (serverid,portnumber,portopendatetime)  values ('" + Request.QueryString["seid"].ToString() + "','" + port + "','" + DateTime.Now.ToShortDateString() + "')";
                    SqlCommand cmd = new SqlCommand(strServerstatusmaster, con);
                    if (con.State.ToString() != "Open")
                    {
                        con.Open();
                    }
                    cmd.ExecuteNonQuery();
                    con.Close();


                    Response.Redirect("http://" + dt1.Rows[0]["Busiwizsatellitesiteurl"].ToString() + "/" + pagename.ToString() + "?ftpurl=" + PageMgmt.Encrypted(dt1.Rows[0]["MDF_FTPUrl"].ToString()) + "&userid=" + PageMgmt.Encrypted(dt1.Rows[0]["MDF_FTPUserId"].ToString()) + "&password="******"MDF_FTPPassword"].ToString()) + "&portno=" + PageMgmt.Encrypted(dt1.Rows[0]["MDF_FTPPort"].ToString()) + "&productid=" + PageMgmt.Encrypted(productid.ToString()) + "&serverid=" + PageMgmt.Encrypted(Request.QueryString["seid"].ToString()) + "&codeid=" + PageMgmt.Encrypted(codeid.ToString()) + "");
                }
                else if (portid.ToString() == "4")
                {
                    string port = dt1.Rows[0]["LDF_FTPPort"].ToString();
                    try
                    {
                        delectport(port);
                    }
                    catch
                    {
                    }
                    ExecuteBatFile(port);

                    string     strServerstatusmaster = " Insert Into PortSecurityTbl (serverid,portnumber,portopendatetime)  values ('" + Request.QueryString["seid"].ToString() + "','" + port + "','" + DateTime.Now.ToShortDateString() + "')";
                    SqlCommand cmd = new SqlCommand(strServerstatusmaster, con);
                    if (con.State.ToString() != "Open")
                    {
                        con.Open();
                    }
                    cmd.ExecuteNonQuery();
                    con.Close();

                    Response.Redirect("http://" + dt1.Rows[0]["Busiwizsatellitesiteurl"].ToString() + "/" + pagename.ToString() + "?ftpurl=" + PageMgmt.Encrypted(dt1.Rows[0]["LDF_FTPUrl"].ToString()) + "&userid=" + PageMgmt.Encrypted(dt1.Rows[0]["LDF_FTPUserId"].ToString()) + "&password="******"LDF_FTPPassword"].ToString()) + "&portno=" + PageMgmt.Encrypted(dt1.Rows[0]["LDF_FTPPort"].ToString()) + "&productid=" + PageMgmt.Encrypted(productid.ToString()) + "&serverid=" + PageMgmt.Encrypted(Request.QueryString["seid"].ToString()) + "&codeid=" + PageMgmt.Encrypted(codeid.ToString()) + "");
                }
                else if (portid.ToString() == "5")
                {
                    string port = dt1.Rows[0]["FTPportfordefaultIISpath"].ToString();
                    try
                    {
                        delectport(port);
                    }
                    catch
                    {
                    }
                    ExecuteBatFile(port);
                    string     strServerstatusmaster = " Insert Into PortSecurityTbl (serverid,portnumber,portopendatetime)  values ('" + Request.QueryString["seid"].ToString() + "','" + port + "','" + DateTime.Now.ToShortDateString() + "')";
                    SqlCommand cmd = new SqlCommand(strServerstatusmaster, con);
                    if (con.State.ToString() != "Open")
                    {
                        con.Open();
                    }
                    cmd.ExecuteNonQuery();
                    con.Close();


                    Response.Redirect("http://" + dt1.Rows[0]["Busiwizsatellitesiteurl"].ToString() + "/" + pagename.ToString() + "?ftpurl=" + PageMgmt.Encrypted(dt1.Rows[0]["FTPforMastercode"].ToString()) + "&userid=" + PageMgmt.Encrypted(dt1.Rows[0]["FTPuseridforDefaultIISpath"].ToString()) + "&password="******"FtpPasswordforDefaultIISpath"].ToString()) + "&portno=" + PageMgmt.Encrypted(dt1.Rows[0]["FTPportfordefaultIISpath"].ToString()) + "&productid=" + PageMgmt.Encrypted(productid.ToString()) + "&serverid=" + PageMgmt.Encrypted(Request.QueryString["seid"].ToString()) + "&codeid=" + PageMgmt.Encrypted(codeid.ToString()) + "");
                }
                else if (portid.ToString() == "6")
                {
                    string port = dt1.Rows[0]["FTPportfordefaultIISpath"].ToString();
                    try
                    {
                        delectport(port);
                    }
                    catch
                    {
                    }
                    ExecuteBatFile(port);

                    string     strServerstatusmaster = " Insert Into PortSecurityTbl (serverid,portnumber,portopendatetime)  values ('" + Request.QueryString["seid"].ToString() + "','" + port + "','" + DateTime.Now.ToShortDateString() + "')";
                    SqlCommand cmd = new SqlCommand(strServerstatusmaster, con);
                    if (con.State.ToString() != "Open")
                    {
                        con.Open();
                    }
                    cmd.ExecuteNonQuery();
                    con.Close();

                    Response.Redirect("http://" + dt1.Rows[0]["Busiwizsatellitesiteurl"].ToString() + "/" + pagename.ToString() + "?ftpurl=" + PageMgmt.Encrypted(dt1.Rows[0]["FTPforMastercode"].ToString()) + "&userid=" + PageMgmt.Encrypted(dt1.Rows[0]["FTPuseridforDefaultIISpath"].ToString()) + "&password="******"FtpPasswordforDefaultIISpath"].ToString()) + "&portno=" + PageMgmt.Encrypted(dt1.Rows[0]["FTPportfordefaultIISpath"].ToString()) + "&productid=" + PageMgmt.Encrypted(productid.ToString()) + "&serverid=" + PageMgmt.Encrypted(Request.QueryString["seid"].ToString()) + "&codeid=" + PageMgmt.Encrypted(codeid.ToString()) + "");
                }
            }
            // ExecuteBatFile();
        }
    }
    public void sendmailconfiguration(string cid)
    {
        string         str = "select distinct Priceplancategory.CategoryName,CompanyMaster.CompanyLoginId,CompanyMaster.AdminId,CompanyMaster.Password as Pwd,CompanyMaster.Email,CompanyMaster.CompanyName,CompanyMaster.ContactPerson,CompanyMaster.Address,StateMasterTbl.StateName,CountryMaster.CountryName, PortalMasterTbl.*,PricePlanMaster.PricePlanAmount,PricePlanMaster.PricePlanName,PricePlanMaster.PricePlanId,PricePlanMaster.PricePlanDesc 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(CompanyMaster.CompanyLoginId = '" + cid + "') ";
        SqlCommand     cmd = new SqlCommand(str, con);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable      dt  = new DataTable();

        adp.Fill(dt);

        if (Request.QueryString["comidauto"] != null)
        {
            string stepsFive = "http://members.busiwiz.com/Companyconfigureinfo.aspx?comid=" + PageMgmt.Encrypted(dt.Rows[0]["CompanyLoginId"].ToString()) + "&comidauto=" + dt.Rows[0]["CompanyLoginId"].ToString() + "&Franchisee=" + Request.QueryString["Franchisee"] + "&Autocompa=" + dt.Rows[0]["CompanyLoginId"].ToString() + "";
            // stepsFive= "http://license.busiwiz.com/companyapproval.aspx?comid=" + ClsEncDesc.Encrypted(Label7.Text) + "&id=" + dsmaxid.Rows[0]["Id"].ToString() + "comidauto=" + Label7.Text + "" ;
            //" + ClsEncDesc.Encrypted(Label7.Text) + "&id=" + ClsEncDesc.Encrypted(dsmaxid.Rows[0]["Id"].ToString()) + "

            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open('" + stepsFive + "');", true);
        }
        else
        {
            string         s = " select  OrderID as OrderID  from OrderMaster where CompanyLoginId='" + cid + "'";
            SqlCommand     c = new SqlCommand(s, con);
            SqlDataAdapter a = new SqlDataAdapter(c);
            DataTable      d = new DataTable();
            a.Fill(d);
            int orderid = 0;
            if (d.Rows.Count > 0)
            {
                //orderid = Convert.ToInt32(d.Rows[0]["orderid"]);
                ViewState["OrderID"] = Convert.ToInt32(d.Rows[0]["orderid"]);
            }
            string str1 = " select Payment_mode.paymentmode_name as paymentmethod ,Payment_Order_Conform.Payment_date as Date,Payment_Order_Conform.Pay_amount as amountpaid,OrderPaymentSatus.TransactionID " +
                          " FROM OrderPaymentSatus LEFT OUTER JOIN Payment_Order_Conform on Payment_Order_Conform.order_id=OrderPaymentSatus.OrderId " +
                          " LEFT OUTER JOIN Payment_mode on Payment_mode.paymentmode_id=Payment_Order_Conform.payment_mode_id " +
                          " where  OrderPaymentSatus.OrderId=" + ViewState["OrderID"] + "";

            SqlCommand     cmd1 = new SqlCommand(str1, con);
            SqlDataAdapter adp1 = new SqlDataAdapter(cmd1);
            DataTable      dt1  = new DataTable();
            adp1.Fill(dt1);

            string Pay_amount       = "";
            string TransactionID    = "";
            string Payment_date     = "";
            string paymentmode_name = "";
            if (dt1.Rows.Count > 0)
            {
                Pay_amount       = "" + dt1.Rows[0]["amountpaid"].ToString() + "";
                TransactionID    = "" + dt1.Rows[0]["TransactionID"].ToString() + "";
                paymentmode_name = " " + dt1.Rows[0]["paymentmethod"].ToString() + "";
                Payment_date     = "" + dt1.Rows[0]["Date"].ToString() + "";
            }

            if (dt.Rows.Count > 0)
            {
                StringBuilder strplan = new StringBuilder();

                strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                strplan.Append("<tr><td align=\"left\"> <img src=\"http://license.busiwiz.com/images/" + dt.Rows[0]["LogoPath"].ToString() + "\" \"border=\"0\" Width=\"90\" Height=\"80\" / > </td ></tr>  ");
                strplan.Append("<br></table> ");

                strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                strplan.Append("<tr><td align=\"left\">Dear " + dt.Rows[0]["CompanyName"].ToString() + ",</td></tr>  ");
                strplan.Append("<tr><td align=\"left\"></td></tr>  ");
                strplan.Append("</table> ");

                //strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                //strplan.Append("<tr><td align=\"left\">Thank you for buying/subscribing our product.</td></tr> ");
                //strplan.Append("</table> ");

                //
                strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                strplan.Append("<tr><td align=\"left\">We are pleased to inform you that your product is ready for configuration. Please note that you must configure your account before you can start using this product. Please click <a href=http://members.busiwiz.com/Companyconfigureinfo.aspx?comid=" + PageMgmt.Encrypted(dt.Rows[0]["CompanyLoginId"].ToString()) + "&Franchisee=" + FranName + " "
                               + " target =_blank >here </a> to begin the configuration process now, or copy and paste the following URL into your internet browser.<br><br>http://members.busiwiz.com/Companyconfigureinfo.aspx?comid=" + PageMgmt.Encrypted(dt.Rows[0]["CompanyLoginId"].ToString()) + "&Franchisee=" + FranName + "<br><br><br></td></tr> ");
                strplan.Append("</table> ");

                //strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                //strplan.Append("<tr><td align=\"left\">We are pleased to inform you that your product is ready for configuration.</td></tr> ");
                //strplan.Append("</table> ");

                //strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                //strplan.Append("<tr><td align=\"left\">Please note that you must configure your account before you can start using this product. </td></tr> ");
                //strplan.Append("</table> ");

                //strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                //strplan.Append("<tr><td align=\"left\">Please click <a href=http://members.busiwiz.com/Companyconfigureinfo.aspx?comid=" + PageMgmt.Encrypted(dt.Rows[0]["CompanyLoginId"].ToString()) + " target =_blank >here </a> to begin the configuration process now, or copy and paste the following URL into your internet browser.<br><br></td></tr> ");
                //strplan.Append("<tr><td align=\"left\">http://members.busiwiz.com/Companyconfigureinfo.aspx?comid=" + PageMgmt.Encrypted(dt.Rows[0]["CompanyLoginId"].ToString()) + "<br><br></td></tr> ");
                //strplan.Append("</table> ");

                //strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                //strplan.Append("<tr><td align=\"left\">Please note keep the following information in a safe place for future reference.<br><br></td></tr> ");
                //strplan.Append("</table> ");

                strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                strplan.Append("<tr><td align=\"left\">Please keep the following information in a safe place for future reference.<br><br></td></tr> ");
                strplan.Append("</table> ");


                strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; font-weight:bold; color: #000000; font-family: Arial\"> ");
                strplan.Append("<tr><td align=\"left\"><b> Product Details</b> </td></tr>  ");
                // strplan.Append("<tr><td align=\"left\"><br></td></tr>  ");
                strplan.Append("</table> ");

                strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                strplan.Append("<tr><td align=\"left\" style=\"width: 20%\">Product Name: " + dt.Rows[0]["PortalName"].ToString() + "</td></tr>");
                strplan.Append("<tr><td align=\"left\" style=\"width: 20%\">Price Plan Name: " + dt.Rows[0]["PricePlanName"].ToString() + "</td></tr>");
                strplan.Append("<tr><td align=\"left\" style=\"width: 20%\">Amount Paid: " + Pay_amount + "</td></tr>");
                strplan.Append("<tr><td align=\"left\" style=\"width: 20%\">Transaction ID:" + TransactionID + "</td></tr>");
                strplan.Append("<tr><td align=\"left\" style=\"width: 20%\">Payment Method: " + paymentmode_name + "</td></tr>");
                strplan.Append("<tr><td align=\"left\" style=\"width: 20%\">Transaction Date:" + Payment_date + "</td></tr>");
                strplan.Append("<tr><td align=\"left\"><br></td></tr>  ");
                strplan.Append("</table> ");

                strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; font-weight:bold; color: #000000; font-family: Arial\"> ");
                strplan.Append("<tr><td align=\"left\"><b>Account Information</b></td></tr>  ");
                //strplan.Append("<tr><td align=\"left\"><br></td></tr>  ");
                strplan.Append("</table> ");

                strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                strplan.Append("<tr><td align=\"left\" style=\"width: 20%\">Company ID: " + dt.Rows[0]["CompanyLoginId"].ToString() + "</td></tr>");
                strplan.Append("<tr><td align=\"left\" style=\"width: 20%\">User ID: " + dt.Rows[0]["AdminId"].ToString() + "</td></tr>");
                strplan.Append("<tr><td align=\"left\" style=\"width: 20%\">Password: "******"Pwd"].ToString() + "</td></tr>");
                strplan.Append("</table> ");

                strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                strplan.Append("<tr><td align=\"left\"><br><br></td></tr> ");
                strplan.Append("<tr><td align=\"left\">If you have any questions regarding this information <br> <a href=mailto:" + dt.Rows[0]["Supportteamemailid"].ToString() + " >" + dt.Rows[0]["Supportteamemailid"].ToString() + " </a> </td></tr> ");
                strplan.Append("<tr><td align=\"left\"><br><br></td></tr> ");
                strplan.Append("</table> ");


                //strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                //strplan.Append("<tr><td align=\"left\">Thank you,</td></tr>  ");
                //strplan.Append("<tr><td align=\"left\">Sincerely ,</td></tr>  ");
                //strplan.Append("<tr><td align=\"left\">Support Team -" + dt.Rows[0]["PortalName"].ToString() + "</td></tr>  ");
                //strplan.Append("</table> ");

                string ext         = "";
                string tollfree    = "";
                string tollfreeext = "";

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

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

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


                strplan.Append("<table width=\"100%\" style=\"font-size: 10pt; color: #000000; font-family: Arial\"> ");
                strplan.Append("<tr><td align=\"left\">Thank you,</td></tr> ");
                //strplan.Append("<tr><td align=\"left\">Sincerely, </td></tr> ");
                //strplan.Append("<tr><td align=\"left\"><br> </td></tr> ");
                strplan.Append("<tr><td align=\"left\">" + dt.Rows[0]["Supportteammanagername"].ToString() + "- Support Manager</td></tr> ");
                strplan.Append("<tr><td align=\"left\">" + dt.Rows[0]["PortalName"].ToString() + " </td></tr> ");
                strplan.Append("<tr><td align=\"left\">" + dt.Rows[0]["Supportteamphoneno"].ToString() + "  " + ext + "  </td></tr> ");
                strplan.Append("<tr><td align=\"left\">" + tollfree + " " + tollfreeext + " </td></tr> ");
                strplan.Append("<tr><td align=\"left\">" + dt.Rows[0]["Portalmarketingwebsitename"].ToString() + " </td></tr> ");
                strplan.Append("<tr><td align=\"left\">" + dt.Rows[0]["Address1"].ToString() + " </td></tr> ");
                strplan.Append("<tr><td align=\"left\">" + dt.Rows[0]["City"].ToString() + " " + dt.Rows[0]["StateName"].ToString() + " " + dt.Rows[0]["CountryName"].ToString() + " " + dt.Rows[0]["Zip"].ToString() + " </td></tr> ");
                strplan.Append("</table> ");

                string bodyformate = "" + strplan + "";


                try
                {
                    MailAddress to       = new MailAddress(dt.Rows[0]["Email"].ToString());
                    MailAddress from     = new MailAddress(dt.Rows[0]["UserIdtosendmail"].ToString(), dt.Rows[0]["EmailDisplayname"].ToString());
                    MailMessage objEmail = new MailMessage(from, to);
                    objEmail.Subject = " Your product  " + dt.Rows[0]["PortalName"].ToString() + " is ready for configuration now";

                    objEmail.Body       = bodyformate.ToString();
                    objEmail.IsBodyHtml = true;
                    objEmail.Priority   = MailPriority.High;
                    SmtpClient client = new SmtpClient();
                    client.Credentials = new NetworkCredential(dt.Rows[0]["UserIdtosendmail"].ToString(), dt.Rows[0]["Password"].ToString());
                    client.Host        = dt.Rows[0]["Mailserverurl"].ToString();
                    //client.Port = 587;
                    client.Send(objEmail);
                }
                catch
                {
                }
            }
        }
    }
Exemple #6
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        con = PageConn.licenseconn();
        string ipaddress = "";

        ipaddress = Request.ServerVariables["REMOTE_ADDR"].ToString();
        //  ipaddress = "192.168.6.41";
        //Request.ServerVariables["REMOTE_ADDR"].ToString();

        Session["userloginname"] = txtUser.Text;

        //try
        //{
        string str = "   select clientLoginMaster.clientId,clientLoginMaster.Password,clientLoginMaster.UserId,ClientMaster.CompanyName from clientLoginMaster inner join  ClientMaster on ClientMaster.LoginName=clientLoginMaster.UserId " +
                     " where  clientLoginMaster.UserId='" + txtUser.Text + "' and clientLoginMaster.clientId='" + txtClientId.Text + "' " +
                     " and clientLoginMaster.Password='******' ";//
        SqlCommand     cmd = new SqlCommand(str, con);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable      dt  = new DataTable();

        adp.Fill(dt);
        if (dt.Rows.Count > 0)
        {
            Session["Login"]    = txtUser.Text; // "admin";
            Session["ClientId"] = dt.Rows[0]["clientId"].ToString();
            Session["UserId"]   = dt.Rows[0]["UserId"].ToString();
            string pass = PageMgmt.Encrypted(dt.Rows[0]["Password"].ToString());
            Session["ClientName"] = dt.Rows[0]["CompanyName"].ToString();
            Response.Redirect("Product_BatchMaster.aspx");
        }
        else
        {
            string str1 = "select distinct EmployeeMaster.Id as empid,clientLoginMaster.clientId,clientLoginMaster.Password,clientLoginMaster.UserId,ClientMaster.CompanyName from ClientMaster inner join clientLoginMaster on clientLoginMaster.ClientId=ClientMaster.ClientMasterId inner join EmployeeMaster on EmployeeMaster.UserId=clientLoginMaster.UserId " +
                          " where  clientLoginMaster.UserId='" + txtUser.Text + "' and clientLoginMaster.clientId='" + txtClientId.Text + "' " +
                          " and clientLoginMaster.Password='******' ";// and clientLoginMaster.Password='******'
            SqlCommand     cmd1 = new SqlCommand(str1, con);
            SqlDataAdapter adp1 = new SqlDataAdapter(cmd1);
            DataTable      dt1  = new DataTable();
            adp1.Fill(dt1);
            //  txtUser.Text = PageMgmt.Decrypted(dt1.Rows[0]["Password"].ToString());
            if (dt1.Rows.Count > 0)
            {
                Session["Clientname"] = dt1.Rows[0]["CompanyName"].ToString();
                string strIjob = " SELECT        dbo.EmployeeMaster.* FROM dbo.EmployeeMaster INNER JOIN dbo.Syncr_LicenseEmployee_With_JobcenterId ON dbo.EmployeeMaster.EmployeeMasterID = dbo.Syncr_LicenseEmployee_With_JobcenterId.Jobcenter_Emp_id  where dbo.Syncr_LicenseEmployee_With_JobcenterId.License_Emp_id='" + Convert.ToString(dt1.Rows[0]["empid"]) + "' ";
                strIjob = " SELECT        dbo.EmployeeMaster.EmployeeMasterID, dbo.EmployeeMaster.PartyID, dbo.EmployeeMaster.DeptID, dbo.EmployeeMaster.DesignationMasterId, dbo.EmployeeMaster.StatusMasterId, dbo.EmployeeMaster.EmployeeTypeId, dbo.EmployeeMaster.DateOfJoin, dbo.EmployeeMaster.Address, dbo.EmployeeMaster.CountryId, dbo.EmployeeMaster.StateId, dbo.EmployeeMaster.City, dbo.EmployeeMaster.ContactNo, dbo.EmployeeMaster.Email, dbo.EmployeeMaster.AccountId, dbo.EmployeeMaster.AccountNo, dbo.EmployeeMaster.EmployeeName, dbo.EmployeeMaster.Whid,  dbo.EmployeeMaster.Description, dbo.EmployeeMaster.SuprviserId, dbo.EmployeeMaster.Active, dbo.EmployeeMaster.WorkPhone, dbo.EmployeeMaster.WorkExt, dbo.EmployeeMaster.WorkEmail, dbo.EmployeeMaster.EducationqualificationID, dbo.EmployeeMaster.SpecialSubjectID, dbo.EmployeeMaster.yearofexperience,  dbo.EmployeeMaster.Jobpositionid, dbo.EmployeeMaster.Sex, dbo.EmployeeMaster.Amount, dbo.EmployeeMaster.Payper, dbo.User_master.UserID FROM            dbo.EmployeeMaster INNER JOIN dbo.Syncr_LicenseEmployee_With_JobcenterId ON dbo.EmployeeMaster.EmployeeMasterID = dbo.Syncr_LicenseEmployee_With_JobcenterId.Jobcenter_Emp_id INNER JOIN dbo.User_master ON dbo.EmployeeMaster.PartyID = dbo.User_master.PartyID    where dbo.Syncr_LicenseEmployee_With_JobcenterId.License_Emp_id='" + Convert.ToString(dt1.Rows[0]["empid"]) + "'  ";
                //and IpAddress ='" + ipaddress + "'
                SqlCommand     cmdIjob = new SqlCommand(strIjob, con_Lice_Job);
                SqlDataAdapter adpIjob = new SqlDataAdapter(cmdIjob);
                DataTable      dtIjob  = new DataTable();
                adpIjob.Fill(dtIjob);
                if (dtIjob.Rows.Count > 0)
                {
                    Session["EmployeeId"]    = Convert.ToString(dtIjob.Rows[0]["EmployeeMasterID"]);
                    Session["DesignationId"] = Convert.ToString(dtIjob.Rows[0]["DesignationMasterId"]);
                    Session["Cname"]         = txtClientId.Text;
                    Session["Comid"]         = txtClientId.Text;
                    Session["verId"]         = "2056";
                    Session["PriceId"]       = "10444";
                    Session["PartyId"]       = Convert.ToString(dtIjob.Rows[0]["PartyId"]);
                    Session["UserId"]        = dtIjob.Rows[0]["UserID"].ToString();
                    Session["whid"]          = dtIjob.Rows[0]["Whid"].ToString();
                }

                SqlDataAdapter da4  = new SqlDataAdapter("SELECT DesignationName from DesignationMaster where DesignationMasterId='" + Session["DesignationId"] + "' ", con_Lice_Job);
                DataTable      desi = new DataTable();
                da4.Fill(desi);

                string         str11  = "Select * from EmployeeMaster  where EmployeeMaster.ClientId='" + txtClientId.Text + "' and  EmployeeMaster.Id='" + Convert.ToString(dt1.Rows[0]["empid"]) + "'  ";
                SqlCommand     cmd111 = new SqlCommand(str11, con);
                SqlDataAdapter adp11  = new SqlDataAdapter(cmd111);
                DataTable      dt11   = new DataTable();
                adp11.Fill(dt11);
                if (dt11.Rows.Count > 0)
                {
                    string pass = PageMgmt.Decrypted(dt1.Rows[0]["Password"].ToString());
                    Session["EmpId"]    = Convert.ToString(dt1.Rows[0]["empid"]);
                    Session["Login"]    = txtUser.Text; // "admin";
                    Session["ClientId"] = dt1.Rows[0]["clientId"].ToString();
                    //   Session["UserId"] = dt1.Rows[0]["UserId"].ToString();
                    Session["ClientName"] = dt1.Rows[0]["CompanyName"].ToString();
                    //Response.Redirect("afterLoginforClient.aspx");
                    Session["id"] = dt11.Rows[0]["Id"].ToString();
                    //if (dtIjob.Rows.Count > 0)
                    //{
                    //    Response.Redirect("afterLoginforClient.aspx");
                    Session["Login"] = txtUser.Text;
                    //}
                    //else
                    //{
                    //    Response.Redirect("afterLoginforClient.aspx");
                    //}

                    string         strIjob1 = @"SELECT  dbo.TBLUserLoginIpRestrictionPreference.MakeIPRestriction
                                                      FROM   dbo.EmployeeMaster 
                                                     INNER JOIN   dbo.Syncr_LicenseEmployee_With_JobcenterId ON dbo.EmployeeMaster.EmployeeMasterID = dbo.Syncr_LicenseEmployee_With_JobcenterId.Jobcenter_Emp_id
                                                     INNER JOIN dbo.User_master  ON dbo.EmployeeMaster.PartyID = dbo.User_master.PartyID
                                                     INNER JOIN  dbo.TBLUserLoginIpRestrictionPreference ON dbo.TBLUserLoginIpRestrictionPreference.userid = dbo.User_master.UserID 
                                                     where dbo.Syncr_LicenseEmployee_With_JobcenterId.License_Emp_id='" + Convert.ToString(dt1.Rows[0]["empid"]) + "' ";
                    SqlCommand     cmdIjob1 = new SqlCommand(strIjob1, con_Lice_Job);
                    SqlDataAdapter adpIjob1 = new SqlDataAdapter(cmdIjob1);
                    DataTable      dtIjob1  = new DataTable();
                    adpIjob1.Fill(dtIjob1);
                    if (dtIjob1.Rows.Count > 0)
                    {
                        if (dtIjob1.Rows[0][0].ToString() == "False")
                        {
                            if (desi.Rows.Count > 0)
                            {
                                SqlDataAdapter databusc = new SqlDataAdapter("SELECT dbo.DefaultAfterloginForDefaultRolesTBL.id, dbo.DefaultAfterloginForDefaultRolesTBL.DefaultDesignationTbl, dbo.DefaultDesignationTbl.DesignationName, dbo.DefaultAfterloginForDefaultRolesTBL.PagemasterID, dbo.DefaultAfterloginForDefaultRolesTBL.pagename, dbo.DefaultAfterloginForDefaultRolesTBL.VersionId FROM  dbo.DefaultDesignationTbl INNER JOIN dbo.DefaultAfterloginForDefaultRolesTBL ON dbo.DefaultDesignationTbl.Id = dbo.DefaultAfterloginForDefaultRolesTBL.DefaultDesignationTbl Where dbo.DefaultDesignationTbl.DesignationName='" + desi.Rows[0][0].ToString() + "'", PageConn.licenseconn());
                                DataTable      Datac    = new DataTable();
                                databusc.Fill(Datac);

                                if (Datac.Rows.Count > 0)
                                {
                                    string pnameu = Convert.ToString(Datac.Rows[0]["pagename"]);
                                    string pp     = "http://license.busiwiz.com/IOffice/ShoppingCart/Admin/" + pnameu + "";
                                    //Response.Redirect(pp);
                                    Response.Redirect("~/Clientadmin/AdminProjectMasterLB.aspx");
                                }
                                else
                                {
                                    //lblError.Text = "AfterLogin Page Is Not Available For Your Designetion";
                                    Response.Redirect("~/Clientadmin/AdminProjectMasterLB.aspx");
                                }
                            }
                            else
                            {
                                Response.Redirect("~/Clientadmin/AdminProjectMasterLB.aspx");
                            }
                        }
                        else
                        {
                            string         dd       = "  select * from IpControldetailtbl inner join IpControlMastertbl on IpControlMastertbl.IpcontrolId=IpControldetailtbl.IpcontrolId where  IpControlMastertbl.CID='" + Session["comid"] + "' and IpControldetailtbl.UserId='" + Session["UserId"] + "'  ";//and IpControldetailtbl.Ipaddress='" + ipaddress + "'
                            SqlCommand     cmdIjob2 = new SqlCommand(dd, con_Lice_Job);
                            SqlDataAdapter adpIjob2 = new SqlDataAdapter(cmdIjob2);
                            DataTable      dtIjob2  = new DataTable();
                            adpIjob2.Fill(dtIjob2);
                            if (dtIjob2.Rows.Count > 0)
                            {
                                SqlDataAdapter databusc = new SqlDataAdapter("SELECT dbo.DefaultAfterloginForDefaultRolesTBL.id, dbo.DefaultAfterloginForDefaultRolesTBL.DefaultDesignationTbl, dbo.DefaultDesignationTbl.DesignationName, dbo.DefaultAfterloginForDefaultRolesTBL.PagemasterID, dbo.DefaultAfterloginForDefaultRolesTBL.pagename, dbo.DefaultAfterloginForDefaultRolesTBL.VersionId FROM  dbo.DefaultDesignationTbl INNER JOIN dbo.DefaultAfterloginForDefaultRolesTBL ON dbo.DefaultDesignationTbl.Id = dbo.DefaultAfterloginForDefaultRolesTBL.DefaultDesignationTbl Where dbo.DefaultDesignationTbl.DesignationName='" + desi.Rows[0][0].ToString() + "'", PageConn.licenseconn());
                                DataTable      Datac    = new DataTable();
                                databusc.Fill(Datac);

                                if (Datac.Rows.Count > 0)
                                {
                                    string pnameu = Convert.ToString(Datac.Rows[0]["pagename"]);
                                    string pp     = "http://license.busiwiz.com/IOffice/ShoppingCart/Admin/" + pnameu + "";
                                    Response.Redirect(pp);
                                }
                                else
                                {
                                    //lblError.Text = "AfterLogin Page Is Not Available For Your Designetion";

                                    Response.Redirect("~/Clientadmin/AdminProjectMasterLB.aspx");
                                }
                            }
                            else
                            {
                                lblmsg.Visible = true;
                                lblmsg.Text    = "Invalid IP :" + ipaddress.ToString();
                            }
                        }
                    }
                    else
                    {
                        Response.Redirect("~/Clientadmin/AdminProjectMasterLB.aspx");
                    }
                }
            }
        }

        //}
        //catch (Exception e1)
        //{



        //}
        //finally
        //{

        //}

        //   if (txtUser.Text == "admin" && txtPassword.Text == "admin")
        //  {
        //}
        //else
        // {
        // }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        CheckDbConn();
        conn1.Close();
        string aa = "";



        DataTable st1 = select("select feildname,fieldtype,size,Isforeignkey,foreignkeytblid,foreignkeyfieldId,isprimarykey,notallownull from  tablefielddetail where TableId='" + Convert.ToInt32(ViewState["tableid"]) + "' ");

        if (st1.Rows.Count > 0)
        {
            for (int i = 0; i < st1.Rows.Count; i++)
            {
                int    f    = 0;
                string size = st1.Rows[i]["fieldtype"].ToString();
                string si   = "";
                if (size.ToString() == "int" || size.ToString() == "datetime" || size.ToString() == "bit")
                {
                    si = "";
                }
                else
                {
                    si = "(" + st1.Rows[i]["size"].ToString() + ")";
                }

                //(" + st1.Rows[i]["size"].ToString() + ")
                for (int j = 0; j < GridView9.Rows.Count; j++)
                {
                    string hh = GridView9.Rows[j].Cells[0].Text;
                    if (hh.ToString() == st1.Rows[i]["feildname"].ToString())
                    {
                        string null1 = st1.Rows[i]["notallownull"].ToString();
                        string pk    = st1.Rows[i]["isprimarykey"].ToString();
                        string nn    = " NOT NULL";
                        if (null1.ToString() == "False")
                        {
                            nn = " IDENTITY(1,1) NOT NULL";
                        }
                        else
                        {
                            nn = "NULL";
                        }



                        if (pk.ToString() == "True")
                        {
                            //aa = "" + st1.Rows[0]["feildname"].ToString() + " [" + st1.Rows[0]["fieldtype"].ToString() + "] " + nn + "";
                            //string createtable = "ALTER TABLE [dbo]." + ViewState["TableName"].ToString() + " Alter Column " + aa + "";
                            //SqlCommand cmdf = new SqlCommand(createtable, conn1);

                            //cmdf.ExecuteNonQuery();
                            //conn1.Close();
                        }
                        else
                        {
                            aa = "" + st1.Rows[i]["feildname"].ToString() + " [" + st1.Rows[i]["fieldtype"].ToString() + "] " + si + " " + nn + "";
                            string     createtable = "ALTER TABLE [dbo]." + ViewState["TableName"].ToString() + " Alter Column " + aa + "";
                            SqlCommand cmdf        = new SqlCommand(createtable, conn1);
                            conn1.Open();
                            cmdf.ExecuteNonQuery();
                            conn1.Close();
                        }
                        f = 1;
                        break;
                    }
                }
                if (f == 0)
                {
                    string null1 = st1.Rows[i]["notallownull"].ToString();

                    string nn = "NOT NULL";
                    if (null1.ToString() == "False")
                    {
                        nn = "NOT NULL";
                    }
                    else
                    {
                        nn = "NULL";
                    }
                    aa = "" + st1.Rows[i]["feildname"].ToString() + " [" + st1.Rows[i]["fieldtype"].ToString() + "] " + si + " " + nn + "";
                    string     createtable = "ALTER TABLE [dbo]." + ViewState["TableName"].ToString() + " ADD " + aa + "";
                    SqlCommand cmdf        = new SqlCommand(createtable, conn1);
                    conn1.Open();
                    cmdf.ExecuteNonQuery();
                    conn1.Close();
                }
            }
        }

        //DataTable st = select("select feildname,fieldtype,size,Isforeignkey,foreignkeytblid,foreignkeyfieldId,isprimarykey,notallownull from  tablefielddetail where TableId='" + Convert.ToInt32(ViewState["tableid"]) + "' and isprimarykey=0");
        //if (st.Rows.Count > 0)
        //{
        //    for (int i = 0; i < st.Rows.Count; i++)
        //    {
        //        string null1 = st.Rows[i]["notallownull"].ToString();
        //        string nn = "NOT NULL";
        //        if (null1.ToString() == "True")
        //        {
        //            nn = "NULL";
        //        }
        //        else
        //        {
        //            nn = "NOT NULL";
        //        }
        //        string bb = "";
        //        if (st.Rows[i]["fieldtype"].ToString() == "int")
        //        {
        //            bb = "" + st.Rows[i]["feildname"].ToString() + " [" + st.Rows[i]["fieldtype"].ToString() + "] " + nn + "";
        //        }
        //        else
        //        {
        //            bb = "" + st.Rows[i]["feildname"].ToString() + " [" + st.Rows[i]["fieldtype"].ToString() + "] (" + st.Rows[i]["size"].ToString() + ") " + nn + "";
        //        }


        //        aa = "" + aa + "," + bb + "";
        //    }
        //}

        //string createtable = "ALTER TABLE [dbo]." + ViewState["TableName"].ToString() + " ADD (" + aa + ")";
        //SqlCommand cmdf = new SqlCommand(createtable, conn1);

        //cmdf.ExecuteNonQuery();
        //conn1.Close();


        DataTable dtconn = select(@"SELECT ServerMasterTbl.ServerName,ServerMasterTbl.port,ServerMasterTbl.sqlserveruserid,ServerMasterTbl.Sapassword,Instancename 
                                     FROM ServerMasterTbl INNER JOIN ClientMaster ON ServerMasterTbl.Id = ClientMaster.ServerId inner join ProductMaster on ProductMaster.ClientID=ClientMaster.ClientMasterId
                                     inner join VersionInfoMaster on VersionInfoMaster.ProductId=ProductMaster.ProductId inner join CodeTypeTbl on CodeTypeTbl.ProductVersionId=VersionInfoMaster.VersionInfoId  where CodeTypeTbl.ProductCodeDetailId='" + ViewState["databaseid"] + "'");
        string    strcln = " SELECT DISTINCT dbo.ProductCodeDetailTbl.Id, dbo.ProductCodeDetailTbl.ProductId, dbo.ProductCodeDetailTbl.CodeTypeName FROM dbo.CodeTypeTbl INNER JOIN dbo.CodeTypeCategory ON dbo.CodeTypeCategory.CodeMasterNo = dbo.CodeTypeTbl.CodeTypeCategoryId INNER JOIN dbo.ProductCodeDetailTbl ON dbo.CodeTypeTbl.ProductCodeDetailId = dbo.ProductCodeDetailTbl.Id where  ProductCodeDetailTbl.Active='1' and ProductCodeDetailTbl.Id='" + ViewState["databaseid"] + "' and CodeTypeCategory.Id='2'  order  by dbo.ProductCodeDetailTbl.CodeTypeName ";
        // string strcln = " SELECT DISTINCT dbo.ProductCodeDetailTbl.Id, dbo.ProductCodeDetailTbl.ProductId, dbo.ProductCodeDetailTbl.CodeTypeName FROM dbo.CodeTypeTbl INNER JOIN dbo.CodeTypeCategory ON dbo.CodeTypeCategory.CodeMasterNo = dbo.CodeTypeTbl.CodeTypeCategoryId INNER JOIN dbo.ProductCodeDetailTbl ON dbo.CodeTypeTbl.ProductCodeDetailId = dbo.ProductCodeDetailTbl.Id where  CodeTypeTbl.ProductVersionId='" + ddlProductVersion.SelectedValue + "' ";
        SqlCommand     cmdcln = new SqlCommand(strcln, con);
        DataTable      dtcln  = new DataTable();
        SqlDataAdapter adpcln = new SqlDataAdapter(cmdcln);

        adpcln.Fill(dtcln);
        string    server = "" + dtconn.Rows[0]["ServerName"] + "\\" + dtconn.Rows[0]["Instancename"] + "";
        DataTable dtui   = select("select category from ClientProductTableMaster where Id='" + Convert.ToInt32(ViewState["tableid"]) + "'");

        if (dtui.Rows[0][0].ToString() == "2")
        {
            string te = "scriptadd.aspx?server=" + PageMgmt.Encrypted(server.ToString()) + "&database=" + dtcln.Rows[0]["CodeTypeName"].ToString() + "&tablename=" + ViewState["TableName"].ToString() + "&productid=" + ViewState["productid"].ToString() + "&data=1";
            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open('" + te + "');", true);
        }
        else
        {
            string te = "scriptadd.aspx?server=" + PageMgmt.Encrypted(server.ToString()) + "&database=" + dtcln.Rows[0]["CodeTypeName"].ToString() + "&tablename=" + ViewState["TableName"].ToString() + "&productid=" + ViewState["productid"].ToString() + "&data=2";
            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open('" + te + "');", true);
        }
        ModalPopupExtender1.Hide();
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        string st789 = "select * from EmployeeMaster where  ClientId='" + Session["ClientId"].ToString() + "' and UserId='" + txtusername.Text + "'  and Id<> '" + ViewState["Id"] + "' ";

        SqlCommand     cmd789 = new SqlCommand(st789, con);
        SqlDataAdapter ds789  = new SqlDataAdapter(cmd789);
        DataTable      dt789  = new DataTable();

        ds789.Fill(dt789);
        if (dt789.Rows.Count > 0)
        {
            lblmsg.Visible = true;
            lblmsg.Text    = "Sorry, This UserName Is Not Available";
        }
        else
        {
            Button3.Visible = false;
            Button1.Visible = true;

            string str1 = "select * from EmployeeMaster where Name='" + txtempname.Text + "'  and ClientId='" + Session["ClientId"].ToString() + "' and UserId='" + txtusername.Text + "' and Id<> '" + ViewState["Id"] + "'   ";

            SqlCommand     cmd1 = new SqlCommand(str1, con);
            SqlDataAdapter da1  = new SqlDataAdapter(cmd1);
            DataTable      dt1  = new DataTable();
            da1.Fill(dt1);
            if (dt1.Rows.Count > 0)
            {
                lblmsg.Visible = true;
                lblmsg.Text    = "Record already exists";
            }
            else
            {
                string     sr51   = ("update EmployeeMaster set Name='" + txtempname.Text + "',FTPServerURL='" + txtftpserverurl.Text + "' ,FTPPort='" + txtftpport.Text + "',FTPUserId='" + txtftpuserid.Text + "',FTPPassword='******',SupervisorId='" + ddlsupervisor.SelectedValue + "',DesignationId='" + ddldesignation.SelectedValue + "',UserId='" + txtusername.Text + "',Password='******',Active='" + CheckBox1.Checked + "',PhoneNo='" + txtphoneno.Text + "',PhoneExtension='" + txtphoneextension.Text + "',MobileNo='" + txtmobileno.Text + "',CountryId='" + ddlcountry.SelectedValue + "',StateId='" + ddlstate.SelectedValue + "',City='" + txtcity.Text + "',Email='" + txtemail.Text + "',Zipcode='" + txtzipcode.Text + "',RoleId='" + ddlrolename.SelectedValue + "',EffectiveRate='" + txteffectiverate.Text + "' where Id= '" + ViewState["Id"] + "' ");
                SqlCommand cmd801 = new SqlCommand(sr51, con);
                con.Open();
                cmd801.ExecuteNonQuery();
                con.Close();

                int i = 0;


                string         str11 = "select * from Emp_IP where EmpId='" + ViewState["Id"] + "' ";
                SqlCommand     cmd11 = new SqlCommand(str11, con);
                SqlDataAdapter da11  = new SqlDataAdapter(cmd11);
                DataTable      dt11  = new DataTable();
                da11.Fill(dt11);

                while (i < ListBox1.Items.Count)
                {
                    if (i < dt11.Rows.Count)
                    {
                        if (dt11.Rows[i]["Id"] != "0" || dt11.Rows[i]["Id"] != null)
                        {
                            string     str    = "Update Emp_IP Set EmpId='" + ViewState["Id"] + "',IpAddress='" + ListBox1.Items[i].Text + "' where Id='" + dt11.Rows[i]["Id"] + "'";
                            SqlCommand cmd112 = new SqlCommand(str, con);
                            con.Open();
                            cmd112.ExecuteNonQuery();
                            con.Close();
                        }
                    }
                    else
                    {
                        string     str    = "Insert Into Emp_IP (EmpId,IpAddress)values('" + ViewState["Id"] + "','" + ListBox1.Items[i].Text + "')";
                        SqlCommand cmd112 = new SqlCommand(str, con);
                        con.Open();
                        cmd112.ExecuteNonQuery();
                        con.Close();
                    }
                    i++;
                }



                string     str123 = ("update clientLoginMaster set UserId='" + txtusername.Text + "',Password='******' where UserId='" + ViewState["UserId"].ToString() + "' and clientId='" + Session["ClientId"].ToString() + "' ");
                SqlCommand cmd123 = new SqlCommand(str123, con);
                con.Open();
                cmd123.ExecuteNonQuery();
                con.Close();

                con.Close();
                con.Open();
                string     insertdatabase = " Update User_Role SET  Role_id=" + ddlrolename.SelectedValue + " Where User_id='" + ViewState["Id"].ToString() + "' ";
                SqlCommand cmdRole        = new SqlCommand(insertdatabase, con);
                cmdRole.ExecuteNonQuery();
                con.Close();


                GridView1.EditIndex = -1;
                Fillgrid();

                clearall();
                lblmsg.Visible  = true;
                lblmsg.Text     = "Record updated successfully";
                btnEdit.Visible = false;

                addnewpanel.Visible = true;
                pnladdnew.Visible   = false;
                lbllgng.Text        = "";
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string st789 = "select * from EmployeeMaster where  ClientId='" + Session["ClientId"].ToString() + "' and UserId='" + txtusername.Text + "'   ";

        SqlCommand     cmd789 = new SqlCommand(st789, con);
        SqlDataAdapter ds789  = new SqlDataAdapter(cmd789);
        DataTable      dt789  = new DataTable();

        ds789.Fill(dt789);
        if (dt789.Rows.Count > 0)
        {
            lblmsg.Visible = true;
            lblmsg.Text    = "Sorry, This User Id Is Not Available";
        }
        else
        {
            string str1 = "select * from EmployeeMaster where Name='" + txtempname.Text + "'  and ClientId='" + Session["ClientId"].ToString() + "' and UserId='" + txtusername.Text + "'   ";

            SqlCommand     cmd1 = new SqlCommand(str1, con);
            SqlDataAdapter da1  = new SqlDataAdapter(cmd1);
            DataTable      dt1  = new DataTable();
            da1.Fill(dt1);
            if (dt1.Rows.Count > 0)
            {
                lblmsg.Visible = true;
                lblmsg.Text    = "Record already exists";
            }
            else
            {
                string     SubMenuInsert = "Insert Into EmployeeMaster (Name,FTPServerURL,FTPPort,FTPUserId,FTPPassword,SupervisorId,DesignationId,UserId,Password,Active,ClientId,PhoneNo,PhoneExtension,MobileNo,CountryId,StateId,City,Email,Zipcode,RoleId,EffectiveRate) values ('" + txtempname.Text + "','" + txtftpserverurl.Text + "','" + txtftpport.Text + "','" + txtftpuserid.Text + "','" + PageMgmt.Encrypted(txtftppassword.Text) + "','" + ddlsupervisor.SelectedValue + "','" + ddldesignation.SelectedValue + "','" + txtusername.Text + "','" + PageMgmt.Encrypted(txtpassword.Text) + "','" + CheckBox1.Checked + "','" + Session["ClientId"].ToString() + "','" + txtphoneno.Text + "','" + txtphoneextension.Text + "','" + txtmobileno.Text + "','" + ddlcountry.SelectedValue + "','" + ddlstate.SelectedValue + "','" + txtcity.Text + "','" + txtemail.Text + "','" + txtzipcode.Text + "','" + ddlrolename.SelectedValue + "','" + txteffectiverate.Text + "')";
                SqlCommand cmd           = new SqlCommand(SubMenuInsert, con);
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();


                string str2 = "select MAX(Id) as EmpID from EmployeeMaster where EmployeeMaster.ClientId='" + Session["ClientId"].ToString() + "'";

                SqlCommand     cmd2 = new SqlCommand(str2, con);
                SqlDataAdapter adp2 = new SqlDataAdapter(cmd2);
                DataSet        ds2  = new DataSet();
                adp2.Fill(ds2);
                int i = 0;
                while (i < ListBox1.Items.Count)
                {
                    ViewState["Id"] = ds2.Tables[0].Rows[0]["EmpID"].ToString();

                    string     str   = "Insert Into Emp_IP (EmpId,IpAddress)values('" + ds2.Tables[0].Rows[0]["EmpID"] + "','" + ListBox1.Items[i].Text + "')";
                    SqlCommand cmd11 = new SqlCommand(str, con);
                    con.Open();
                    cmd11.ExecuteNonQuery();
                    con.Close();
                    i++;
                }
                string     ClientInsert = "Insert Into clientLoginMaster (clientId,UserId,Password) values ('" + Session["ClientId"].ToString() + "','" + txtusername.Text + "','" + PageMgmt.Encrypted(txtpassword.Text) + "') ";
                SqlCommand cmd1123      = new SqlCommand(ClientInsert, con);
                con.Open();
                cmd1123.ExecuteNonQuery();
                con.Close();


                con.Close();
                con.Open();
                string     insertdatabase = "insert into User_Role (User_id,Role_id,ActiveDeactive)values(" + ViewState["Id"] + "," + ddlrolename.SelectedValue + ",'1')";
                SqlCommand cmdRole        = new SqlCommand(insertdatabase, con);
                cmdRole.ExecuteNonQuery();
                con.Close();


                Button1_ClickSyncronice(sender, e);//ioffice

                clearall();
                Fillgrid();
                lblmsg.Visible = true;
                lblmsg.Text    = "Record inserted successfully";

                addnewpanel.Visible = true;
                pnladdnew.Visible   = false;
                lbllgng.Text        = "";
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //string comid = BZ_Common.BZ_Encrypted("zzzzpp");
        if (!IsPostBack)
        {
            if (Request.QueryString["uid"] != null && Request.QueryString["pwd"] != null && Request.QueryString["cid"] != null)
            {
                //http://license.busiwiz.com/DNSentry.aspx?uid=6CAPiQfUhC7BELibxx9a8Q==&pwd=6CAPiQfUhC7BELibxx9a8Q==&cid=6CAPiQfUhC7BELibxx9a8Q==
                string cid = Request.QueryString["cid"].ToString().ToString().Replace(" ", "+");
                // cid = BZ_Common.BZ_Decrypted(cid);

                string uid = Request.QueryString["uid"].ToString().ToString().Replace(" ", "+");
                // uid = BZ_Common.BZ_Decrypted(uid);

                string pwd = Request.QueryString["pwd"].ToString().ToString().Replace(" ", "+");
                // pwd = BZ_Common.BZ_Decrypted(pwd);


                if (Request.QueryString["Id"] != null && Request.QueryString["status"] != null)
                {
                    string idNeedCode = Request.QueryString["Id"].ToString().ToString().Replace(" ", "+");
                    // idNeedCode = BZ_Common.BZ_Encrypted(cid);
                    SqlCommand cmd = new SqlCommand(" update CompanyCreationNeedCode  set DNSAddingStatus='" + Request.QueryString["status"] + "' where id='" + idNeedCode + "'", con);
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                }


                string    ipaddress          = "";                                                                                                                                                                                            // "72.38.84.98";
                string    dnsServerName      = Environment.MachineName;                                                                                                                                                                       // c3
                string    dnsentryservername = "";                                                                                                                                                                                            //c3.safestserver.com
                DataTable dtserver           = MyCommonfile.selectBZ("Select ServerMasterTbl.* from CompanyMaster inner join ServerMasterTbl on ServerMasterTbl.Id=CompanyMaster.ServerId where CompanyMaster.CompanyLoginId='" + cid + "'"); //serverdetail(cid);
                if (dtserver.Rows.Count > 0)
                {
                    ipaddress          = dtserver.Rows[0]["ipaddress"].ToString();//Publicip
                    dnsentryservername = dtserver.Rows[0]["Busiwizsatellitesiteurl"].ToString();

                    string sqlservername       = dtserver.Rows[0]["sqlurl"].ToString();
                    string defaultinstancename = dtserver.Rows[0]["DefaultsqlInstance"].ToString();
                    string sqlserverport       = dtserver.Rows[0]["port"].ToString();
                    string defaultdatabasename = dtserver.Rows[0]["DefaultDatabaseName"].ToString();
                    string sapassword          = PageMgmt.Decrypted(dtserver.Rows[0]["Sapassword"].ToString());
                    condefaultinstance = new SqlConnection();

                    condefaultinstance.ConnectionString = @"Data Source =" + sqlservername + "\\" + defaultinstancename + "," + sqlserverport + "; Initial Catalog = " + defaultdatabasename + "; User ID=sa; Password="******"; Persist Security Info=true; ";
                    condefaultinstance.Close();
                    // condefaultinstance.ConnectionString = @"Data Source =192.168.2.100,40000; Initial Catalog = C3SATELLITESERVER; User ID=sa; Password=06De1963++; Persist Security Info=true; ";
                    if (condefaultinstance.State.ToString() != "Open")
                    {
                        condefaultinstance.Open();
                    }
                    condefaultinstance.Close();
                    ipaddress = dtserver.Rows[0]["PublicIp"].ToString();
                    DataTable dtzoneweb = MyCommonfile.selectBZ(" Select Top(1) * From CompanyCreationNeedCode where CodeTypeCategoryId=1 and CompanyLoginId='" + cid + "' and (DNSAddingStatus IS NULL OR  DNSAddingStatus=0)");// SearchDNS(cid);
                    foreach (DataRow dr in dtzoneweb.Rows)
                    {
                        string    CodeDetailId   = dr["CodeDetailId"].ToString();
                        DataTable DNSWebsiteName = MyCommonfile.selectBZ(" SELECT Top(1) dbo.WebsiteMaster.ID, dbo.ClientMaster.ClientURL,dbo.ServerMasterTbl.Id as sid, dbo.CodeTypeTbl.ID AS CodeTypeID, dbo.ProductCodeDetailTbl.Id AS CodeDetailID, dbo.WebsiteMaster.DNSserver, dbo.WebsiteMaster.DNSname, dbo.ServerMasterTbl.Busiwizsatellitesiteurl,dbo.ServerMasterTbl.PublicIp,dbo.ServerMasterTbl.Ipaddress FROM dbo.VersionInfoMaster INNER JOIN dbo.ProductMaster ON dbo.VersionInfoMaster.ProductId = dbo.ProductMaster.ProductId INNER JOIN dbo.WebsiteMaster INNER JOIN dbo.CodeTypeTbl ON dbo.WebsiteMaster.ID = dbo.CodeTypeTbl.WebsiteID INNER JOIN dbo.ProductCodeDetailTbl ON dbo.CodeTypeTbl.ProductCodeDetailId = dbo.ProductCodeDetailTbl.Id INNER JOIN dbo.ServerMasterTbl ON dbo.WebsiteMaster.DNSserver = dbo.ServerMasterTbl.Id ON dbo.VersionInfoMaster.VersionInfoId = dbo.CodeTypeTbl.ProductVersionId INNER JOIN dbo.ClientMaster ON dbo.ProductMaster.ClientMasterId = dbo.ClientMaster.ClientMasterId Where ProductCodeDetailTbl.ID='" + CodeDetailId + "' ");
                        if (DNSWebsiteName.Rows.Count > 0)
                        {
                            string ds_Com_ServerId   = DNSWebsiteName.Rows[0]["sid"].ToString();
                            string domainName        = DNSWebsiteName.Rows[0]["DNSname"].ToString();
                            string arecord           = cid;
                            string ipDestination     = DNSWebsiteName.Rows[0]["PublicIp"].ToString();
                            string ipaddres          = DNSWebsiteName.Rows[0]["Ipaddress"].ToString();
                            string Comp_serverweburl = DNSWebsiteName.Rows[0]["Busiwizsatellitesiteurl"].ToString();
                            string sateliteserversilentpagerequesttblid = "0";
                            //bool update = CompanyRelated.Update_CompanyCreationNeedCode(dr["Id"].ToString(), true);

                            string pagename = "http://" + Comp_serverweburl + "/Satelliteservfunction.aspx?domainName=" + BZ_Common.BZ_Encrypted(domainName) + "&arecord=" + BZ_Common.BZ_Encrypted(arecord) + "&ipDestination=" + BZ_Common.BZ_Encrypted(ipDestination) + "&ipaddres=" + BZ_Common.BZ_Encrypted(ipaddres) + "&sateliteserversilentpagerequesttblid=" + sateliteserversilentpagerequesttblid + "&uid=" + Request.QueryString["uid"] + "&pwd=" + Request.QueryString["pwd"] + "&cid=" + Request.QueryString["cid"] + "&Id=" + dr["Id"].ToString() + "";
                            // Response.Redirect("" + pagename + "");

                            string ClientURL     = DNSWebsiteName.Rows[0]["ClientURL"].ToString() + "//Silent_CompanyCreationDNSInfoUpdate.aspx?p2=" + dr["Id"].ToString();
                            string pagenamemainY = "Satelliteservfunction.aspx?domainName=" + BZ_Common.BZ_Encrypted(domainName) + "&arecord=" + BZ_Common.BZ_Encrypted(arecord) + "&ipDestination=" + BZ_Common.BZ_Encrypted(ipDestination) + "&ipaddres=" + BZ_Common.BZ_Encrypted(ipaddres) + "&sateliteserversilentpagerequesttblid=" + BZ_Common.BZ_Encrypted(sateliteserversilentpagerequesttblid) + "&uid=" + Request.QueryString["uid"] + "&pwd=" + Request.QueryString["pwd"] + "&cid=" + Request.QueryString["cid"] + "&Id=" + dr["Id"].ToString() + "";
                            //Page X
                            string mycurrenturlX          = Request.Url.AbsoluteUri;
                            Random random                 = new Random();
                            int    randomNumber           = random.Next(1, 10);
                            string Randomkeyid            = Convert.ToString(randomNumber);
                            string SilentPageRequestTblID = CompanyRelated.Insert_SilentPageRequestTbl(ds_Com_ServerId, pagenamemainY, DateTime.Now.ToString(), "", false, Randomkeyid, mycurrenturlX);
                            string url = "";
                            //Decrypted_DasdasdasdadynamicKey
                            url = "http://" + Comp_serverweburl + "/vfysrv.aspx?licensesilentpagerequesttblid=" + BZ_Common.Encrypted_DasdasdasdadynamicKey(SilentPageRequestTblID, Randomkeyid) + "&pageredirecturl=" + BZ_Common.Encrypted_DasdasdasdadynamicKey(pagenamemainY, Randomkeyid) + "&mstrsrvky=" + BZ_Common.Encrypted_DasdasdasdadynamicKey(BZ_Common.satsrvencryky(), Randomkeyid) + "&returnurl=" + ClientURL + "&rnkendecke=" + Randomkeyid + "";
                            Response.Redirect("" + pagename + "");

                            //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open( '" + pagename + "');", true);
                        }
                        else
                        {
                            lblmsg.Text = "Need to refress again ";
                        }
                    }
                }
                else
                {
                    lblmsg.Text = "No Record found for " + cid + " compay";
                }
                DataTable dtzoneweb1 = MyCommonfile.selectBZ(" Select Top(1) * From CompanyCreationNeedCode where AdditionalPageInserted=1 and CompanyLoginId='" + cid + "'");// SearchDNS(cid);
                foreach (DataRow dr in dtzoneweb1.Rows)
                {
                    string    CodeDetailId    = dr["CodeDetailId"].ToString();
                    string    DNSname         = dr["DNSname"].ToString();
                    DataTable DNSWebsiteName2 = MyCommonfile.selectBZ(" SELECT Top(1) dbo.WebsiteMaster.ID, dbo.ClientMaster.ClientURL,dbo.ServerMasterTbl.Id as sid, dbo.CodeTypeTbl.ID AS CodeTypeID, dbo.ProductCodeDetailTbl.Id AS CodeDetailID, dbo.WebsiteMaster.DNSserver, dbo.WebsiteMaster.DNSname, dbo.ServerMasterTbl.Busiwizsatellitesiteurl,dbo.ServerMasterTbl.PublicIp,dbo.ServerMasterTbl.Ipaddress FROM dbo.VersionInfoMaster INNER JOIN dbo.ProductMaster ON dbo.VersionInfoMaster.ProductId = dbo.ProductMaster.ProductId INNER JOIN dbo.WebsiteMaster INNER JOIN dbo.CodeTypeTbl ON dbo.WebsiteMaster.ID = dbo.CodeTypeTbl.WebsiteID INNER JOIN dbo.ProductCodeDetailTbl ON dbo.CodeTypeTbl.ProductCodeDetailId = dbo.ProductCodeDetailTbl.Id INNER JOIN dbo.ServerMasterTbl ON dbo.WebsiteMaster.DNSserver = dbo.ServerMasterTbl.Id ON dbo.VersionInfoMaster.VersionInfoId = dbo.CodeTypeTbl.ProductVersionId INNER JOIN dbo.ClientMaster ON dbo.ProductMaster.ClientMasterId = dbo.ClientMaster.ClientMasterId Where ProductCodeDetailTbl.ID='" + CodeDetailId + "' ");
                    DataTable DNSWebsiteName  = MyCommonfile.selectBZ(" SELECT dbo.CompanyMaster.CompanyName, dbo.CompanyMaster.YourDomaiUrl,  dbo.CompanyMaster.CompanyLoginId, dbo.PortalMasterTbl.PortalName FROM dbo.CompanyMaster INNER JOIN dbo.PricePlanMaster ON dbo.PricePlanMaster.PricePlanId = dbo.CompanyMaster.PricePlanId INNER JOIN dbo.Priceplancategory ON dbo.PricePlanMaster.PriceplancatId = dbo.Priceplancategory.ID INNER JOIN dbo.PortalMasterTbl ON dbo.Priceplancategory.PortalId = dbo.PortalMasterTbl.Id where  CompanyMaster.CompanyLoginId='" + cid + "'");
                    if (DNSWebsiteName.Rows.Count > 0)
                    {
                        string PortalName = DNSWebsiteName.Rows[0]["PortalName"].ToString();
                    }
                }

                //string str = " SELECT CompanyMaster.*, PortalMasterTbl.PortalName,PricePlanMaster.VersionInfoMasterId,PricePlanMaster.Producthostclientserver from CompanyMaster inner join PricePlanMaster on PricePlanMaster.PricePlanId=CompanyMaster.PricePlanId inner join PortalMasterTbl on PricePlanMaster.PortalMasterId1 = PortalMasterTbl.id where CompanyLoginId='" + cid + "' ";
                //SqlCommand cmd = new SqlCommand(str, con);
                //SqlDataAdapter adp = new SqlDataAdapter(cmd);
                //DataTable ds = new DataTable();
                //adp.Fill(ds);
                //string portalnamezone = ds.Rows[0]["PortalName"].ToString();
                //DataTable dtzone = companydetail(cid);
                //if (dtzone.Rows.Count > 0)
                //{
                //    foreach (DataRow dr in dtzone.Rows)
                //    {
                //        string zone = dr["WebsiteURL"].ToString();//
                //        try
                //        {
                //            AddARecord(cid.ToString(), zone, ipaddress, dnsServerName, dnsentryservername);
                //            AddARecordportal(cid.ToString(), portalnamezone, ipaddress, dnsServerName, dnsentryservername);
                //        }
                //        catch
                //        {
                //        }
                //    }
                //}
                //DataTable dtmainurl = maincompanyurl(cid);
                //if (dtmainurl.Rows.Count > 0)
                //{
                //    string compnayurl = dtmainurl.Rows[0]["CodeType"].ToString();
                //}
                insertstatus("8", "1", cid);
                Response.Redirect("http://members.busiwiz.com/Companyconfigureinfo.aspx?comid=" + PageMgmt.Encrypted(cid) + "");
            }
            else
            {
                lblmsg.Text = "Need to refress again ";
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     //5  10090  xxxxaa   sid=kdQMwcj0lE8=&versionid=v6GFOsFGdZ8=&compid=XV/A1eFDsSQ=
     //  Response.Redirect("http://license.busiwiz.com/Silent_CompanyCodeCreateTransfer.aspkx?sid=" + PageMgmt.Encrypted("5") + "&versionid=" + PageMgmt.Encrypted("10090") + "&compid=" + PageMgmt.Encrypted("xxxxaa"));
     if (!IsPostBack)
     {
         if (Request.QueryString["sid"] != null && Request.QueryString["comid"] != null)
         {
             string sid    = PageMgmt.Decrypted(Request.QueryString["sid"].ToString());
             string compid = PageMgmt.Decrypted(Request.QueryString["comid"].ToString());
             //-----------------------------------------------------------------------------------------------------------
             string         str = " SELECT dbo.CompanyMaster.CompanyLoginId, dbo.ServerMasterTbl.Id, dbo.PricePlanMaster.PricePlanId, dbo.PricePlanMaster.VersionInfoMasterId FROM dbo.CompanyMaster INNER JOIN dbo.PricePlanMaster ON dbo.CompanyMaster.PricePlanId = dbo.PricePlanMaster.PricePlanId INNER JOIN dbo.ServerMasterTbl ON dbo.CompanyMaster.ServerId = dbo.ServerMasterTbl.Id  where CompanyMaster.CompanyLoginId='" + compid + "' and dbo.ServerMasterTbl.Id='" + sid + "' ";
             SqlCommand     cmd = new SqlCommand(str, con);
             SqlDataAdapter adp = new SqlDataAdapter(cmd);
             DataTable      ds  = new DataTable();
             adp.Fill(ds);
             if (ds.Rows.Count > 0)
             {
                 string versionid = ds.Rows[0]["VersionInfoMasterId"].ToString();
                 FristtimeSyncroTable_Detail(sid, versionid);
                 GenerateGrid(sid, versionid);
                 SeprateDatabase(sid, versionid);
                 // string Comp_ServEnckey = ds.Rows[0]["Enckey"].ToString();
                 //  string url = "http://" + lbl_serverurl.Text + "/ServerNewCompanyCreationPageNEW.aspx?cid=" + compid + "&sid=" + sid + "";
                 //  Response.Redirect("" + url + "");
             }
             else
             {
                 lblmsg.Text = "No record available for  ";
             }
             Response.Redirect("http://members.busiwiz.com/Companyconfigureinfo.aspx?comid=" + Request.QueryString["comid"].ToString() + "");
         }
         else
         {
             Response.Redirect("~/Silent_NewServerTable_Data_Transfer.aspx?sid=" + PageMgmt.Encrypted("5") + "&comid=" + PageMgmt.Encrypted("N666"));
         }
     }
 }
    protected void DynamicalyTable(string tanlename)
    {
        string    Temp2    = "INSERT INTO " + tanlename + "(  ";
        string    Temp3val = "";
        DataTable dts1     = selectBZ("select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tanlename + "'");

        for (int k = 0; k < dts1.Rows.Count; k++)
        {
            Temp2 += ("" + dts1.Rows[k]["column_name"] + " ,");
        }
        Temp2  = Temp2.Remove(Temp2.Length - 1);
        Temp2 += ") VAlues";
        DataTable dtr = selectBZ(" Select * From " + tanlename + " ");
        int       c   = 0;

        foreach (DataRow itm in dtr.Rows)
        {
            string    cccd   = "(";
            DataTable dtsccc = selectBZ("select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tanlename + "'");
            for (int k = 0; k < dtsccc.Rows.Count; k++)
            {
                cccd += "'" + PageMgmt.Encrypted(Convert.ToString(itm["" + dtsccc.Rows[k]["column_name"] + ""])) + "' ,";
            }
            cccd  = cccd.Remove(cccd.Length - 1);
            cccd += " )";
            c++;
            if (c == 199)
            {
                c = 0;
                if (Temp3val.Length > 0)
                {
                    Temp3val += ",";
                }
                Temp3val += cccd;
                if (Temp3val.Length > 0)
                {
                    string     tempstr = Temp2 + Temp3val;
                    SqlCommand ccm     = new SqlCommand(tempstr, conn);
                    conn.Open();
                    ccm.ExecuteNonQuery();
                    conn.Close();
                }
                cccd     = "";
                Temp3val = "";
            }
            if (Temp3val.Length > 0)
            {
                Temp3val += ",";
            }
            Temp3val += cccd;
            //Temp3val += "('" + Encrypted(Convert.ToString(itm["MasterPageId"])) + "','" + Encrypted(Convert.ToString(itm["MasterPageName"])) + "','" + Encrypted(Convert.ToString(itm["MasterPageDescription"])) + "','" + Encrypted(Convert.ToString(itm["WebsiteSectionId"])) + "')";
        }
        if (Temp3val.Length > 0)
        {
            Temp2 += Temp3val;
            SqlCommand ccm = new SqlCommand(Temp2, conn);
            conn.Open();
            ccm.ExecuteNonQuery();
            conn.Close();
        }
    }