示例#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);
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["comid"] != null)
            {
                Session["comid"] = Request.QueryString["comid"];
                SqlConnection servermasterconn = new SqlConnection();

                string         strcomp = "select dbo.CompanyMaster.CompanyLoginId, ServerMasterTbl.*,CompanyMaster.Encryptkeycomp from CompanyMaster inner join ServerMasterTbl on ServerMasterTbl.Id=CompanyMaster.ServerId where CompanyMaster.CompanyLoginId='" + Convert.ToString(HttpContext.Current.Session["comid"]) + "'  ";
                SqlCommand     cmdcomp = new SqlCommand(strcomp, con);
                DataTable      dtcomp  = new DataTable();
                SqlDataAdapter adpcomp = new SqlDataAdapter(cmdcomp);
                adpcomp.Fill(dtcomp);
                if (dtcomp.Rows.Count > 0)
                {
                    datasource = dtcomp.Rows[0]["sqlurl"].ToString() + "\\" + dtcomp.Rows[0]["DefaultsqlInstance"].ToString() + "," + dtcomp.Rows[0]["Port"].ToString();
                    catalog    = dtcomp.Rows[0]["DefaultDatabaseName"].ToString();
                    userid     = "sa";
                    password   = PageMgmt.Decrypted(dtcomp.Rows[0]["Sapassword"].ToString());
                    strEnc     = Convert.ToString(dtcomp.Rows[0]["Encryptkeycomp"]);
                    strser     = Convert.ToString(dtcomp.Rows[0]["Enckey"]);

                    // servermasterconn.ConnectionString = @"Data Source =" + dtcomp.Rows[0]["sqlurl"].ToString() + "\\" + dtcomp.Rows[0]["DefaultsqlInstance"].ToString() + "," + dtcomp.Rows[0]["Port"].ToString() + "; Initial Catalog = " + dtcomp.Rows[0]["DefaultDatabaseName"].ToString() + "; User ID=sa; Password="******"Sapassword"].ToString()) + "; Persist Security Info=true; ";
                    // strEnc = Convert.ToString(dtcomp.Rows[0]["Encryptkeycomp"]);
                    //Data Source =C3\C3SERVERMASTER,30000; Initial Catalog = C3SATELLITESERVER; User ID=sa; Password=06De1963++; Persist Security Info=true;
                    Response.Redirect("http://" + dtcomp.Rows[0]["CompanyLoginId"].ToString() + ".onlineaccounts.net/addwebconfig.aspx?datasource=" + datasource + "&catalog=" + catalog + "&userid=" + userid + "&password="******"&strEnc=" + strEnc + "&strser=" + strser + "");
                }
            }
            if (Request.QueryString["sid"] != null)
            {
                GetServerConnection(Request.QueryString["sid"].ToString());
            }
        }
    }
    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());
                }
            }
        }
    }
    public static SqlConnection ServerDefaultInstanceConnetionTCP(string CompanyLoginId)
    {
        SqlConnection connCompserver = new SqlConnection();
        SqlConnection liceco         = new SqlConnection();

        liceco = MyCommonfile.licenseconn();
        if (liceco.State.ToString() != "Open")
        {
            liceco.Open();
        }
        string         str = " SELECT  TOP (1) dbo.PortalMasterTbl.Id AS portlID, dbo.PortalMasterTbl.PortalName, dbo.PricePlanMaster.VersionInfoMasterId,dbo.PricePlanMaster.Producthostclientserver, 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='" + CompanyLoginId + "' ";
        SqlCommand     cmd = new SqlCommand(str, liceco);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable      ds  = new DataTable();

        adp.Fill(ds);
        if (ds.Rows.Count > 0)
        {
            //string lbl_serverurl = ds.Rows[0]["Busiwizsatellitesiteurl"].ToString();
            //string sqlservernameip = ds.Rows[0]["PublicIp"].ToString();
            //string sqlserverport = ds.Rows[0]["port"].ToString();
            //string DefaultDatabaseName = ds.Rows[0]["DefaultDatabaseName"].ToString();
            //string Comp_serversqlpwd = PageMgmt.Decrypted(ds.Rows[0]["Sapassword"].ToString());
            //string sqlinstancename = ds.Rows[0]["Sqlinstancename"].ToString();
            //string Comp_serversqlserverip = ds.Rows[0]["sqlurl"].ToString();
            //string Comp_serversqlinstancename = ds.Rows[0]["DefaultsqlInstance"].ToString();
            //string Comp_serverweburl = ds.Rows[0]["Busiwizsatellitesiteurl"].ToString();
            string Ipaddress              = ds.Rows[0]["Ipaddress"].ToString();
            string lbl_serverurl          = ds.Rows[0]["Busiwizsatellitesiteurl"].ToString();
            string sqlservernameip        = ds.Rows[0]["PublicIp"].ToString();
            string Comp_serversqlserverip = ds.Rows[0]["sqlurl"].ToString();

            string DefaultsqlInstance  = ds.Rows[0]["DefaultsqlInstance"].ToString();
            string sqlserverport       = ds.Rows[0]["port"].ToString();                //30000
            string DefaultDatabaseName = ds.Rows[0]["DefaultDatabaseName"].ToString(); //30000

            string serversqlpwd = PageMgmt.Decrypted(ds.Rows[0]["Sapassword"].ToString());

            string sqlinstancename = ds.Rows[0]["Sqlinstancename"].ToString();
            string sqlCompport     = ds.Rows[0]["PortforCompanymastersqlistance"].ToString();//2810
            connCompserver.ConnectionString = @"Data Source =" + ds.Rows[0]["PublicIp"] + "\\" + ds.Rows[0]["SqlInstanceName"] + "; Initial Catalog = " + ds.Rows[0]["DefaultDatabaseName"] + "; User ID=Sa; password="******"Sapassword"].ToString()) + "; Persist Security Info=true;";
            connCompserver.ConnectionString = @"Data Source =TCP:" + ds.Rows[0]["Ipaddress"] + "," + sqlserverport + "; Initial Catalog = " + DefaultDatabaseName + "; User ID=Sa; password="******"; Persist Security Info=true;";
            connCompserver.ConnectionString = @"Data Source =TCP:192.168.6.101,1401; Initial Catalog = C3SATELLITESERVER; User ID=Sa; password=06De1963++; Persist Security Info=true;";
        }
        liceco.Close();
        return(connCompserver);
    }
