コード例 #1
0
    protected void Database_Latest_Code_Insert(string compid, string comsid, string VersionInfoMasterId, string STRconnCompserver, string Comp_Ser_iispath, string Comp_Ser_Masterpath, string serverurl, string ClientServerid, string DefaultMdfpath, string DefaultLdfpath, string sqlservernameip, string sqlinstancename)
    {
        // database
        // Find All Product code and versionno here ie. OADB , USERLOG, EXTMSGDB Etc
        DataTable dsmaxiddatabase = MyCommonfile.selectBZ(" SELECT   dbo.ProductMasterCodeTbl.ProductVerID, dbo.ProductMasterCodeTbl.CodeTypeID, MAX(dbo.ProductMasterCodeTbl.codeversionnumber) AS codeversionnumber, dbo.ProductCodeDetailTbl.CodeTypeName FROM dbo.ProductMasterCodeTbl INNER JOIN dbo.CodeTypeTbl ON dbo.CodeTypeTbl.ID = dbo.ProductMasterCodeTbl.CodeTypeID INNER JOIN dbo.CodeTypeCategory ON dbo.CodeTypeCategory.CodeMasterNo = dbo.CodeTypeTbl.CodeTypeCategoryId INNER JOIN dbo.ProductCodeDetailTbl ON dbo.ProductCodeDetailTbl.Id = dbo.CodeTypeTbl.ProductCodeDetailId where ProductCodeDetailTbl.Active=1 and ProductMasterCodeTbl.ProductVerID='" + VersionInfoMasterId + "'  and CodeTypeCategory.CodeMasterNo In ('2')  GROUP BY dbo.ProductMasterCodeTbl.ProductVerID, dbo.ProductMasterCodeTbl.CodeTypeID, dbo.ProductCodeDetailTbl.CodeTypeName  ");

        if (dsmaxiddatabase.Rows.Count > 0)
        {
            foreach (DataRow drmaxdb in dsmaxiddatabase.Rows)
            {
                DataTable dtmastcode      = MyCommonfile.selectBZ(" SELECT * From ProductMasterCodeTbl Where codeversionnumber='" + drmaxdb["codeversionnumber"].ToString() + "' and CodeTypeID='" + drmaxdb["CodeTypeID"].ToString() + "' ");
                DataTable dtsercheck      = MyCommonfile.selectBZ(" SELECT * From ProductMasterCodeonsatelliteserverTbl Where ProductMastercodeID='" + dtmastcode.Rows[0]["ID"].ToString() + "' and dbo.ProductMasterCodeonsatelliteserverTbl.ServerID='" + comsid + "' ");
                string    filename        = dtmastcode.Rows[0]["filename"].ToString();
                string    ftpphysicalpath = Comp_Ser_Masterpath + "\\" + filename;
                if (dtsercheck.Rows.Count == 0)
                {
                    string     strsatelliteserverinsert = " Insert into ProductMasterCodeonsatelliteserverTbl(ProductMastercodeID,ServerID,Successfullyuploadedtoserver,Physicalpath,filename) values ('" + dtmastcode.Rows[0]["ID"].ToString() + "','" + comsid + "','0','" + ftpphysicalpath + "','" + filename + "')";
                    SqlCommand cmdsatelliteserverinsert = new SqlCommand(strsatelliteserverinsert, con);
                    if (con.State.ToString() != "Open")
                    {
                        con.Open();
                    }
                    cmdsatelliteserverinsert.ExecuteNonQuery();
                    con.Close();
                }
                //dtsercheck = MyCommonfile.selectBZ(" SELECT max(id) as maxcodeid  From ProductMasterCodeonsatelliteserverTbl ");
                dtsercheck = MyCommonfile.selectBZ(" SELECT * From ProductMasterCodeonsatelliteserverTbl Where ProductMastercodeID='" + dtmastcode.Rows[0]["ID"].ToString() + "' and dbo.ProductMasterCodeonsatelliteserverTbl.ServerID='" + comsid + "' ");
                string         strftpdetails = " Select * From ProductMasterCodeonsatelliteserverTbl Where Id='" + dtsercheck.Rows[0]["Id"].ToString() + "'  ";
                SqlCommand     cmdftpdetail  = new SqlCommand(strftpdetails, connCompserver);
                DataTable      dtftpdetail   = new DataTable();
                SqlDataAdapter adpftpdetail  = new SqlDataAdapter(cmdftpdetail);
                adpftpdetail.Fill(dtftpdetail);
                if (dtftpdetail.Rows.Count == 0)
                {
                    string     strserverinsert = " Insert into ProductMasterCodeonsatelliteserverTbl (ID,ProductMastercodeID,ServerID,Successfullyuploadedtoserver,Physicalpath,filename,DownloadStart,DownloadFinish) values  ('" + dtsercheck.Rows[0]["Id"].ToString() + "','" + dtmastcode.Rows[0]["ID"].ToString() + "','" + comsid + "','0','" + ftpphysicalpath + "','" + filename + "','0','0')";//,'" + sqlservernameip + "','" + sqlinstancename + "'
                    SqlCommand cmdserverinsert = new SqlCommand(strserverinsert, connCompserver);
                    if (connCompserver.State.ToString() != "Open")
                    {
                        connCompserver.Open();
                    }
                    cmdserverinsert.ExecuteNonQuery();
                    connCompserver.Close();
                }
                else
                {
                    //For License Table Updating Status
                    string     strProdMastServ = " Update ProductMasterCodeonsatelliteserverTbl SET Successfullyuploadedtoserver='" + dtftpdetail.Rows[0]["Successfullyuploadedtoserver"].ToString() + "' where ID='" + dtftpdetail.Rows[0]["ID"].ToString() + "'";
                    SqlCommand cmdProdMastServ = new SqlCommand(strProdMastServ, con);
                    if (con.State.ToString() != "Open")
                    {
                        con.Open();
                    }
                    cmdProdMastServ.ExecuteNonQuery();
                    con.Close();
                }

                DataTable dtlice = MyCommonfile.selectBZ(" SELECT dbo.ProductMasterCodeonsatelliteserverTbl.ID,dbo.CodeTypeTbl.CodeTypeCategoryId, dbo.ProductMasterCodeonsatelliteserverTbl.ProductMastercodeID, dbo.ProductMasterCodeonsatelliteserverTbl.ServerID, dbo.ProductMasterCodeonsatelliteserverTbl.Successfullyuploadedtoserver, dbo.ProductMasterCodeonsatelliteserverTbl.Physicalpath, dbo.ProductMasterCodeonsatelliteserverTbl.filename, dbo.ProductMasterCodeTbl.ProductVerID, dbo.ProductMasterCodeTbl.CodeTypeID, dbo.ProductMasterCodeTbl.codeversionnumber, dbo.ProductCodeDetailTbl.Id AS CodedetailID ,dbo.ProductCodeDetailTbl.CodeTypeName,dbo.ProductCodeDetailTbl.CompanyDefaultData,dbo.ProductCodeDetailTbl.BusiwizSynchronization, dbo.ProductCodeDetailTbl.AdditionalPageInserted FROM  dbo.ProductMasterCodeonsatelliteserverTbl INNER JOIN dbo.ProductMasterCodeTbl ON dbo.ProductMasterCodeonsatelliteserverTbl.ProductMastercodeID = dbo.ProductMasterCodeTbl.ID INNER JOIN dbo.CodeTypeTbl ON dbo.ProductMasterCodeTbl.CodeTypeID = dbo.CodeTypeTbl.ID INNER JOIN dbo.ProductCodeDetailTbl ON dbo.CodeTypeTbl.ProductCodeDetailId = dbo.ProductCodeDetailTbl.Id where  dbo.ProductMasterCodeTbl.ID='" + dtmastcode.Rows[0]["ID"].ToString() + "' and dbo.CodeTypeTbl.ProductVersionId='" + VersionInfoMasterId + "' and dbo.ProductMasterCodeonsatelliteserverTbl.ServerID='" + comsid + "' ");
                if (dtlice.Rows.Count > 0)
                {
                    string Client_latestcodeZipFilePath = dtmastcode.Rows[0]["TemporaryPath"].ToString().Replace("\\\\", "\\");
                    string strftpdetail  = "  ";
                    string codetypeid    = drmaxdb["CodeTypeID"].ToString();
                    string codeversionno = drmaxdb["codeversionnumber"].ToString();

                    string  dnsname = "";
                    string  tocopymdfldffilenameOnSer = "";
                    string  ProductCodeDetailId       = dtlice.Rows[0]["CodedetailID"].ToString();
                    string  CodeTypeCategoryId        = dtlice.Rows[0]["CodeTypeCategoryId"].ToString(); //"2" //Database
                    string  CodeTypeName           = dtlice.Rows[0]["CodeTypeName"].ToString();
                    Boolean CompanyDefaultData     = Convert.ToBoolean(dtlice.Rows[0]["CompanyDefaultData"].ToString());
                    Boolean AdditionalPageInserted = Convert.ToBoolean(dtlice.Rows[0]["AdditionalPageInserted"].ToString());
                    Boolean BusiwizSynchronization = Convert.ToBoolean(dtlice.Rows[0]["BusiwizSynchronization"].ToString());
                    // string ldffilexten = Path.GetExtension("2056_2_2_172_201672933747982056_2_3_6_201310372975512056_2_3_4_2013812102621554blankcopytest_log.ldf");
                    string ldffilexten = dtlice.Rows[0]["filename"].ToString();
                    ldffilexten = Path.GetExtension(ldffilexten);
                    string mastersourcepathOnSer = dtlice.Rows[0]["Physicalpath"].ToString();
                    if (ldffilexten == ".LDF" || ldffilexten == ".ldf")
                    {
                        tocopymdfldffilenameOnSer = DefaultLdfpath;
                    }
                    if (ldffilexten == ".MDF" || ldffilexten == ".mdf")
                    {
                        tocopymdfldffilenameOnSer = DefaultMdfpath;
                    }
                    DataTable DTNeedcode = MyCommonfile.selectBZ(" SELECT * From CompanyCreationNeedCode Where CodeTypeId='" + codetypeid + "' and CodeVersionNo='" + codeversionno + "' and CompanyLoginId='" + compid + "' and ProductVersionId='" + VersionInfoMasterId + "' ");
                    if (DTNeedcode.Rows.Count == 0)
                    {
                        CompanyRelated.Insert_CompanyCreationNeedCode(compid, codetypeid, CodeTypeCategoryId, ProductCodeDetailId, codeversionno, VersionInfoMasterId, Comp_Ser_Masterpath + "\\" + dtmastcode.Rows[0]["filename"].ToString(), dtmastcode.Rows[0]["filename"].ToString(), dnsname, CodeTypeName, AdditionalPageInserted, Client_latestcodeZipFilePath, CompanyDefaultData, BusiwizSynchronization, sqlservernameip, sqlinstancename, dtlice.Rows[0]["Successfullyuploadedtoserver"].ToString(), dtmastcode.Rows[0]["ID"].ToString(), "", false, tocopymdfldffilenameOnSer);
                        DataTable Dmaxcodeid = selectSer(" SELECT max(Id) as maxid  From CompanyCreationNeedCode ");
                        if (DTNeedcode.Rows.Count == 0)
                        {
                            Insert_CompanyCreationNeedCode_Server(compid, codetypeid, CodeTypeCategoryId, ProductCodeDetailId, codeversionno, VersionInfoMasterId, Comp_Ser_Masterpath + "\\" + dtmastcode.Rows[0]["filename"].ToString(), dtmastcode.Rows[0]["filename"].ToString(), dnsname, CodeTypeName, AdditionalPageInserted, Client_latestcodeZipFilePath, CompanyDefaultData, BusiwizSynchronization, sqlservernameip, sqlinstancename, dtlice.Rows[0]["Successfullyuploadedtoserver"].ToString(), dtmastcode.Rows[0]["ID"].ToString(), Dmaxcodeid.Rows[0]["maxid"].ToString(), "", false, tocopymdfldffilenameOnSer);
                        }
                    }
                }
            }
        }
    }
