protected void btnsyncsilent_Click(object sender, EventArgs e) { DataTable ds = MyCommonfile.selectBZ(" Select dbo.ClientMaster.ClientURL,dbo.ServerMasterTbl.* From dbo.ServerMasterTbl INNER JOIN dbo.ClientMaster ON dbo.ServerMasterTbl.Id = dbo.ClientMaster.ServerId Where dbo.ServerMasterTbl.Id='" + ddlserver.SelectedValue + "' "); if (ds.Rows.Count > 0) { lblmsg.Text = ""; //Timer1.Enabled = true; //Paneldoc.Visible = true; string sqlCompport28 = ds.Rows[0]["PortforCompanymastersqlistance"].ToString();//2810 string Comp_serverweburl = ds.Rows[0]["Busiwizsatellitesiteurl"].ToString(); string sqlserverport = ds.Rows[0]["port"].ToString(); string mycurrenturlX = Request.Url.AbsoluteUri; Random random = new Random(); int randomNumber = random.Next(1, 10); string Randomkeyid = Convert.ToString(randomNumber); string ClientURL = ds.Rows[0]["ClientURL"].ToString(); string pagenamemainY = "Satelliteservfunction.aspx?PO=OpenPort&PortNo=" + BZ_Common.Encrypted_satsrvencryky(sqlserverport) + "";//&SilentPageRequestTblID=" + PageMgmt.Encrypted(SilentPageRequestTblID) + " string SilentPageRequestTblID = CompanyRelated.Insert_SilentPageRequestTbl(ddlserver.SelectedValue, pagenamemainY, DateTime.Now.ToString(), "", false, Randomkeyid, mycurrenturlX); //Page X string url = ""; url = "http://" + Comp_serverweburl + "/vfysrv.aspx?licensesilentpagerequesttblid=" + BZ_Common.Encrypted_satsrvencryky(SilentPageRequestTblID) + "&pageredirecturl=" + BZ_Common.Encrypted_satsrvencryky(pagenamemainY) + "&mstrsrvky=" + BZ_Common.Encrypted_satsrvencryky(BZ_Common.satsrvencryky()) + "&returnurl=" + BZ_Common.Encrypted_satsrvencryky(ClientURL) + ""; //Response.Redirect("" + url + ""); ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open('" + url + "');", true); Response.Redirect("http://license.busiwiz.com/BeforeLogin/Silent_SyncData_WithServer.aspx?sid=" + BZ_Common.BZ_Encrypted(ddlserver.SelectedValue) + "Transfer=1"); // Response.Redirect("http://license.busiwiz.com/Silent_Sync_Need_DailySync.aspx?sid=" +BZ_Common.BZ_Encrypted(ddlserver.SelectedValue) + ""); } else { lblmsg.Text = "Server no available"; } }
//Close Port protected void ClosePort() { DataTable ds = MyCommonfile.selectBZ(" Select dbo.ClientMaster.ClientURL,dbo.ServerMasterTbl.* From dbo.ServerMasterTbl INNER JOIN dbo.ClientMaster ON dbo.ServerMasterTbl.Id = dbo.ClientMaster.ServerId Where dbo.ServerMasterTbl.Id='" + lblsid.Text + "' "); if (ds.Rows.Count > 0) { string sqlCompport28 = ds.Rows[0]["PortforCompanymastersqlistance"].ToString();//2810 string Comp_serverweburl = ds.Rows[0]["Busiwizsatellitesiteurl"].ToString(); string sqlserverport = ds.Rows[0]["port"].ToString(); string mycurrenturlX = Request.Url.AbsoluteUri; Random random = new Random(); int randomNumber = random.Next(1, 10); string Randomkeyid = Convert.ToString(randomNumber); string ClientURL = ds.Rows[0]["ClientURL"].ToString(); string pagenamemainY = "Satelliteservfunction.aspx?CP=ClosePort&PortNo=" + BZ_Common.Encrypted_satsrvencryky(sqlserverport) + "";//&SilentPageRequestTblID=" + PageMgmt.Encrypted(SilentPageRequestTblID) + " string SilentPageRequestTblID = CompanyRelated.Insert_SilentPageRequestTbl(lblsid.Text, pagenamemainY, DateTime.Now.ToString(), "", false, Randomkeyid, mycurrenturlX); string url = ""; url = "http://" + Comp_serverweburl + "/vfysrv.aspx?licensesilentpagerequesttblid=" + BZ_Common.Encrypted_satsrvencryky(SilentPageRequestTblID) + "&pageredirecturl=" + BZ_Common.Encrypted_satsrvencryky(pagenamemainY) + "&mstrsrvky=" + BZ_Common.Encrypted_satsrvencryky(BZ_Common.satsrvencryky()) + "&returnurl=" + BZ_Common.Encrypted_satsrvencryky(ClientURL) + ""; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open('" + url + "');", true); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["sid"] != null && Request.QueryString["compid"] != null) { string sid = Request.QueryString["sid"].ToString().Replace(" ", "+"); sid = PageMgmt.Decrypted(sid); // string versionid = PageMgmt.Decrypted(Request.QueryString["versionid"]); // string compid =PageMgmt.Decrypted(Request.QueryString["compid"].ToString()); string compidaa = Request.QueryString["compid"].ToString().Replace(" ", "+"); string compid = PageMgmt.Decrypted(compidaa.ToString()); //sid = "5"; //compid = "aswathy"; DataTable ds = MyCommonfile.selectBZ(" SELECT TOP (1) dbo.PortalMasterTbl.Id AS portlID, dbo.PortalMasterTbl.PortalName, dbo.PricePlanMaster.VersionInfoMasterId,dbo.PricePlanMaster.Producthostclientserver,dbo.ClientMaster.ClientURL, dbo.ClientMaster.ServerId AS ClientServerid, dbo.ServerMasterTbl.*, dbo.CompanyMaster.ServerId 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 INNER JOIN dbo.ServerMasterTbl ON dbo.CompanyMaster.ServerId = dbo.ServerMasterTbl.Id where CompanyLoginId='" + compid + "' "); if (ds.Rows.Count > 0) { string ComServerId = ds.Rows[0]["ServerId"].ToString(); string versionid = ds.Rows[0]["VersionInfoMasterId"].ToString(); lbl_serverurl.Text = ds.Rows[0]["Busiwizsatellitesiteurl"].ToString(); string sqlservernameip = ds.Rows[0]["PublicIp"].ToString(); string Comp_serversqlinstancename = ds.Rows[0]["DefaultsqlInstance"].ToString(); string sqlinstancename = ds.Rows[0]["Sqlinstancename"].ToString(); string DefaultMdfpath = ds.Rows[0]["DefaultMdfpath"].ToString(); string DefaultLdfpath = ds.Rows[0]["DefaultLdfpath"].ToString(); string iispath = ds.Rows[0]["serverdefaultpathforiis"].ToString(); string Comp_Ser_Masterpath = ds.Rows[0]["folderpathformastercode"].ToString(); string Comp_Ser_iispath = ds.Rows[0]["serverdefaultpathforiis"].ToString(); string Comp_ServEnckey = ds.Rows[0]["Enckey"].ToString(); string Comp_serversqlserverip = ds.Rows[0]["sqlurl"].ToString(); // string Comp_serversqlport = ds.Rows[0]["port"].ToString(); string Comp_serversqldbname = ds.Rows[0]["DefaultDatabaseName"].ToString(); // string Comp_serversqlpwd = ds.Rows[0]["Sapassword"].ToString(); Comp_serverweburl = ds.Rows[0]["Busiwizsatellitesiteurl"].ToString(); sqlserverport = ds.Rows[0]["port"].ToString(); string sqlCompport28 = ds.Rows[0]["PortforCompanymastersqlistance"].ToString();//2810 string ClientServerid = ds.Rows[0]["ClientServerid"].ToString(); string ClientURL = ds.Rows[0]["ClientURL"].ToString(); DataTable DTclientServerid = MyCommonfile.selectBZ(" Select * From ServerMasterTbl Where id='" + ClientServerid + "'"); clientServerfolderpathformastercode = DTclientServerid.Rows[0]["folderpathformastercode"].ToString(); FTP = DTclientServerid.Rows[0]["FTPforMastercode"].ToString(); FTPUserName = DTclientServerid.Rows[0]["FTPuseridforDefaultIISpath"].ToString(); FTPPassword = DTclientServerid.Rows[0]["FtpPasswordforDefaultIISpath"].ToString(); FTPport = DTclientServerid.Rows[0]["FTPportfordefaultIISpath"].ToString(); bool SerConnstatust = false; int timeconncheck = 1; connCompserver = ServerWizard.ServerDefaultInstanceConnetionTCP(compid); string Compserverconnnstr = connCompserver.ConnectionString; while ((!SerConnstatust) && (timeconncheck < 2)) { try { if (connCompserver.State.ToString() != "Open") { connCompserver.Open(); SerConnstatust = true; } else { SerConnstatust = true; } } catch { timeconncheck++; //Port Open //Page Y string pagenamemainY = "Satelliteservfunction.aspx?PO=OpenPort&PortNo=" + BZ_Common.Encrypted_satsrvencryky(sqlserverport) + "&Port2No=" + BZ_Common.Encrypted_satsrvencryky(sqlCompport28) + "";//&SilentPageRequestTblID=" + PageMgmt.Encrypted(SilentPageRequestTblID) + " //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(ComServerId, pagenamemainY, DateTime.Now.ToString(), "", false, Randomkeyid, mycurrenturlX); string url = ""; url = "http://" + Comp_serverweburl + "/vfysrv.aspx?licensesilentpagerequesttblid=" + BZ_Common.Encrypted_satsrvencryky(SilentPageRequestTblID) + "&pageredirecturl=" + BZ_Common.Encrypted_satsrvencryky(pagenamemainY) + "&mstrsrvky=" + BZ_Common.Encrypted_satsrvencryky(BZ_Common.satsrvencryky()) + "&returnurl=" + BZ_Common.Encrypted_satsrvencryky(ClientURL) + ""; Response.Redirect("" + url + ""); } } if (SerConnstatust == true)//if conn open (port open) { InsertServerMaster(sid); Database_Latest_Code_Insert(compid, sid, versionid, Compserverconnnstr, Comp_Ser_iispath, Comp_Ser_Masterpath, Comp_serverweburl, ClientServerid, DefaultMdfpath, DefaultLdfpath, sqlservernameip, sqlinstancename); Website_Latest_Code_Insert(sid, versionid, compid, Compserverconnnstr, iispath, Comp_ServEnckey, Comp_Ser_Masterpath, Comp_serverweburl, iispath); lbl_compid.Text = compid; string pagenames = ""; pagenames = "http://" + Comp_serverweburl + "/Satelliteservfunction.aspx?ftpurl=" + BZ_Common.BZ_Encrypted(FTP) + "&userid=" + BZ_Common.BZ_Encrypted(FTPUserName) + "&password="******"&portno=" + BZ_Common.BZ_Encrypted(FTPport) + "&Compid=" + BZ_Common.BZ_Encrypted(compid) + "&ServerID=" + BZ_Common.BZ_Encrypted(sid) + "&PortSecID=1"; Response.Redirect("" + pagenames + ""); // FillGrid_ComCreNeedCode(); } else { lblmsg.Text = "Connecting to server database problem"; } } else { lblmsg.Text = "No record available for "; } } } }