示例#5
0
    private void GetServerConnection(string serverid)
    {
        string         strftpdetail = " SELECT * from ServerMasterTbl where Id='" + serverid + "'";
        SqlCommand     cmdftpdetail = new SqlCommand(strftpdetail, con);
        DataTable      dtftpdetail  = new DataTable();
        SqlDataAdapter adpftpdetail = new SqlDataAdapter(cmdftpdetail);

        adpftpdetail.Fill(dtftpdetail);

        if (dtftpdetail.Rows.Count > 0)
        {
            datasource = dtftpdetail.Rows[0]["sqlurl"].ToString() + "\\" + dtftpdetail.Rows[0]["DefaultsqlInstance"].ToString() + "," + dtftpdetail.Rows[0]["port"].ToString();
            catalog    = dtftpdetail.Rows[0]["DefaultDatabaseName"].ToString();
            userid     = "sa";
            password   = PageMgmt.Decrypted(dtftpdetail.Rows[0]["Sapassword"].ToString());
            //  strEnc = Convert.ToString(dtftpdetail.Rows[0]["Encryptkeycomp"]);
            strser = Convert.ToString(dtftpdetail.Rows[0]["Enckey"]);
            // string ftpphysicalpath = dtftpdetail.Rows[0]["folderpathformastercode"].ToString() + "\\" + dsfilename.Rows[0]["filename"].ToString();
            Response.Redirect("http://" + dtftpdetail.Rows[0]["Busiwizsatellitesiteurl"].ToString() + "/addwebconfig.aspx?datasource=" + datasource + "&catalog=" + catalog + "&userid=" + userid + "&password="******"&strEnc=" + strEnc + "&strser=" + strser + "");



            //string serversqlserverip = dtftpdetail.Rows[0]["sqlurl"].ToString();
            //string serversqlinstancename = dtftpdetail.Rows[0]["DefaultsqlInstance"].ToString();
            //string serversqldbname = dtftpdetail.Rows[0]["DefaultDatabaseName"].ToString();
            //string serversqlpwd = dtftpdetail.Rows[0]["Sapassword"].ToString();
            //string serversqlport = dtftpdetail.Rows[0]["port"].ToString();
            //string PublicIp = dtftpdetail.Rows[0]["PublicIp"].ToString();
            //SqlConnection connserver = new SqlConnection();
            //connserver.ConnectionString = @"Data Source =" + PublicIp + "\\" + serversqlinstancename + "," + serversqlport + "; Initial Catalog=" + serversqldbname + "; User ID=Sa; Password="******"; Persist Security Info=true; ";
            ////connserver.ConnectionString = @"Data Source =192.168.6.80\ABADSQLEXPRE,40000; Initial Catalog=C3SERVERMASTER; User ID=Sa; Password=06De1962++; Persist Security Info=true; ";
            //try
            //{
            //    if (connserver.State.ToString() != "Open")
            //    {
            //        connserver.Open();
            //        connserver.Close();
            //    }
            //    //Request.Url.Host.ToString()
            //}
            //catch
            //{
            //}
        }
    }
    public static SqlConnection ServerDefaultInstanceConnetionTCPWithPublicIP_Serverid(string Serverid)
    {
        SqlConnection connCompserver = new SqlConnection();
        SqlConnection liceco         = new SqlConnection();

        liceco = MyCommonfile.licenseconn();
        if (liceco.State.ToString() != "Open")
        {
            liceco.Open();
        }
        string         str = " SELECT  * From dbo.ServerMasterTbl Where Id='" + Serverid + "' ";
        SqlCommand     cmd = new SqlCommand(str, liceco);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable      ds  = new DataTable();

        adp.Fill(ds);
        if (ds.Rows.Count > 0)
        {
            string Ipaddress              = ds.Rows[0]["Ipaddress"].ToString();
            string lbl_serverurl          = ds.Rows[0]["Busiwizsatellitesiteurl"].ToString();
            string sqlservernameip        = ds.Rows[0]["PublicIp"].ToString();
            string Comp_serversqlserverip = ds.Rows[0]["sqlurl"].ToString();

            string DefaultsqlInstance  = ds.Rows[0]["DefaultsqlInstance"].ToString();
            string sqlserverport       = ds.Rows[0]["port"].ToString();                //30000
            string DefaultDatabaseName = ds.Rows[0]["DefaultDatabaseName"].ToString(); //30000

            string serversqlpwd = PageMgmt.Decrypted(ds.Rows[0]["Sapassword"].ToString());

            string sqlinstancename = ds.Rows[0]["Sqlinstancename"].ToString();
            string sqlCompport     = ds.Rows[0]["PortforCompanymastersqlistance"].ToString();//2810
            connCompserver.ConnectionString = @"Data Source =" + ds.Rows[0]["PublicIp"] + "\\" + ds.Rows[0]["SqlInstanceName"] + "; Initial Catalog = " + ds.Rows[0]["DefaultDatabaseName"] + "; User ID=Sa; password="******"Sapassword"].ToString()) + "; Persist Security Info=true;";
            connCompserver.ConnectionString = @"Data Source =TCP:" + ds.Rows[0]["Ipaddress"] + "," + sqlserverport + "; Initial Catalog = " + DefaultDatabaseName + "; User ID=Sa; password="******"; Persist Security Info=true;";
            connCompserver.ConnectionString = @"Data Source =TCP:" + ds.Rows[0]["Ipaddress"] + "," + sqlserverport + "; Initial Catalog = " + DefaultDatabaseName + "; User ID=Sa; password="******"; Persist Security Info=true;";
            connCompserver.ConnectionString = @"Data Source =TCP:" + ds.Rows[0]["Ipaddress"] + "," + sqlserverport + "; Initial Catalog = " + DefaultDatabaseName + "; User ID=Sa; password="******"; Persist Security Info=true;";
            connCompserver.ConnectionString = @"Data Source =TCP:" + ds.Rows[0]["PublicIp"] + "," + sqlserverport + "; Initial Catalog = " + DefaultDatabaseName + "; User ID=Sa; password="******"; Persist Security Info=true;";
            connCompserver.ConnectionString = @"Data Source =TCP:192.168.6.101,1401; Initial Catalog = C3SATELLITESERVER; User ID=Sa; password=06De1963++; Persist Security Info=true;";
        }
        liceco.Close();
        return(connCompserver);
    }
 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"));
         }
     }
 }
    public static SqlConnection ServerTwoInstanceTCPConncection(string Serverid, string serversqlinstancename)
    {
        SqlConnection connCompserver = new SqlConnection();
        string        str            = "  ";
        DataTable     ds             = MyCommonfile.selectBZ(" Select * From ServerMasterTbl Where Id='" + Serverid + "'");

        if (ds.Rows.Count > 0)
        {
            string ServerName = ds.Rows[0]["ServerName"].ToString();

            string Ipaddress              = ds.Rows[0]["Ipaddress"].ToString();
            string lbl_serverurl          = ds.Rows[0]["Busiwizsatellitesiteurl"].ToString();
            string sqlservernameip        = ds.Rows[0]["PublicIp"].ToString();
            string Comp_serversqlserverip = ds.Rows[0]["sqlurl"].ToString();

            string DefaultsqlInstance  = ds.Rows[0]["DefaultsqlInstance"].ToString();
            string sqlserverport       = ds.Rows[0]["port"].ToString();
            string DefaultDatabaseName = ds.Rows[0]["DefaultDatabaseName"].ToString();

            string serversqlpwd = PageMgmt.Decrypted(ds.Rows[0]["Sapassword"].ToString());


            string sqlinstancename = ds.Rows[0]["Sqlinstancename"].ToString();
            string sqlCompport     = ds.Rows[0]["PortforCompanymastersqlistance"].ToString();
            if (serversqlinstancename == sqlinstancename)
            {
                connCompserver.ConnectionString = @"Data Source=" + ds.Rows[0]["Ipaddress"].ToString() + "," + sqlCompport + ";Integrated Security=True";//Initial Catalog=" + serversqldbname + ";
                connCompserver.ConnectionString = @"Data Source=" + ServerName + "\\" + serversqlinstancename + ";Integrated Security=True";
            }
            else
            {
                connCompserver.ConnectionString = @"Data Source =" + ds.Rows[0]["Ipaddress"].ToString() + "," + sqlserverport + "; Persist Security Info=true;";
                connCompserver.ConnectionString = @"Data Source=" + ServerName + "\\" + serversqlinstancename + ";Integrated Security=True";
            }
            connCompserver.ConnectionString = @"Data Source=TCP:192.168.6.101,1401;Initial Catalog=master;User ID=Sa; password=06De1963++; Persist Security Info=true;";
        }
        return(connCompserver);
    }
    public static SqlConnection ServerDatabaseFromInstancePipe(string Serverid, string serversqlinstancename, string databasename)
    {
        SqlConnection connCompserver = new SqlConnection();
        string        str            = "  ";
        DataTable     ds             = MyCommonfile.selectBZ(" Select * From ServerMasterTbl Where Id='" + Serverid + "'");

        if (ds.Rows.Count > 0)
        {
            string ServerName = ds.Rows[0]["ServerName"].ToString();
            string Ipaddress  = ds.Rows[0]["Ipaddress"].ToString();

            string lbl_serverurl          = ds.Rows[0]["Busiwizsatellitesiteurl"].ToString();
            string sqlservernameip        = ds.Rows[0]["PublicIp"].ToString();
            string Comp_serversqlserverip = ds.Rows[0]["sqlurl"].ToString();

            string DefaultsqlInstance  = ds.Rows[0]["DefaultsqlInstance"].ToString();
            string sqlserverport30000  = ds.Rows[0]["port"].ToString();                //30000
            string DefaultDatabaseName = ds.Rows[0]["DefaultDatabaseName"].ToString(); //30000


            string serversqlpwd = PageMgmt.Decrypted(ds.Rows[0]["Sapassword"].ToString());

            string sqlinstancename = ds.Rows[0]["Sqlinstancename"].ToString();
            string sqlCompport2810 = ds.Rows[0]["PortforCompanymastersqlistance"].ToString();//2810
            if (serversqlinstancename == sqlinstancename)
            {
                connCompserver.ConnectionString = @"Data Source =TCP:" + ds.Rows[0]["Ipaddress"] + "," + sqlCompport2810 + "; Initial Catalog = " + databasename + "; User ID=Sa; password="******"; Persist Security Info=true;";
                connCompserver.ConnectionString = @"" + ServerName + "\\" + sqlinstancename + ";Initial Catalog=" + databasename + ";Integrated Security=True;";
            }
            else
            {
                connCompserver.ConnectionString = @"Data Source =TCP:" + ds.Rows[0]["Ipaddress"] + "," + sqlserverport30000 + "; Initial Catalog = " + databasename + "; User ID=Sa; password="******"; Persist Security Info=true;";
                connCompserver.ConnectionString = @"" + ServerName + "\\" + DefaultsqlInstance + ";Initial Catalog=" + databasename + ";Integrated Security=True;";
            }
        }

        return(connCompserver);
    }
示例#10
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();
        }
    }
示例#11
0
    public bool GetFile(string ftp, string filename, string Destpath, string username, string password)
    {
        FtpWebRequest oFTP = (FtpWebRequest)FtpWebRequest.
                             Create(ftp.ToString() + filename.ToString());

        password         = PageMgmt.Decrypted(password); // add this line by ninad at 1/7/2015
        oFTP.Credentials = new NetworkCredential(username.ToString(), password.ToString());
        oFTP.UseBinary   = false;
        oFTP.UsePassive  = true;
        oFTP.Method      = WebRequestMethods.Ftp.DownloadFile;


        FtpWebResponse response =
            (FtpWebResponse)oFTP.GetResponse();
        Stream responseStream = response.GetResponseStream();

        FileStream fs = new FileStream(Destpath, FileMode.CreateNew);

        Byte[] buffer = new Byte[2047];
        int    read   = 1;

        while (read != 0)
        {
            read = responseStream.Read(buffer, 0, buffer.Length);
            fs.Write(buffer, 0, read);
        }

        responseStream.Close();
        fs.Flush();
        fs.Close();
        responseStream.Close();
        response.Close();

        oFTP = null;
        return(true);
    }
示例#12
0
    public static SqlConnection intmsg()
    {
        SqlConnection msgint = new SqlConnection();


        string         strcln = "Select * from CompanyDatabaseDetailTbl where CompanyLoginId='" + Convert.ToString(HttpContext.Current.Session["Comid"]) + "' and CodeType='INTMSGDB' ";
        SqlCommand     cmdcln = new SqlCommand(strcln, serverconn());
        DataTable      dtcln  = new DataTable();
        SqlDataAdapter adpcln = new SqlDataAdapter(cmdcln);

        adpcln.Fill(dtcln);
        if (dtcln.Rows.Count > 0)
        {
            //msgint.ConnectionString = @"Data Source =" + dtcln.Rows[0]["SqlServerName"] + "\\" + dtcln.Rows[0]["SqlInstanceName"] + "," + dtcln.Rows[0]["Sqlport"] + "; Initial Catalog = " + dtcln.Rows[0]["DatabaseName"] + "; Integrated Security = true";
            msgint.ConnectionString = @"Data Source =" + dtcln.Rows[0]["SqlServerName"] + "\\" + dtcln.Rows[0]["SqlInstanceName"] + "; Initial Catalog = " + dtcln.Rows[0]["DatabaseName"] + "; User ID=" + dtcln.Rows[0]["SqlUserID"] + "; Password="******"SqlPassword"].ToString()) + "; Persist Security Info=true;";
            //Data Source =C3\C3SERVERMASTER; Initial Catalog = jobcenter.INTMSGDB; User ID=Sa; Password=06De1963++; Persist Security Info=true;
        }
        intmsg11 = msgint.Database;
        return(msgint);
    }