コード例 #2
0
    //-----------------------------------------------------------------------------------
    protected void Website_Latest_Code_Insert(string comsid, string VersionInfoMasterId, string compid, string STRconnCompserver, string iispath, string Comp_ServEnckey, string Comp_Ser_Masterpath, string Comp_serverweburl, string Comp_IISPath)
    {
        string ftpphysicalpath = "";

        DataTable dsmaxidget = MyCommonfile.selectBZ(" SELECT   dbo.ProductMasterCodeTbl.ProductVerID, dbo.ProductMasterCodeTbl.CodeTypeID, MAX(dbo.ProductMasterCodeTbl.codeversionnumber) AS codeversionnumber, dbo.ProductCodeDetailTbl.CodeTypeName FROM dbo.ProductMasterCodeTbl INNER JOIN dbo.CodeTypeTbl ON dbo.CodeTypeTbl.ID = dbo.ProductMasterCodeTbl.CodeTypeID INNER JOIN dbo.CodeTypeCategory ON dbo.CodeTypeCategory.CodeMasterNo = dbo.CodeTypeTbl.CodeTypeCategoryId INNER JOIN dbo.ProductCodeDetailTbl ON dbo.ProductCodeDetailTbl.Id = dbo.CodeTypeTbl.ProductCodeDetailId where ProductMasterCodeTbl.ProductVerID='" + VersionInfoMasterId + "'  and CodeTypeCategory.CodeMasterNo In ('1')  GROUP BY dbo.ProductMasterCodeTbl.ProductVerID, dbo.ProductMasterCodeTbl.CodeTypeID, dbo.ProductCodeDetailTbl.CodeTypeName ");

        if (dsmaxidget.Rows.Count > 0)
        {
            foreach (DataRow drmaxdb in dsmaxidget.Rows)
            {
                DataTable dtmastcode = MyCommonfile.selectBZ(" SELECT * From ProductMasterCodeTbl Where codeversionnumber='" + drmaxdb["codeversionnumber"].ToString() + "' and CodeTypeID='" + drmaxdb["CodeTypeID"].ToString() + "' ");
                if (dtmastcode.Rows.Count > 0)
                {
                    string filename = dtmastcode.Rows[0]["filename"].ToString();
                    ftpphysicalpath = Comp_Ser_Masterpath + "\\" + filename;
                    DataTable dtsercheck = MyCommonfile.selectBZ(" SELECT * From ProductMasterCodeonsatelliteserverTbl Where ProductMastercodeID='" + dtmastcode.Rows[0]["ID"].ToString() + "' and dbo.ProductMasterCodeonsatelliteserverTbl.ServerID='" + comsid + "' ");
                    #region
                    if (dtsercheck.Rows.Count == 0)
                    {
                        string     strsatelliteserverinsert = " Insert into ProductMasterCodeonsatelliteserverTbl(ProductMastercodeID,ServerID,Successfullyuploadedtoserver,Physicalpath,filename) values ('" + dtmastcode.Rows[0]["ID"].ToString() + "','" + comsid + "','0','" + ftpphysicalpath + "','" + filename + "')";
                        SqlCommand cmdsatelliteserverinsert = new SqlCommand(strsatelliteserverinsert, con);
                        if (con.State.ToString() != "Open")
                        {
                            con.Open();
                        }
                        cmdsatelliteserverinsert.ExecuteNonQuery();
                        con.Close();

                        DataTable maxproductcodeid = MyCommonfile.selectBZ(" SELECT max(id) as maxcodeid  From ProductMasterCodeonsatelliteserverTbl ");

                        string         strftpdetail = " Select * From ProductMasterCodeonsatelliteserverTbl Where Id='" + maxproductcodeid.Rows[0]["maxcodeid"].ToString() + "'  ";
                        SqlCommand     cmdftpdetail = new SqlCommand(strftpdetail, connCompserver);
                        DataTable      dtftpdetail  = new DataTable();
                        SqlDataAdapter adpftpdetail = new SqlDataAdapter(cmdftpdetail);
                        adpftpdetail.Fill(dtftpdetail);
                        if (dtftpdetail.Rows.Count == 0)
                        {
                            string     strserverinsert = " Insert into ProductMasterCodeonsatelliteserverTbl (ID,ProductMastercodeID,ServerID,Successfullyuploadedtoserver,Physicalpath,filename,DownloadStart,DownloadFinish) values  ('" + maxproductcodeid.Rows[0]["maxcodeid"].ToString() + "','" + dtmastcode.Rows[0]["ID"].ToString() + "','" + comsid + "','0','" + ftpphysicalpath + "','" + filename + "','0','0')";//,'" + sqlservernameip + "','" + sqlinstancename + "'
                            SqlCommand cmdserverinsert = new SqlCommand(strserverinsert, connCompserver);
                            if (connCompserver.State.ToString() != "Open")
                            {
                                connCompserver.Open();
                            }
                            cmdserverinsert.ExecuteNonQuery();
                            connCompserver.Close();
                        }
                        else
                        {
                            string     strProdMastServ = " Update ProductMasterCodeonsatelliteserverTbl SET Successfullyuploadedtoserver='" + dtftpdetail.Rows[0]["Successfullyuploadedtoserver"].ToString() + "' where ID='" + dtftpdetail.Rows[0]["ID"].ToString() + "'";
                            SqlCommand cmdProdMastServ = new SqlCommand(strProdMastServ, con);
                            if (con.State.ToString() != "Open")
                            {
                                con.Open();
                            }
                            cmdProdMastServ.ExecuteNonQuery();
                            con.Close();
                        }
                    }
                    #endregion

                    DataTable dtlice = MyCommonfile.selectBZ(" SELECT dbo.ProductMasterCodeonsatelliteserverTbl.ID,dbo.CodeTypeTbl.CodeTypeCategoryId, dbo.ProductMasterCodeonsatelliteserverTbl.ProductMastercodeID, dbo.ProductMasterCodeonsatelliteserverTbl.ServerID, dbo.ProductMasterCodeonsatelliteserverTbl.Successfullyuploadedtoserver, dbo.ProductMasterCodeonsatelliteserverTbl.Physicalpath, dbo.ProductMasterCodeonsatelliteserverTbl.filename, dbo.ProductMasterCodeTbl.ProductVerID, dbo.ProductMasterCodeTbl.CodeTypeID, dbo.ProductMasterCodeTbl.codeversionnumber, dbo.ProductCodeDetailTbl.Id AS CodedetailID ,dbo.ProductCodeDetailTbl.CodeTypeName,dbo.ProductCodeDetailTbl.CompanyDefaultData,dbo.ProductCodeDetailTbl.BusiwizSynchronization, dbo.ProductCodeDetailTbl.AdditionalPageInserted,dbo.WebsiteMaster.DNSserver, dbo.WebsiteMaster.DNSname FROM  dbo.ProductMasterCodeonsatelliteserverTbl INNER JOIN dbo.ProductMasterCodeTbl ON dbo.ProductMasterCodeonsatelliteserverTbl.ProductMastercodeID = dbo.ProductMasterCodeTbl.ID INNER JOIN dbo.CodeTypeTbl ON dbo.ProductMasterCodeTbl.CodeTypeID = dbo.CodeTypeTbl.ID INNER JOIN dbo.ProductCodeDetailTbl ON dbo.CodeTypeTbl.ProductCodeDetailId = dbo.ProductCodeDetailTbl.Id INNER JOIN dbo.WebsiteMaster ON dbo.CodeTypeTbl.WebsiteID = dbo.WebsiteMaster.ID where  dbo.ProductMasterCodeTbl.ID='" + dtmastcode.Rows[0]["ID"].ToString() + "'  and dbo.WebsiteMaster.VersionInfoId='" + VersionInfoMasterId + "' and dbo.ProductMasterCodeonsatelliteserverTbl.ServerID='" + comsid + "'  ");
                    if (dtlice.Rows.Count > 0)
                    {
                        string ProductCodeDetailId = dtlice.Rows[0]["CodedetailID"].ToString();
                        string CodeTypeCategoryId  = dtlice.Rows[0]["CodeTypeCategoryId"].ToString();
                        string CodeTypeName        = dtlice.Rows[0]["CodeTypeName"].ToString();
                        string dnsname             = dtlice.Rows[0]["DNSname"].ToString();
                        string DNSserverid         = dtlice.Rows[0]["DNSserver"].ToString();

                        string         ProductMastercodeID = dtlice.Rows[0]["ProductMastercodeID"].ToString();
                        string         YourDomaiUrl        = "";
                        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)
                        {
                            Boolean AdditionalPageInserted = false;
                            Boolean CompanyDefaultData     = false;
                            Boolean BusiwizSynchronization = false;
                            try
                            {
                                AdditionalPageInserted = Convert.ToBoolean(dtlice.Rows[0]["AdditionalPageInserted"].ToString());
                            }
                            catch
                            {
                            }
                            #region
                            string codetypeid     = dtmastcode.Rows[0]["CodeTypeID"].ToString();
                            string codeversionno  = dtmastcode.Rows[0]["codeversionnumber"].ToString();
                            string serverconnnstr = connCompserver.ConnectionString;                                                    //Start--------Company's Server Connectionstring
                            //Start ............................Client Code Path
                            string Client_latestcodeZipFilePath = dtmastcode.Rows[0]["TemporaryPath"].ToString().Replace("\\\\", "\\"); //ex: D:\ALLNEWCOMPANYMASTERCOPY\35\IJobcenterMaster\WWW\PublishCode\2692017183317\10090_1_9078_1_262017918309.zip
                            string zipfolder = Path.GetFileName(Client_latestcodeZipFilePath.TrimEnd(Path.DirectorySeparatorChar));
                            if (File.Exists(Client_latestcodeZipFilePath))
                            {
                                DataTable DTNeedcode = MyCommonfile.selectBZ(" SELECT * From CompanyCreationNeedCode Where CodeTypeId='" + codetypeid + "' and CodeVersionNo='" + codeversionno + "' and CompanyLoginId='" + compid + "' and ProductVersionId='" + VersionInfoMasterId + "' ");
                                if (DTNeedcode.Rows.Count == 0)
                                {
                                    bool DNSAddingStatus = false;
                                    CompanyRelated.Insert_CompanyCreationNeedCode(compid, codetypeid, CodeTypeCategoryId, ProductCodeDetailId, codeversionno, VersionInfoMasterId, ftpphysicalpath, zipfolder, dnsname, CodeTypeName, AdditionalPageInserted, Client_latestcodeZipFilePath, CompanyDefaultData, BusiwizSynchronization, "", "", dtlice.Rows[0]["Successfullyuploadedtoserver"].ToString(), ProductMastercodeID, DNSserverid, DNSAddingStatus, Comp_IISPath);
                                    DataTable Dmaxcodeid = selectSer(" SELECT max(Id) as maxid  From CompanyCreationNeedCode ");
                                    if (DTNeedcode.Rows.Count == 0)
                                    {
                                        Insert_CompanyCreationNeedCode_Server(compid, codetypeid, CodeTypeCategoryId, ProductCodeDetailId, codeversionno, VersionInfoMasterId, ftpphysicalpath, zipfolder, dnsname, CodeTypeName, AdditionalPageInserted, Client_latestcodeZipFilePath, CompanyDefaultData, BusiwizSynchronization, "", "", dtlice.Rows[0]["Successfullyuploadedtoserver"].ToString(), ProductMastercodeID, Dmaxcodeid.Rows[0]["maxid"].ToString(), DNSserverid, DNSAddingStatus, Comp_IISPath);
                                    }
                                }
                            }
                            else
                            {
                                lblmsg.Text = " File not available at this path " + Client_latestcodeZipFilePath;
                            }
                            #endregion
                        }
                    }
                }
                else
                {
                    lblmsg.Text = " Client's server or ProductMasterCodeTbl Table records not available";
                }
            }
        }
    }