示例#13
0
    protected void insert(int ProductVerID, int CodeTypeID, int codeversionnumber, string filename, string physicalpath, string TemporaryPath)
    {
        string     strinsert = "Insert into ProductMasterCodeTbl(ProductVerID,CodeTypeID,codeversionnumber,filename,physicalpath,TemporaryPath) values ('" + ProductVerID + "','" + CodeTypeID + "','" + codeversionnumber + "','" + filename + "','" + physicalpath + "','" + TemporaryPath + "')";
        SqlCommand cmdinsert = new SqlCommand(strinsert, con);

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


        string         strmaxid = "select Max(ID) as ID from ProductMasterCodeTbl where CodeTypeID='" + CodeTypeID + "' ";
        SqlCommand     cmdmaxid = new SqlCommand(strmaxid, con);
        DataTable      dtmaxid  = new DataTable();
        SqlDataAdapter adpmaxid = new SqlDataAdapter(cmdmaxid);

        adpmaxid.Fill(dtmaxid);

        if (dtmaxid.Rows.Count > 0)
        {
            string         strgetserverid = "select distinct ServerId from ServerAssignmentMasterTbl where VersionId='" + ProductVerID + "'";
            SqlCommand     cmdgetserverid = new SqlCommand(strgetserverid, con);
            DataTable      dtgetserverid  = new DataTable();
            SqlDataAdapter adpgetserverid = new SqlDataAdapter(cmdgetserverid);
            adpgetserverid.Fill(dtgetserverid);

            if (dtgetserverid.Rows.Count > 0)
            {
                foreach (DataRow dr in dtgetserverid.Rows)
                {
                    string serverid = dr["ServerId"].ToString();

                    string         strftpdetail = " SELECT * from ServerMasterTbl where Id='" + serverid + "'";
                    SqlCommand     cmdftpdetail = new SqlCommand(strftpdetail, con);
                    DataTable      dtftpdetail  = new DataTable();
                    SqlDataAdapter adpftpdetail = new SqlDataAdapter(cmdftpdetail);
                    adpftpdetail.Fill(dtftpdetail);

                    if (dtftpdetail.Rows.Count > 0)
                    {
                        string ftpphysicalpath = dtftpdetail.Rows[0]["folderpathformastercode"].ToString() + "\\" + filename;

                        string serversqlserverip     = dtftpdetail.Rows[0]["sqlurl"].ToString();
                        string serversqlinstancename = dtftpdetail.Rows[0]["DefaultsqlInstance"].ToString();
                        string serversqldbname       = dtftpdetail.Rows[0]["DefaultDatabaseName"].ToString();
                        string serversqlpwd          = dtftpdetail.Rows[0]["Sapassword"].ToString();
                        string serversqlport         = dtftpdetail.Rows[0]["port"].ToString();

                        connserver = new SqlConnection();
                        connserver.ConnectionString = @"Data Source =" + serversqlserverip + "\\" + serversqlinstancename + "," + serversqlport + "; Initial Catalog=" + serversqldbname + "; User ID=Sa; Password="******"; Persist Security Info=true;";



                        try
                        {
                            string     strsatelliteserverinsert = "Insert into ProductMasterCodeonsatelliteserverTbl(ProductMastercodeID,ServerID,Successfullyuploadedtoserver,Physicalpath,filename) values ('" + dtmaxid.Rows[0]["ID"].ToString() + "','" + serverid + "','0','" + ftpphysicalpath + "','" + filename + "')";
                            SqlCommand cmdsatelliteserverinsert = new SqlCommand(strsatelliteserverinsert, con);
                            if (con.State.ToString() != "Open")
                            {
                                con.Open();
                            }
                            cmdsatelliteserverinsert.ExecuteNonQuery();
                            con.Close();

                            DataTable dtrsc = selectBZ("Select Max(ID) as ID  from ProductMasterCodeonsatelliteserverTbl where ServerID='" + serverid + "' and ProductMastercodeID='" + dtmaxid.Rows[0]["ID"].ToString() + "' ");


                            string     strserverinsert = "Insert into ProductMasterCodeonsatelliteserverTbl(ID,ProductMastercodeID,ServerID,Successfullyuploadedtoserver,Physicalpath,filename,DownloadStart,DownloadFinish) values ('" + dtrsc.Rows[0]["ID"].ToString() + "','" + dtmaxid.Rows[0]["ID"].ToString() + "','" + serverid + "','0','" + ftpphysicalpath + "','" + filename + "','0','0')";
                            SqlCommand cmdserverinsert = new SqlCommand(strserverinsert, connserver);
                            if (connserver.State.ToString() != "Open")
                            {
                                connserver.Open();
                            }
                            cmdserverinsert.ExecuteNonQuery();
                            connserver.Close();
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
    }
示例#14
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string ext = "";

        string[] validFileTypes = { "zip", "ZIP", "SQL", "sql", "mdf", "MDF", "LDF", "ldf" };
        bool     isValidFile    = false;

        if (fileup.HasFile == true)
        {
            ext = System.IO.Path.GetExtension(fileup.PostedFile.FileName);
            for (int i = 0; i < validFileTypes.Length; i++)
            {
                if (ext == "." + validFileTypes[i])
                {
                    isValidFile = true;
                    break;
                }
            }
        }
        if (Request.QueryString["Clid"] != null)
        {
            isValidFile = true;
        }
        if (!isValidFile)
        {
            lblmsg.Visible = true;
            lblmsg.Text    = "Invalid File. Please upload a File with extension " +
                             string.Join(",", validFileTypes);
        }
        else
        {
            string filepath = "";
            string filnames = "";
            if (fileup.HasFile || Request.QueryString["Clid"] != null)
            {
                string productversionid = ddlproductversion.SelectedValue;
                string codecategoryno   = ddlcodetypecatefory.SelectedValue;
                string codetypeid       = ddlcodtypeforup.SelectedValue;
                string codeversionno    = lblnewcodetypeNo.Text;
                string dateformat       = "";
                string uploadfilename   = "";
                if (Request.QueryString["Clid"] == null)
                {
                    dateformat     = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();
                    uploadfilename = fileup.FileName;

                    filnames = productversionid + "_" + codecategoryno + "_" + codetypeid + "_" + codeversionno + "_" + dateformat + uploadfilename;
                    fileup.PostedFile.SaveAs(Server.MapPath("~\\Attach\\") + filnames);
                    filepath = Server.MapPath("~\\Attach\\") + filnames;
                }
                else
                {
                    filnames = ViewState["filename"].ToString();
                }



                string         strcln = " select * from ClientMaster where ClientMasterId='" + Session["ClientId"].ToString() + "'";
                SqlCommand     cmdcln = new SqlCommand(strcln, con);
                DataTable      dtcln  = new DataTable();
                SqlDataAdapter adpcln = new SqlDataAdapter(cmdcln);
                adpcln.Fill(dtcln);


                if (dtcln.Rows.Count > 0)
                {
                    string defaltdrivepath      = dtcln.Rows[0]["DefaultSourceDrivePath"].ToString();
                    string companyname          = dtcln.Rows[0]["CompanyName"].ToString();
                    string mastersourcefilepath = defaltdrivepath + "\\" + filnames;

                    // Copy files
                    try
                    {
                        if (Request.QueryString["Clid"] == null)
                        {
                            File.Copy(filepath, mastersourcefilepath, true);
                        }
                        else
                        {
                            filepath = Server.MapPath("~\\Attach\\") + filnames;
                            File.Copy(mastersourcefilepath, filepath, true);
                        }
                    }
                    catch
                    {
                    }
                    // end copy files

                    insert(Convert.ToInt32(ddlproductversion.SelectedValue), Convert.ToInt32(ddlcodtypeforup.SelectedValue), Convert.ToInt32(lblnewcodetypeNo.Text), filnames, mastersourcefilepath, filepath);

                    SqlCommand cmdsq = new SqlCommand("Insert into ProductMasterLatestcodeversioninfoTBl(Productveriontbl,CodeVersion,CodeTypeID)Values('" + ddlproductversion.SelectedValue + "','" + lblnewcodetypeNo.Text + "','" + ddlcodtypeforup.SelectedValue + "')", con);
                    if (con.State.ToString() != "Open")
                    {
                        con.Open();
                    }
                    cmdsq.ExecuteNonQuery();
                    con.Close();


                    DataTable dtrsc = selectBZ("Select Max(Id) as Id,Productveriontbl,CodeTypeID,CodeVersion  from ProductMasterLatestcodeversioninfoTBl where Productveriontbl='" + ddlproductversion.SelectedValue + "' and  CodeVersion='" + lblnewcodetypeNo.Text + "' and CodeTypeID='" + ddlcodtypeforup.SelectedValue + "' Group by Productveriontbl,CodeTypeID,CodeVersion");//ddlcodetypecatefory



                    string         strgetserverid = "select distinct ServerId from ServerAssignmentMasterTbl where VersionId='" + ddlproductversion.SelectedValue + "'";
                    SqlCommand     cmdgetserverid = new SqlCommand(strgetserverid, con);
                    DataTable      dtgetserverid  = new DataTable();
                    SqlDataAdapter adpgetserverid = new SqlDataAdapter(cmdgetserverid);
                    adpgetserverid.Fill(dtgetserverid);

                    if (dtgetserverid.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dtgetserverid.Rows)
                        {
                            string serverid = dr["ServerId"].ToString();

                            string         strftpdetail = " SELECT * from ServerMasterTbl where Id='" + serverid + "'";
                            SqlCommand     cmdftpdetail = new SqlCommand(strftpdetail, con);
                            DataTable      dtftpdetail  = new DataTable();
                            SqlDataAdapter adpftpdetail = new SqlDataAdapter(cmdftpdetail);
                            adpftpdetail.Fill(dtftpdetail);

                            if (dtftpdetail.Rows.Count > 0)
                            {
                                string serversqlserverip     = dtftpdetail.Rows[0]["sqlurl"].ToString();
                                string serversqlinstancename = dtftpdetail.Rows[0]["DefaultsqlInstance"].ToString();
                                string serversqldbname       = dtftpdetail.Rows[0]["DefaultDatabaseName"].ToString();
                                string serversqlpwd          = dtftpdetail.Rows[0]["Sapassword"].ToString();
                                string serversqlport         = dtftpdetail.Rows[0]["port"].ToString();

                                connserver = new SqlConnection();
                                connserver.ConnectionString = @"Data Source =" + serversqlserverip + "\\" + serversqlinstancename + "," + serversqlport + "; Initial Catalog=" + serversqldbname + "; User ID=Sa; Password="******"; Persist Security Info=true;";

                                try
                                {
                                    SqlCommand cmdsx = new SqlCommand("Insert into ProductMasterLatestcodeversioninfoTBl(Id,Productveriontbl,CodeVersion,CodeTypeID)Values('" + Convert.ToString(dtrsc.Rows[0]["Id"]) + "','" + Convert.ToString(dtrsc.Rows[0]["Productveriontbl"]) + "','" + Convert.ToString(dtrsc.Rows[0]["CodeVersion"]) + "','" + Convert.ToString(dtrsc.Rows[0]["CodeTypeID"]) + "')", connserver);
                                    if (connserver.State.ToString() != "Open")
                                    {
                                        connserver.Open();
                                    }
                                    cmdsx.ExecuteNonQuery();
                                    connserver.Close();
                                }
                                catch (Exception ex)
                                {
                                }
                            }
                        }
                    }

                    if (Convert.ToInt32(ddlcodetypecatefory.SelectedValue) == 3)
                    {
                        try
                        {
                            databaseattachdetach(Convert.ToInt32(ddlcodtypeforup.SelectedValue), Convert.ToInt32(ddlproductversion.SelectedValue), mastersourcefilepath, lblnewcodetypeNo.Text);
                        }
                        catch
                        {
                        }
                    }


                    Button2_Click1(sender, e);
                    fillcodeversion();
                    lblmsg.Visible = true;
                    lblmsg.Text    = "Product setup uploaded successfully";
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["licensesilentpagerequesttblid"] != null && Request.QueryString["randomkeyID"] != null && Request.QueryString["sateliteserverrequesttblid"] != null && Request.QueryString["rnkendecke"] != null)//portno
        {
            int    bannn       = 0;
            string rnkendecke  = Request.QueryString["rnkendecke"].ToString();
            string licreqid    = BZ_Common.Decrypted_DasdasdasdadynamicKey(Request.QueryString["licensesilentpagerequesttblid"].ToString().Replace(" ", "+"), rnkendecke);
            string serreqid    = BZ_Common.Decrypted_DasdasdasdadynamicKey(Request.QueryString["sateliteserverrequesttblid"].ToString().Replace(" ", "+"), rnkendecke);
            string randomkeyno = BZ_Common.Decrypted_DasdasdasdadynamicKey(Request.QueryString["randomkeyID"].ToString(), rnkendecke);


            DataTable ds1 = MyCommonfile.selectBZ("select SilentPageServerID from SilentPageRequestTbl where ID= '" + licreqid.ToString() + "'");
            if (ds1.Rows.Count > 0)
            {
                DataTable ds = MyCommonfile.selectBZ("select ServerMasterTbl.* from ServerMasterTbl where ServerMasterTbl.Id= '" + ds1.Rows[0]["SilentPageServerID"].ToString() + "'");
                if (ds.Rows.Count > 0)
                {
                    encstr = Convert.ToString(ds.Rows[0]["Enckey"]);
                    string Comp_serversqlserverip     = ds.Rows[0]["sqlurl"].ToString();
                    string Comp_serversqlinstancename = ds.Rows[0]["DefaultsqlInstance"].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();
                    string Comp_serverweburl          = ds.Rows[0]["Busiwizsatellitesiteurl"].ToString();
                    connCompserver.ConnectionString = @"Data Source =" + Comp_serversqlserverip + "\\" + "\\" + Comp_serversqlinstancename + "," + Comp_serversqlport + "; Initial Catalog=" + Comp_serversqldbname + "; User ID=Sa; Password="******"; Persist Security Info=true;";
                }
                else
                {
                    bannn = 1;
                }
                DataTable dtstatus = MyCommonfile.selectBZ("select * from SilentPageRequestTbl where ID='" + licreqid.ToString() + "' and requestfinish='Yes'");
                if (dtstatus.Rows.Count > 0)
                {
                    bannn = 1;
                }
                else
                {
                    DataTable dtcheck = MyCommonfile.selectBZ("select * from SilentPageRequestTbl where ID='" + licreqid.ToString() + "'");
                    if (dtcheck.Rows.Count > 0)
                    {
                        DateTime dt   = DateTime.Now;
                        DateTime bann = Convert.ToDateTime(dtcheck.Rows[0]["datetimeofrequest"].ToString()).AddHours(1);
                        if (dt <= bann)
                        {
                            string keyvalue = "";
                            if (randomkeyno.ToString() == "0")
                            {
                                keyvalue = BZ_Common.mstrsrvkyreply();
                            }
                            else
                            {
                                string         str132 = "select Securitykey" + randomkeyno + " from Securitykeyforsilentpages where  serverid ='" + ds1.Rows[0]["SilentPageServerID"].ToString() + "'";
                                SqlCommand     cgw    = new SqlCommand(str132, connCompserver);
                                SqlDataAdapter adgw   = new SqlDataAdapter(cgw);
                                DataTable      dt2    = new DataTable();
                                adgw.Fill(dt2);
                                if (dt2.Rows.Count > 0)
                                {
                                    string mystr = Convert.ToString(DateTime.Now.Day);
                                    mystr    = mystr.Substring(0, 1);
                                    keyvalue = "" + dt2.Rows[0][0].ToString() + "" + mystr + "" + DateTime.Now.ToShortDateString() + "";
                                }
                            }
                            string     hh  = "update  SilentPageRequestTbl set randomkeyid='" + randomkeyno + "',dateandtimefinish='" + DateTime.Now.ToString() + "',requestfinish='Yes' where ID='" + licreqid.ToString() + "'";
                            SqlCommand cmd = new SqlCommand(hh, con);
                            con.Open();
                            cmd.ExecuteNonQuery();
                            con.Close();
                            Response.Redirect("http://" + ds.Rows[0]["Busiwizsatellitesiteurl"].ToString() + "/Verifystage2.aspx?sateliteserversilentpagerequesttblid=" + BZ_Common.Encrypted_DasdasdasdadynamicKey(serreqid.ToString(), rnkendecke) + "&randomkeyvalue=" + BZ_Common.Encrypted_DasdasdasdadynamicKey(keyvalue.ToString(), rnkendecke) + "&rnkendecke=" + Request.QueryString["rnkendecke"] + "");
                        }
                        else
                        {
                            SqlCommand cmd = new SqlCommand("delete from  SilentPageRequestTbl where ID='" + licreqid.ToString() + "')", con);
                            con.Open();
                            cmd.ExecuteNonQuery();
                            con.Close();
                        }
                    }
                    else
                    {
                        bannn = 1;
                    }
                }
            }
            else
            {
            }
        }
    }
    protected void createwebsiteandattach(string compid)
    {
        int            totnoc = 0;
        string         str    = " SELECT CompanyMaster.*,PortalMasterTbl.id as portlID, 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='" + compid + "' ";
        SqlCommand     cmd    = new SqlCommand(str, con);
        SqlDataAdapter adp    = new SqlDataAdapter(cmd);
        DataTable      ds     = new DataTable();

        adp.Fill(ds);
        if (ds.Rows.Count > 0)
        {
            //string websitename = compid;
            //verid = ds.Rows[0]["VersionInfoMasterId"].ToString();
            //string priceplanid = ds.Rows[0]["PricePlanId"].ToString();
            //string productid = ds.Rows[0]["ProductId"].ToString();
            Session["PortalName"] = ds.Rows[0]["PortalName"].ToString();
            Session["ProductId"]  = ds.Rows[0]["VersionInfoMasterId"].ToString();
            string versionid = ds.Rows[0]["VersionInfoMasterId"].ToString();
            string Serverid  = ds.Rows[0]["Serverid"].ToString();
            Encryptkeycompsss  = ds.Rows[0]["Encryptkeycomp"].ToString();
            Session["portlID"] = ds.Rows[0]["portlID"].ToString();

            DataTable dtre = selectBZ("select * from ServerMasterTbl where Id='" + Serverid + "'");

            string serversqlserverip     = dtre.Rows[0]["sqlurl"].ToString();
            string serversqlinstancename = dtre.Rows[0]["DefaultsqlInstance"].ToString();
            string serversqldbname       = dtre.Rows[0]["DefaultDatabaseName"].ToString();
            string serversqlpwd          = dtre.Rows[0]["Sapassword"].ToString();
            string serversqlport         = dtre.Rows[0]["port"].ToString();

            try
            {
                totnoc = 1;
                conser = new SqlConnection();
                conser.ConnectionString = @"Data Source =" + serversqlserverip + "\\" + serversqlinstancename + "," + serversqlport + "; Initial Catalog=" + serversqldbname + "; User ID=Sa; Password="******"; Persist Security Info=true;";
                conser = new SqlConnection(@"Data Source =TCP:192.168.6.80,40000; Initial Catalog=C3SATELLITESERVER; User ID=Sa; Password=06De1963++; Persist Security Info=true;");
                if (conser.State.ToString() != "Open")
                {
                    conser.Open();
                }
                conser.Close();
                encstr = "";
                encstr = Convert.ToString(dtre.Rows[0]["Enckey"]);
            }
            catch (Exception e1)
            {
            }
        }
    }
示例#17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["a"] != null && Request.QueryString["b"] != null && Request.QueryString["c"] != null && Request.QueryString["d"] != null && Request.QueryString["e"] != null)
            {
                string MacAddress       = PageMgmt.Decrypted(Request.QueryString["a"].Replace(" ", "+"));
                string Ipaddress        = PageMgmt.Decrypted(Request.QueryString["b"].Replace(" ", "+"));
                string bannedmacaddress = PageMgmt.Decrypted(Request.QueryString["c"].Replace(" ", "+"));
                string bannedipaddress  = PageMgmt.Decrypted(Request.QueryString["d"].Replace(" ", "+"));
                string compid           = PageMgmt.Decrypted(Request.QueryString["e"].Replace(" ", "+"));
                string computername     = PageMgmt.Decrypted(Request.QueryString["f"].Replace(" ", "+"));
                string computerip       = PageMgmt.Decrypted(Request.QueryString["g"].Replace(" ", "+"));

                string         strftpdetail = " SELECT * from ServerMasterTbl where Status='1'";
                SqlCommand     cmdftpdetail = new SqlCommand(strftpdetail, con);
                DataTable      dtftpdetail  = new DataTable();
                SqlDataAdapter adpftpdetail = new SqlDataAdapter(cmdftpdetail);
                adpftpdetail.Fill(dtftpdetail);
                if (dtftpdetail.Rows.Count > 0)
                {
                    string     strlicense = " update Permenatalybanmacaddressandipadress set BanIsActive='0' where MacAddress='" + MacAddress + "' and Ipaddress='" + Ipaddress + "' and computerip='" + computerip + "' and computername='" + computername + "' and bannedmacaddress='" + bannedmacaddress + "' and bannedipaddress='" + bannedipaddress + "' and BanIsActive='1' ";
                    SqlCommand cmdlicense = new SqlCommand(strlicense, con);
                    if (con.State.ToString() != "Open")
                    {
                        con.Open();
                    }
                    cmdlicense.ExecuteNonQuery();
                    con.Close();

                    if (bannedmacaddress == "1" && bannedipaddress == "0")
                    {
                        sendmailformac(compid, computername);
                    }
                    if (bannedmacaddress == "0" && bannedipaddress == "1")
                    {
                        sendmailforip(compid, Ipaddress);
                    }

                    foreach (DataRow dr in dtftpdetail.Rows)
                    {
                        string serversqlserverip     = dr["sqlurl"].ToString();
                        string serversqlinstancename = dr["DefaultsqlInstance"].ToString();
                        string serversqldbname       = dr["DefaultDatabaseName"].ToString();
                        string serversqlpwd          = dr["Sapassword"].ToString();
                        string serversqlport         = dr["port"].ToString();

                        connserver = new SqlConnection();
                        connserver.ConnectionString = @"Data Source =" + serversqlserverip + "\\" + serversqlinstancename + "," + serversqlport + "; Initial Catalog=" + serversqldbname + "; User ID=Sa; Password="******"; Persist Security Info=true;";

                        try
                        {
                            string     strupdate = "  update Permenatalybanmacaddressandipadress set BanIsActive='0' where MacAddress='" + MacAddress + "' and Ipaddress='" + Ipaddress + "' and computerip='" + computerip + "' and computername='" + computername + "' and bannedmacaddress='" + bannedmacaddress + "' and bannedipaddress='" + bannedipaddress + "'  ";
                            SqlCommand cmdupdate = new SqlCommand(strupdate, connserver);
                            if (connserver.State.ToString() != "Open")
                            {
                                connserver.Open();
                            }
                            cmdupdate.ExecuteNonQuery();
                            connserver.Close();
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
    }
示例#18
0
    public static SqlConnection busclient()
    {
        SqlConnection bus = new SqlConnection();



        string         strcomid = " Select * from CompanyDatabaseDetailTbl where CompanyLoginId='" + Convert.ToString(HttpContext.Current.Session["Comid"]) + "' and CodeType='BUSICONTROLDB' ";
        SqlDataAdapter adcheck1 = new SqlDataAdapter(strcomid, serverconn());
        DataTable      dtcheck1 = new DataTable();

        adcheck1.Fill(dtcheck1);

        if (dtcheck1.Rows.Count > 0)
        {
            bus = new SqlConnection();
            bus.ConnectionString = @"Data Source =" + dtcheck1.Rows[0]["SqlServerName"] + "\\" + dtcheck1.Rows[0]["SqlInstanceName"] + "; Initial Catalog = " + dtcheck1.Rows[0]["DatabaseName"] + "; User ID=" + dtcheck1.Rows[0]["SqlUserID"] + "; Password="******"SqlPassword"].ToString()) + "; Persist Security Info=true;";
            bidname = "[" + Convert.ToString(dtcheck1.Rows[0]["DatabaseName"]) + "]";
            //Data Source =C3\C3SERVERMASTER; Initial Catalog = jobcenter.BUSICONTROLDB; User ID=Sa; Password=06De1963++; Persist Security Info=true;
        }
        return(bus);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["comid"] != null && Request.QueryString["id"] != null)
        {
            if (Request.QueryString["orderpaystatus"] != null && Request.QueryString["paymentinfo"] != null)
            {
                Session["conf_pay_id"] = Request.QueryString["orderpaystatus"];
                Session["paymentinfo"] = Request.QueryString["paymentinfo"];
                con.Open();
                fillplanAndProduct();
                SqlCommand cmdu = new SqlCommand("update Payment_Order_Conform SET   Status ='Approve' Where conf_pay_id=" + Session["conf_pay_id"] + "", con);
                cmdu.ExecuteNonQuery();
                SqlCommand cmd1 = new SqlCommand("update OrderPaymentSatus SET   PaymentStatus ='Approve' Where OrderId=" + Session["conf_pay_id"] + "", con);
                cmd1.ExecuteNonQuery();
                //wait
                //SqlCommand cmd2 = new SqlCommand("update OrderPaymentSatus SET   salesorderid=" + lbl_orderno.Text + " Where OrderId=" + lbl_orderno.Text + "", con);
                //cmd2.ExecuteNonQuery();

                con.Close();
                ViewState["custom"] = "H1";
                Response.Redirect("https://paymentgateway.safestserver.com/PlaceOrderNotify_OtherthanPaypal.aspx?comp_id=" + Session["com_id"] + "&Status=VERIFIED&Amount=" + lbl_amount.Text + "&orderid=" + lbl_orderno.Text + "&paymode=" + Request.QueryString["paymode"] + "");
            }



            //******
            con.Close();
            con.Open();
            string cid = PageMgmt.Decrypted(Request.QueryString["comid"].ToString().Replace(" ", "+"));
            try
            {
                if (Request.QueryString["Franchisee"] != null)
                {
                    FranName = Request.QueryString["Franchisee"].ToString();
                }
            }
            catch (Exception ex)
            {
            }
            if (Request.QueryString["comidauto"] != null)

            {
                cid = Request.QueryString["comidauto"].ToString();
            }
            string id = Request.QueryString["id"].ToString();

            string         str = "select * from CompanyActivationRequestTbl where emailgeneratecompanyid='" + cid + "' and Id='" + id + "' and companyactive='0'  ";
            SqlCommand     cmd = new SqlCommand(str, con);
            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();
            adp.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                string     stractivation = " update  CompanyActivationRequestTbl set companyactive='1' where emailgeneratecompanyid='" + cid + "' and Id='" + id + "' ";
                SqlCommand cmdactivation = new SqlCommand(stractivation, con);
                if (con.State.ToString() != "Open")
                {
                    con.Open();
                }
                cmdactivation.ExecuteNonQuery();
                con.Close();

                string     strcmp = " update  CompanyMaster set CompanyActiveByAdmin='1' where CompanyLoginId='" + cid + "'  ";
                SqlCommand cmdcmp = new SqlCommand(strcmp, con);
                if (con.State.ToString() != "Open")
                {
                    con.Open();
                }
                cmdcmp.ExecuteNonQuery();
                con.Close();

                sendmailconfiguration(cid);

                Label1.Text = " The company " + cid + " is successfully approved and an email has been sent to the client with configuration link";
            }

            // sendmailconfiguration(cid);
        }
    }
    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
                {
                }
            }
        }
    }
示例#21
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string productversionid = ddlproductname.SelectedValue;
        string codecategoryno   = ddlcodetypecatefory.SelectedValue;
        string codetypeid       = ddlcodetype.SelectedValue;
        string codeversionno    = lblnewcodetypeNo.Text;

        string newfoldername = DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
        string dateformat    = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();

        string insidefoldername = "";


        string         strbasefilename = " select * from ProductMasterCodeTbl where ProductVerID='" + ddlproductname.SelectedValue + "' and CodeTypeID='" + ddlcodetype.SelectedValue + "' and codeversionnumber=(select Min(codeversionnumber) from ProductMasterCodeTbl where ProductVerID='" + ddlproductname.SelectedValue + "' and CodeTypeID='" + ddlcodetype.SelectedValue + "') ";
        SqlCommand     cmdbasefilename = new SqlCommand(strbasefilename, con);
        DataTable      dtbasefilename  = new DataTable();
        SqlDataAdapter adpbasefilename = new SqlDataAdapter(cmdbasefilename);

        adpbasefilename.Fill(dtbasefilename);

        if (dtbasefilename.Rows.Count > 0)
        {
            string tempfilename  = dtbasefilename.Rows[0]["filename"].ToString();
            string unzipfilename = tempfilename.Replace(".zip", "");
            insidefoldername = unzipfilename;
        }
        else
        {
            insidefoldername = productversionid + "_" + codecategoryno + "_" + codetypeid + "_" + codeversionno + "_" + dateformat;
        }


        string filename = insidefoldername + ".zip";

        try
        {
            if (Directory.Exists(txtoutputsourcepath.Text + "\\" + newfoldername))
            {
            }
            else
            {
                Directory.CreateDirectory(txtoutputsourcepath.Text + "\\" + newfoldername);
            }

            if (Directory.Exists(txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + insidefoldername))
            {
            }
            else
            {
                Directory.CreateDirectory(txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + insidefoldername);
            }
            if (Directory.Exists(txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + insidefoldername + "\\" + insidefoldername))
            {
            }
            else
            {
                Directory.CreateDirectory(txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + insidefoldername + "\\" + insidefoldername);
            }
        }
        catch
        {
        }



        string physicalpath = txtsourcepath.Text;

        try
        {
            if (File.Exists(physicalpath + ".zip"))
            {
                File.Delete(physicalpath + ".zip");
            }
        }
        catch
        {
        }

        using (ZipFile zip = new ZipFile())
        {
            zip.AddDirectory(physicalpath);
            zip.Save(physicalpath + ".zip");
        }

        if (Directory.Exists(txttemppath.Text + "\\" + newfoldername))
        {
        }
        else
        {
            Directory.CreateDirectory(txttemppath.Text + "\\" + newfoldername);
        }


        string temppath = txttemppath.Text + "\\" + newfoldername;

        using (ZipFile zip = ZipFile.Read(physicalpath + ".zip"))
        {
            zip.ExtractAll(temppath, ExtractExistingFileAction.OverwriteSilently);
        }

        File.Delete(physicalpath + ".zip");

        try
        {
            string         str122 = "select * from VersionInfoMasterDeleteFolder where VersionInfoId='" + ddlproductname.SelectedValue + "'";
            SqlCommand     cmd12  = new SqlCommand(str122, con);
            SqlDataAdapter adp12  = new SqlDataAdapter(cmd12);
            DataTable      ds12   = new DataTable();
            adp12.Fill(ds12);
            int ii = 0;
            for (int j = 0; j < ds12.Rows.Count; j++)
            {
                try
                {
                    Directory.Delete(txttemppath.Text + "\\" + newfoldername + "" + ds12.Rows[ii]["VersionDeleteFolderPath"].ToString() + "", true);
                }
                catch (Exception ex)
                {
                    lblfolder.Text   += " " + ds12.Rows[ii]["VersionDeleteFolderPath"].ToString() + ", ";
                    lblfolder.Visible = true;
                }
            }
            //Directory.Delete(txttemppath.Text + "\\" + newfoldername + "\\ShoppingCart\\Admin\\VersionFolder", true);
            //Directory.Delete(txttemppath.Text + "\\" + newfoldername + "\\ShoppingCart\\Developer", true);
            //Directory.Delete(txttemppath.Text + "\\" + newfoldername + "\\Party\\VersionFolder", true);
            //Directory.Delete(txttemppath.Text + "\\" + newfoldername + "\\_vti_cnf", true);
            //Directory.Delete(txttemppath.Text + "\\" + newfoldername + "\\Account\\1133", true);
            //Directory.Delete(txttemppath.Text + "\\" + newfoldername + "\\VersionFolder", true);
            //Directory.Delete(txttemppath.Text + "\\" + newfoldername + "\\Attach", true);

            //File.Delete(txttemppath.Text + "\\" + newfoldername + "\\bin\\businesssetup.dll");
            //File.Delete(txttemppath.Text + "\\" + newfoldername + "\\bin\\documentrule.dll");
            //File.Delete(txttemppath.Text + "\\" + newfoldername + "\\bin\\presensenote.dll");

            // Directory.Delete(txttemppath.Text + "\\" + newfoldername + "\\_vti_cnf", true);
        }
        catch
        {
        }



        DirectoryInfo sourceDir = new DirectoryInfo(txttemppath.Text + "\\" + newfoldername);
        double        size      = GetSizeDirectory(sourceDir);

        double twpercsize = 0.20 * size;



        string           mspath           = "C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\";
        string           mscompiler       = "aspnet_compiler.exe";
        string           fullcompilerpath = Path.Combine(mspath, mscompiler);
        ProcessStartInfo startinfo        = new ProcessStartInfo();


        string virtualfilename = "/" + dateformat;
        string outputpath      = txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + insidefoldername + "\\" + insidefoldername;
        string argument        = "-p " + temppath + " -v " + virtualfilename + " -u -f " + outputpath + " -fixednames";

        Process.Start(fullcompilerpath, argument).WaitForExit();

        try
        {
            File.Delete(outputpath + "\\bin\\businesssetup.dll");
            File.Delete(outputpath + "\\bin\\documentrule.dll");
            File.Delete(outputpath + "\\bin\\presensenote.dll");
        }
        catch
        {
        }
        try
        {
            string         str122 = "select * from VersionInfoMasterDeleteFolder where VersionInfoId='" + ddlproductname.SelectedValue + "'";
            SqlCommand     cmd12  = new SqlCommand(str122, con);
            SqlDataAdapter adp12  = new SqlDataAdapter(cmd12);
            DataTable      ds12   = new DataTable();
            adp12.Fill(ds12);
            int ii = 0;
            for (int j = 0; j < ds12.Rows.Count; j++)
            {
                try
                {
                    Directory.Delete(txttemppath.Text + "\\" + newfoldername + "" + ds12.Rows[ii]["VersionDeleteFolderPath"].ToString() + "", true);
                }
                catch (Exception ex)
                {
                    lblfolder.Text   += " " + ds12.Rows[ii]["VersionDeleteFolderPath"].ToString() + ", ";
                    lblfolder.Visible = true;
                }
            }
        }
        catch (Exception ex)
        {
        }

        if (!File.Exists(outputpath + "\\bin\\businesssetup.dll") && !File.Exists(outputpath + "\\bin\\documentrule.dll") && !File.Exists(outputpath + "\\bin\\presensenote.dll"))
        {
            using (ZipFile zip = new ZipFile())
            {
                zip.AddDirectory(txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + insidefoldername);
                zip.Save(txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + insidefoldername + ".zip");
            }
            DirectoryInfo outdir = new DirectoryInfo(txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + insidefoldername);

            double outfoldersize = GetSizeOutDirectory(outdir);

            if (outfoldersize > twpercsize)
            {
                if (System.IO.File.Exists(txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + insidefoldername + ".zip"))
                {
                    // File.Move(txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + insidefoldername + ".zip", txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + filename);



                    string         strcln = " select * from ClientMaster where ClientMasterId='" + Session["ClientId"].ToString() + "'";
                    SqlCommand     cmdcln = new SqlCommand(strcln, con);
                    DataTable      dtcln  = new DataTable();
                    SqlDataAdapter adpcln = new SqlDataAdapter(cmdcln);
                    adpcln.Fill(dtcln);

                    if (dtcln.Rows.Count > 0)
                    {
                        string defaltdrivepath      = dtcln.Rows[0]["DefaultSourceDrivePath"].ToString();
                        string companyname          = dtcln.Rows[0]["CompanyName"].ToString();
                        string mastersourcefilepath = defaltdrivepath + "\\" + filename;  // code type 1

                        // Copy website folder
                        //oa
                        File.Copy(txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + filename, mastersourcefilepath, true);

                        // end oa

                        insert(Convert.ToInt32(ddlproductname.SelectedValue), Convert.ToInt32(ddlcodetype.SelectedValue), Convert.ToInt32(lblnewcodetypeNo.Text), filename, mastersourcefilepath, txtoutputsourcepath.Text + "\\" + newfoldername + "\\" + filename);

                        SqlCommand cmdsq = new SqlCommand("Insert into ProductMasterLatestcodeversioninfoTBl(Productveriontbl,CodeVersion,CodeTypeID)Values('" + ddlproductname.SelectedValue + "','" + lblnewcodetypeNo.Text + "','" + ddlcodetype.SelectedValue + "')", con);
                        if (con.State.ToString() != "Open")
                        {
                            con.Open();
                        }
                        cmdsq.ExecuteNonQuery();
                        con.Close();

                        DataTable dtrsc = selectBZ("Select Max(Id) as Id,Productveriontbl,CodeTypeID,CodeVersion  from ProductMasterLatestcodeversioninfoTBl where Productveriontbl='" + ddlproductname.SelectedValue + "' and  CodeVersion='" + lblnewcodetypeNo.Text + "' and CodeTypeID='" + ddlcodetype.SelectedValue + "' Group by Productveriontbl,CodeTypeID,CodeVersion");

                        SqlCommand cmdsxwebpub = new SqlCommand("Insert into WebsitePublish(CodeTypeId,ProductVersionId,DateTime,SourcePath,OutputPath,OutPutfileZipName,codeversionnumber)Values('" + ddlcodetype.SelectedValue + "','" + ddlproductname.SelectedValue + "','" + DateTime.Now.ToString() + "','" + physicalpath + "','" + outputpath + "','" + filename + "','" + lblnewcodetypeNo.Text + "')", con);
                        if (con.State.ToString() != "Open")
                        {
                            con.Open();
                        }
                        cmdsxwebpub.ExecuteNonQuery();
                        con.Close();



                        string         strgetserverid = "select distinct ServerId from ServerAssignmentMasterTbl where VersionId='" + ddlproductname.SelectedValue + "'";
                        SqlCommand     cmdgetserverid = new SqlCommand(strgetserverid, con);
                        DataTable      dtgetserverid  = new DataTable();
                        SqlDataAdapter adpgetserverid = new SqlDataAdapter(cmdgetserverid);
                        adpgetserverid.Fill(dtgetserverid);

                        if (dtgetserverid.Rows.Count > 0 && dtrsc.Rows.Count > 0 && Convert.ToString(dtrsc.Rows[0]["Id"]) != "")
                        {
                            foreach (DataRow dr in dtgetserverid.Rows)
                            {
                                string serverid = dr["ServerId"].ToString();

                                string         strftpdetail = " SELECT * from ServerMasterTbl where Id='" + serverid + "'";
                                SqlCommand     cmdftpdetail = new SqlCommand(strftpdetail, con);
                                DataTable      dtftpdetail  = new DataTable();
                                SqlDataAdapter adpftpdetail = new SqlDataAdapter(cmdftpdetail);
                                adpftpdetail.Fill(dtftpdetail);

                                if (dtftpdetail.Rows.Count > 0)
                                {
                                    string serversqlserverip     = dtftpdetail.Rows[0]["sqlurl"].ToString();
                                    string serversqlinstancename = dtftpdetail.Rows[0]["DefaultsqlInstance"].ToString();
                                    string serversqldbname       = dtftpdetail.Rows[0]["DefaultDatabaseName"].ToString();
                                    string serversqlpwd          = dtftpdetail.Rows[0]["Sapassword"].ToString();
                                    string serversqlport         = dtftpdetail.Rows[0]["port"].ToString();

                                    connserver = new SqlConnection();
                                    connserver.ConnectionString = @"Data Source =" + serversqlserverip + "\\" + serversqlinstancename + "," + serversqlport + "; Initial Catalog=" + serversqldbname + "; User ID=Sa; Password="******"; Persist Security Info=true;";


                                    try
                                    {
                                        SqlCommand cmdsx = new SqlCommand("Insert into ProductMasterLatestcodeversioninfoTBl(Id,Productveriontbl,CodeVersion,CodeTypeID)Values('" + Convert.ToString(dtrsc.Rows[0]["Id"]) + "','" + Convert.ToString(dtrsc.Rows[0]["Productveriontbl"]) + "','" + Convert.ToString(dtrsc.Rows[0]["CodeVersion"]) + "','" + Convert.ToString(dtrsc.Rows[0]["CodeTypeID"]) + "')", connserver);
                                        if (connserver.State.ToString() != "Open")
                                        {
                                            connserver.Open();
                                        }
                                        cmdsx.ExecuteNonQuery();
                                        connserver.Close();
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    lblmsg.Visible = true;
                    lblmsg.Text    = "File does not exist";
                }
            }
            else
            {
                lblmsg.Visible = true;
                lblmsg.Text    = "Error in Compilation : Project is not Comppile properly";
            }
        }
        else
        {
            lblmsg.Visible = true;
            lblmsg.Text    = "Error in Compilation";
        }

        fillgrid();

        findnewcodeversion();
    }
    private void CheckDbConn()
    {
//        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"] + "'");
//        if (dtconn.Rows.Count > 0)
//        {

//        }

//        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);
//        try
//        {
//            // conn.ConnectionString = @"Data Source =" + dtconn.Rows[0]["SqlServerName"] + "\\" + dtconn.Rows[0]["instancename"] + "," + dtconn.Rows[0]["port"] + "; Initial Catalog = " +  DropDownList1.SelectedItem.Text + "; Integrated Security = true";
//            // String strConn = System.Configuration.ConfigurationManager.ConnectionStrings["@Data Source=TCP:192.168.9.120,30000; Initial Catalog = Licensejobcenter.OADB; Persist Security Info=true;"].ToString();
//            //conn1.ConnectionString = "@Data Source=TCP:192.168.9.120,30000; Initial Catalog = Licensejobcenter.OADB; User ID=TVMDeveloper; Password=Om2015++; Persist Security Info=true;";
//            conn1 = new SqlConnection();
//          conn1.ConnectionString = @"Data Source =" + dtconn.Rows[0]["ServerName"] + "\\" + dtconn.Rows[0]["Instancename"] + "," + dtconn.Rows[0]["port"] + "; Initial Catalog=" + dtcln.Rows[0]["CodeTypeName"].ToString() + "; User ID=sa; Password="******"Sapassword"].ToString()) + "; Persist Security Info=true;";
//          //  conn1.ConnectionString = "Data Source =TCP:192.168.9.120,30000; Initial Catalog = jobcenter.OADB; User ID= TVMDeveloper; Password=Om2015++; Persist Security Info=true;";

        DataTable dtdatabaseins = select(@"SELECT dbo.CodeTypeTbl.Instancename, dbo.CodeTypeTbl.ID, dbo.CodeTypeTbl.ProductCodeDetailId, dbo.ClientMaster.ServerId,CodeTypeName FROM dbo.CodeTypeTbl INNER JOIN dbo.ClientMaster INNER JOIN dbo.ProductMaster ON dbo.ClientMaster.ClientMasterId = dbo.ProductMaster.ClientMasterId INNER JOIN dbo.VersionInfoMaster ON dbo.ProductMaster.ProductId = dbo.VersionInfoMaster.ProductId ON dbo.CodeTypeTbl.ProductVersionId = dbo.VersionInfoMaster.VersionInfoId where dbo.CodeTypeTbl.ProductCodeDetailId='" + ViewState["databaseid"] + "'");

        if (dtdatabaseins.Rows.Count > 0)
        {
            string    serverid = dtdatabaseins.Rows[0]["ServerId"].ToString();
            string    serversqlinstancename = dtdatabaseins.Rows[0]["Instancename"].ToString();
            DataTable dtserver = select(@" SELECT * FROM dbo.ServerMasterTbl Where Id='" + serverid + "' ");
            // Label360.Text = DropDownList1.SelectedItem.Text;
            string serversqlserverip = dtserver.Rows[0]["sqlurl"].ToString();
            //string serversqlinstancename = ddlinstance.SelectedItem.Text;
            string serversqldbname = dtserver.Rows[0]["CodeTypeName"].ToString();
            string serversqlpwd    = dtserver.Rows[0]["Sapassword"].ToString();
            string serversqlport   = dtserver.Rows[0]["port"].ToString();

            string Sqlinstancename    = dtserver.Rows[0]["Sqlinstancename"].ToString();
            string DefaultsqlInstance = dtserver.Rows[0]["DefaultsqlInstance"].ToString();



            try
            {
                conn1 = new SqlConnection();
                if (serversqlinstancename == Sqlinstancename)
                {
                    conn1.ConnectionString = @"Data Source=C3\\BUSIWIZSQL1;Initial Catalog=License.Busiwiz;Integrated Security=True";
                    conn1.ConnectionString = @"Data Source=" + serversqlserverip + "\\" + Sqlinstancename + ";Initial Catalog=" + serversqldbname + ";Integrated Security=True";
                }
                else
                {
                    conn1.ConnectionString = @"Data Source =" + serversqlserverip + "\\" + serversqlinstancename + "," + serversqlport + "; Initial Catalog=" + serversqldbname + "; User ID=Sa; Password="******"; Persist Security Info=true;";
                    // conn1.ConnectionString = @"Data Source =" + dtconn.Rows[0]["ServerName"] + "\\" + dtconn.Rows[0]["Instancename"] + "," + dtconn.Rows[0]["port"] + "; Initial Catalog=" + DropDownList1.SelectedItem.Text + "; User ID=sa; Password="******"Sapassword"].ToString()) + "; Persist Security Info=true;";
                }



                conn1.Open();
                ConnectionState conState = conn1.State;

                if (conState == ConnectionState.Closed || conState == ConnectionState.Broken)
                {
                    //logger.Warn(LogTopicEnum.Agent, "Connection failed in DB connection test on CheckDBConnection");
                    //return false;
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
            }
        }
    }
    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();
    }
示例#24
0
    protected void grvInstructions_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        //try
        //{
        if (e.CommandName == "Download")
        {
            int    j             = Convert.ToInt16(e.CommandArgument);
            Int64  FileID        = Convert.ToInt64(grvInstructions.DataKeys[j]["ID"]);
            Int64  PageVersionID = Convert.ToInt64(grvInstructions.DataKeys[j]["VersionID"]);
            string DocumentTitle = Convert.ToString(grvInstructions.DataKeys[j]["WorkRequirementPdfFileName"]);

            string strcount = " select PDSA.FileName, PDSA.PageWorkTblId as PageWorkMasterId, " +
                              "WebsiteMaster.*,PageMaster.FolderName from PageDevelopmentSourceCodeAllocateTable AS PDSA " +
                              "inner join  PageWorkTbl  on PageWorkTbl.id=PDSA.PageWorkTblId " +
                              "inner join PageVersionTbl on PageVersionTbl.Id=PageWorkTbl.PageVersionTblId " +
                              "inner join PageMaster on PageMaster.PageId=PageVersionTbl.PageMasterId " +
                              "inner join MainMenuMaster on MainMenuMaster.MainMenuId=PageMaster.MainMenuId  " +
                              "inner join  MasterPageMaster on MasterPageMaster.MasterPageId=MainMenuMaster.MasterPage_Id  " +
                              "inner join WebsiteSection on WebsiteSection.WebsiteSectionId=MasterPageMaster.WebsiteSectionId  " +
                              "inner join WebsiteMaster on WebsiteMaster.ID=WebsiteSection.WebsiteMasterId where PageVersionTbl.Id='" + PageVersionID + "'";
            SqlCommand     cmdcount = new SqlCommand(strcount, con);
            DataTable      dtcount  = new DataTable();
            SqlDataAdapter adpcount = new SqlDataAdapter(cmdcount);
            adpcount.Fill(dtcount);


            string lblftpurl123      = "";
            string lblftpport123     = "";
            string lblftpuserid      = "";
            string lblftppassword123 = "";

            if (dtcount.Rows.Count > 0)
            {
                lblftpurl123        = dtcount.Rows[0]["FTP_Url"].ToString();
                lblftpport123       = dtcount.Rows[0]["FTP_Port"].ToString();
                lblftpuserid        = dtcount.Rows[0]["FTP_UserId"].ToString();
                lblftppassword123   = PageMgmt.Decrypted(dtcount.Rows[0]["FTP_Password"].ToString());
                ViewState["folder"] = dtcount.Rows[0]["FolderName"].ToString();

                string[] separator1   = new string[] { "/" };
                string[] strSplitArr1 = lblftpurl123.Split(separator1, StringSplitOptions.RemoveEmptyEntries);

                String productno = strSplitArr1[0].ToString();
                string ftpurl    = "";

                if (productno == "FTP:" || productno == "ftp:")
                {
                    if (strSplitArr1.Length >= 3)
                    {
                        ftpurl = strSplitArr1[0].ToString() + "//" + strSplitArr1[1].ToString() + ":" + lblftpport123;
                        for (int i = 2; i < strSplitArr1.Length; i++)
                        {
                            ftpurl += "/" + strSplitArr1[i].ToString();
                        }
                    }
                    else
                    {
                        ftpurl = strSplitArr1[0].ToString() + "//" + strSplitArr1[1].ToString() + ":" + lblftpport123;
                    }
                }
                else
                {
                    if (strSplitArr1.Length >= 2)
                    {
                        ftpurl = "ftp://" + strSplitArr1[0].ToString() + ":" + lblftpport123;
                        for (int i = 1; i < strSplitArr1.Length; i++)
                        {
                            ftpurl += "/" + strSplitArr1[i].ToString();
                        }
                    }
                    else
                    {
                        ftpurl = "ftp://" + strSplitArr1[0].ToString() + ":" + lblftpport123;
                    }
                }


                if (lblftpurl123.Length > 0)
                {
                    string   ftphost = ftpurl + "/" + ViewState["folder"] + "/Attach/";
                    string   fnname  = DocumentTitle.ToString();
                    string   despath = Server.MapPath("~\\Attachment\\") + fnname.ToString();
                    FileInfo filec   = new FileInfo(despath);
                    try
                    {
                        if (!filec.Exists)
                        {
                            GetFile(ftphost, fnname, despath, lblftpuserid, lblftppassword123);
                        }
                    }
                    catch (Exception ex)
                    {
                    }



                    FileInfo file = new FileInfo(despath);
                    if (file.Exists)
                    {
                        //Response.Clear();
                        //Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
                        //Response.AddHeader("Content-Length", file.Length.ToString());
                        //Response.ContentType = "application/octet-stream";
                        //Response.WriteFile(file.FullName);
                        //Response.End();

                        //HttpContext.Current.ApplicationInstance.CompleteRequest();
                        //Response.Flush();

                        //string filePath = "";
                        //filePath = Server.MapPath("~/Attachment/" + fnname);
                        //Response.ContentType = ContentType;
                        //Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(filePath));
                        //Response.WriteFile(filePath);
                        //Response.End();

                        System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
                        response.ClearContent();
                        response.Clear();
                        response.ContentType = "application/octet-stream";
                        response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name + ";");
                        response.TransmitFile(Server.MapPath("~/Attachment/" + file.Name));
                        response.Flush();
                        response.End();
                    }
                }
            }
        }
    }
示例#25
0
    // public SqlConnection servermasterconn;

    public PageConn()
    {
        dynconn = new SqlConnection();

        string strcln = "Select * from CompanyDatabaseDetailTbl where CompanyLoginId='" + Convert.ToString(HttpContext.Current.Session["Comid"]) + "' and CodeType='OADB' ";

        SqlCommand     cmdcln = new SqlCommand(strcln, serverconn());
        DataTable      dtcln  = new DataTable();
        SqlDataAdapter adpcln = new SqlDataAdapter(cmdcln);

        adpcln.Fill(dtcln);
        if (dtcln.Rows.Count > 0)
        {
            dynconn.ConnectionString = @"Data Source =" + dtcln.Rows[0]["SqlServerName"] + "\\" + dtcln.Rows[0]["SqlInstanceName"] + "; Initial Catalog = " + dtcln.Rows[0]["DatabaseName"] + "; User ID=" + dtcln.Rows[0]["SqlUserID"] + "; Password="******"SqlPassword"].ToString()) + "; Persist Security Info=true;";
            //Data Source =C3\C3SERVERMASTER; Initial Catalog = jobcenter.OADB; User ID=Sa; Password=06De1963++; Persist Security Info=true;
        }

        connnn = dynconn.ConnectionString.ToString();

        busdatabase = "[" + dynconn.Database + "]";
        HttpContext.Current.Session["dyconn"] = dynconn;
        intmsg();
        extmsg();
    }
示例#26
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();
        }
    }
示例#27
0
    public static SqlConnection serverconn()
    {
        SqlConnection servermasterconn = new SqlConnection();

        string         strcomp = "select ServerMasterTbl.*,CompanyMaster.Encryptkeycomp from CompanyMaster inner join ServerMasterTbl on ServerMasterTbl.Id=CompanyMaster.ServerId where CompanyMaster.CompanyLoginId='" + Convert.ToString(HttpContext.Current.Session["Comid"]) + "'  ";
        SqlCommand     cmdcomp = new SqlCommand(strcomp, licenseconn());
        DataTable      dtcomp  = new DataTable();
        SqlDataAdapter adpcomp = new SqlDataAdapter(cmdcomp);

        adpcomp.Fill(dtcomp);

        if (dtcomp.Rows.Count > 0)
        {
            servermasterconn.ConnectionString = @"Data Source =" + dtcomp.Rows[0]["sqlurl"].ToString() + "\\" + dtcomp.Rows[0]["DefaultsqlInstance"].ToString() + "," + dtcomp.Rows[0]["Port"].ToString() + "; Initial Catalog = " + dtcomp.Rows[0]["DefaultDatabaseName"].ToString() + "; User ID=sa; Password="******"Sapassword"].ToString()) + "; Persist Security Info=true; ";
            strEnc = Convert.ToString(dtcomp.Rows[0]["Encryptkeycomp"]);
            //Data Source =C3\C3SERVERMASTER,30000; Initial Catalog = C3SATELLITESERVER; User ID=sa; Password=06De1963++; Persist Security Info=true;
        }

        return(servermasterconn);
    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Remove")
        {
            GridView1.SelectedIndex = Convert.ToInt32(e.CommandArgument);
            int id = Convert.ToInt32(e.CommandArgument);

            string         str = "select * from Permenatalybanmacaddressandipadress where Id='" + id + "'  ";
            SqlCommand     cmd = new SqlCommand(str, con);
            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();
            adp.Fill(dt);

            if (dt.Rows.Count > 0)
            {
                string MacAddress       = dt.Rows[0]["MacAddress"].ToString();
                string Ipaddress        = dt.Rows[0]["Ipaddress"].ToString();
                string computerip       = dt.Rows[0]["computerip"].ToString();
                string computername     = dt.Rows[0]["computername"].ToString();
                string bannedmacaddress = dt.Rows[0]["bannedmacaddress"].ToString();
                string bannedipaddress  = dt.Rows[0]["bannedipaddress"].ToString();
                string compid           = dt.Rows[0]["compid"].ToString();
                string BanIsActive      = dt.Rows[0]["BanIsActive"].ToString();

                string         strftpdetail = " SELECT * from ServerMasterTbl where Status='1'";
                SqlCommand     cmdftpdetail = new SqlCommand(strftpdetail, con);
                DataTable      dtftpdetail  = new DataTable();
                SqlDataAdapter adpftpdetail = new SqlDataAdapter(cmdftpdetail);
                adpftpdetail.Fill(dtftpdetail);
                if (dtftpdetail.Rows.Count > 0)
                {
                    string     strlicense = " update Permenatalybanmacaddressandipadress set BanIsActive='0' where MacAddress='" + MacAddress + "' and Ipaddress='" + Ipaddress + "' and computerip='" + computerip + "' and computername='" + computername + "' and bannedmacaddress='" + bannedmacaddress + "' and bannedipaddress='" + bannedipaddress + "' and BanIsActive='1' ";
                    SqlCommand cmdlicense = new SqlCommand(strlicense, con);
                    if (con.State.ToString() != "Open")
                    {
                        con.Open();
                    }
                    cmdlicense.ExecuteNonQuery();
                    con.Close();

                    if (bannedmacaddress == "1" && bannedipaddress == "0")
                    {
                        sendmailformac(compid, computername);
                    }
                    if (bannedmacaddress == "0" && bannedipaddress == "1")
                    {
                        sendmailforip(compid, Ipaddress);
                    }
                    foreach (DataRow dr in dtftpdetail.Rows)
                    {
                        string serversqlserverip     = dr["sqlurl"].ToString();
                        string serversqlinstancename = dr["DefaultsqlInstance"].ToString();
                        string serversqldbname       = dr["DefaultDatabaseName"].ToString();
                        string serversqlpwd          = dr["Sapassword"].ToString();
                        string serversqlport         = dr["port"].ToString();

                        connserver = new SqlConnection();
                        connserver.ConnectionString = @"Data Source =" + serversqlserverip + "\\" + serversqlinstancename + "," + serversqlport + "; Initial Catalog=" + serversqldbname + "; User ID=Sa; Password="******"; Persist Security Info=true;";

                        try
                        {
                            string     strupdate = "  update Permenatalybanmacaddressandipadress set BanIsActive='0' where MacAddress='" + MacAddress + "' and Ipaddress='" + Ipaddress + "' and computerip='" + computerip + "' and computername='" + computername + "' and bannedmacaddress='" + bannedmacaddress + "' and bannedipaddress='" + bannedipaddress + "' and BanIsActive='1'";
                            SqlCommand cmdupdate = new SqlCommand(strupdate, connserver);
                            if (connserver.State.ToString() != "Open")
                            {
                                connserver.Open();
                            }
                            cmdupdate.ExecuteNonQuery();
                            connserver.Close();
                        }
                        catch
                        {
                        }
                    }
                }
            }
            fillgrid();
        }
    }
示例#29
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
        // {
        // }
    }
示例#30
0
    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  ";
                }
            }
        }
    }