public static Boolean Delete_CompanyABCDetail_Server(string CompanyLoginId) { Boolean Status = false; try { SqlConnection connCompserver = new SqlConnection(); connCompserver = ServerWizard.ServerDefaultInstanceConnetionTCP(CompanyLoginId); if (connCompserver.State.ToString() != "Open") { connCompserver.Open(); } SqlCommand cmdDel = new SqlCommand("CompanyABCDetail_AddDelUpdtSelect", connCompserver); cmdDel.CommandType = CommandType.StoredProcedure; cmdDel.Parameters.AddWithValue("@StatementType", "Delete"); cmdDel.Parameters.AddWithValue("@CompanyLoginId", CompanyLoginId); cmdDel.ExecuteNonQuery(); Status = true; } catch { Status = false; } return(Status); }
public Boolean CheckDbConn() { Boolean status = false; DataTable dtdatabaseins = MyCommonfile.selectBZ(@"SELECT dbo.CodeTypeTbl.Instancename, dbo.CodeTypeTbl.ID, dbo.CodeTypeTbl.ProductCodeDetailId, dbo.ClientMaster.ServerId 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='" + ddlctype.SelectedValue + "'"); if (dtdatabaseins.Rows.Count > 0) { string serverid = dtdatabaseins.Rows[0]["ServerId"].ToString(); string serversqlinstancename = dtdatabaseins.Rows[0]["Instancename"].ToString(); conn1 = new SqlConnection(); conn1 = ServerWizard.ServerDatabaseFromInstanceTCP(serverid, serversqlinstancename, ddlctype.SelectedItem.Text); try { if (conn1.State.ToString() != "Open") { conn1.Open(); status = true; img_dbconn.ImageUrl = "~/images/DatabaseConnection/DatabaseConnTrue.png"; img_dbconn.Visible = true; conn1.Close(); } } catch { img_dbconn.ImageUrl = "~/images/DatabaseConnection/DatabaseConnFalse.png"; img_dbconn.Visible = true; } } return(status); }
public static Boolean Insert_CompanyABCDetail_SERVER(string CompanyLoginId, string Z, string D1, string D2, string D3, string D4, string D5, string E1, string E2, string E3, string E4, string E5, string F1, string F2, string F3, string F4, string F5) { Boolean Status = false; try { SqlConnection connCompserver = new SqlConnection(); connCompserver = ServerWizard.ServerDefaultInstanceConnetionTCP(CompanyLoginId); if (connCompserver.State.ToString() != "Open") { connCompserver.Open(); } SqlCommand cmd = new SqlCommand("CompanyABCDetail_AddDelUpdtSelect", connCompserver); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@StatementType", "Insert"); cmd.Parameters.AddWithValue("@CompanyLoginId", CompanyLoginId); cmd.Parameters.AddWithValue("@Z", Z); cmd.Parameters.AddWithValue("@D1", D1); cmd.Parameters.AddWithValue("@D2", D1); cmd.Parameters.AddWithValue("@D3", D3); cmd.Parameters.AddWithValue("@D4", D4); cmd.Parameters.AddWithValue("@D5", D5); cmd.Parameters.AddWithValue("@E1", E1); cmd.Parameters.AddWithValue("@E2", E1); cmd.Parameters.AddWithValue("@E3", E3); cmd.Parameters.AddWithValue("@E4", E4); cmd.Parameters.AddWithValue("@E5", E5); cmd.Parameters.AddWithValue("@F1", F1); cmd.Parameters.AddWithValue("@F2", F1); cmd.Parameters.AddWithValue("@F3", F3); cmd.Parameters.AddWithValue("@F4", F4); cmd.Parameters.AddWithValue("@F5", F5); cmd.ExecuteNonQuery(); connCompserver.Close(); Status = true; } catch { Status = false; } return(Status); }
protected void FullTableSync() { Boolean connnection = false; string Delete_From = ""; string PKname = ""; conn = new SqlConnection(); try { conn = ServerWizard.ServerDefaultInstanceConnetionTCP_Serverid(ViewState["sid"].ToString()); if (conn.State.ToString() != "Open") { conn.Open(); } conn.Close(); connnection = true; } catch (Exception ex) { } if (connnection == true) { encstr = ServerWizard.ServerEncrDecriKEY(ViewState["sid"].ToString()); DataTable dt = MyCommonfile.selectBZ("Select * From ClientProductTableMaster where Id=" + ViewState["tblid"] + ""); if (dt.Rows.Count > 0) { CreateTableDesign("" + dt.Rows[0]["TableName"].ToString() + ""); try { SqlCommand ccm = new SqlCommand(" Delete From " + dt.Rows[0]["TableName"].ToString() + " ", conn); if (conn.State.ToString() != "Open") { conn.Open(); } ccm.ExecuteNonQuery(); conn.Close(); } catch { conn.Close(); } Dynamicaly_FullTable(dt.Rows[0]["TableName"].ToString(), dt.Rows[0]["Id"].ToString()); } } }
protected void PortConnectionCheck() { Portconn = false; conn = new SqlConnection(); conn = ServerWizard.ServerDefaultInstanceConnetionTCP_Serverid(lblsid.Text); try { if (conn.State.ToString() != "Open") { conn.Open(); } Portconn = true; } catch { Portconn = false; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // string sidd = BZ_Common.BZ_Encrypted("5"); if (Request.QueryString["Cid"] != null) { string companyid = Request.QueryString["Cid"]; lblcid.Text = companyid; Boolean Comp__Actve__Status = CompanyWizard.Company_Active_Status(companyid); Boolean Comp__Licen__Active = CompanyWizard.Company_LicenseExpire_Status(companyid); Boolean Server__Active = ServerWizard.Server_Active_Status(companyid); if (Comp__Actve__Status == true && Comp__Licen__Active == true && Server__Active == true) { DataTable DTGetSid = CompanyWizard.SelectCompanyInfo(companyid); string sid = DTGetSid.Rows[0]["ServerId"].ToString(); lblsid.Text = sid; FillFrid(lblsid.Text); } else if (Comp__Actve__Status == false) { lblmsg.Text = "Company not active "; } else if (Comp__Licen__Active == false) { lblmsg.Text = "License Expired"; } else if (Server__Active == false) { lblmsg.Text = "Server Inactive"; } } else { lblmsg.Text = "No any recrd for company"; } } }
protected void PortConnectionCheck() { Portconn = false; conn = new SqlConnection(); conn = ServerWizard.ServerDefaultInstanceConnetionTCP_Serverid(ddlserver.SelectedValue); try { if (conn.State.ToString() != "Open") { conn.Open(); } link_openport.Text = ""; link_openport.Enabled = false; Portconn = true; } catch { link_openport.Text = ""; link_openport.Enabled = true; Portconn = false; } }
protected void InsertAtServer____FromJob3(string SId) { Boolean connnection = false; int c = 0; string Delete_From = ""; string PKname = ""; string deleteJob3ID = ""; conn = new SqlConnection(); try { conn = ServerWizard.ServerDefaultInstanceConnetionTCP_Serverid(SId); if (conn.State.ToString() != "Open") { conn.Open(); } conn.Close(); connnection = true; } catch (Exception ex) { } if (connnection == true) { int totalrec = 0; string Bunchinsert = ""; string seridstatus = ""; string Insert_IntoCommon = ""; DataTable dtcln = new DataTable(); DataTable dtJob1 = MyCommonfile.selectBZ(@" SELECT DISTINCT Satelitte_Server_Sync_Job_Master.Id AS Job1ID, Satelitte_Server_Sync_Job_Master.SatelliteServerID,ServerMasterTbl.ServerName,ServerMasterTbl.serverloction, dbo.Satelitte_Server_Sync_Job_Master.JobDateTime FROM dbo.Satelitte_Server_Sync_Job_Master INNER JOIN dbo.ServerMasterTbl ON dbo.Satelitte_Server_Sync_Job_Master.SatelliteServerID = dbo.ServerMasterTbl.Id Where Satelitte_Server_Sync_Job_Master.SatelliteServerID='" + SId + "'"); if (dtJob1.Rows.Count > 0) { encstr = ServerWizard.ServerEncrDecriKEY(SId); for (int i1 = 0; i1 < dtJob1.Rows.Count; i1++) { string Job1ID = dtJob1.Rows[i1]["Job1ID"].ToString(); string ServerName = dtJob1.Rows[i1]["ServerName"].ToString(); DataTable dtJob2 = MyCommonfile.selectBZ(@" SELECT TOP(1) Satellite_Server_Sync_Job_Details.ID AS Job2ID,Satellite_Server_Sync_Job_Details.TableID, dbo.ClientProductTableMaster.Id, dbo.ClientProductTableMaster.TableName FROM dbo.Satellite_Server_Sync_Job_Details INNER JOIN dbo.ClientProductTableMaster INNER JOIN dbo.SatelliteSyncronisationrequiringTablesMaster ON dbo.SatelliteSyncronisationrequiringTablesMaster.TableID = dbo.ClientProductTableMaster.Id ON dbo.Satellite_Server_Sync_Job_Details.TableID = dbo.SatelliteSyncronisationrequiringTablesMaster.TableID Where Satellite_Server_Sync_Job_Details.Satelitte_Server_Sync_Job_Master_ID='" + Job1ID + "' "); if (dtJob2.Rows.Count > 0) { for (int i2 = 0; i2 < dtJob2.Rows.Count; i2++) { string Job2ID = dtJob2.Rows[i2]["Job2ID"].ToString(); string TableName = dtJob2.Rows[i2]["TableName"].ToString(); string TableId = dtJob2.Rows[i2]["TableID"].ToString(); CreateTableDesign(TableName); DataTable dtJob3 = MyCommonfile.selectBZ(@" SELECT TOP(500) Satelite_Server_Sync_Log_Deatils.ID AS Job3ID,Satelite_Server_Sync_Log_Deatils.TypeOfOperationDone , Satelite_Server_Sync_Log_Deatils.RecordID, SyncActionMaster.ActionName FROM Satelite_Server_Sync_Log_Deatils INNER JOIN dbo.SyncActionMaster ON dbo.Satelite_Server_Sync_Log_Deatils.TypeOfOperationDone = dbo.SyncActionMaster.ID Where Satelite_Server_Sync_Log_Deatils.Satellite_Server_Sync_Job_Details_ID='" + Job2ID + "' "); if (dtJob3.Rows.Count > 0) { Insert_IntoCommon = " INSERT INTO " + TableName + "( "; DataTable dts1 = MyCommonfile.selectBZ(" select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + TableName + "'"); for (int k = 0; k < dts1.Rows.Count; k++) { Insert_IntoCommon += ("" + dts1.Rows[k]["column_name"] + " ,"); } Insert_IntoCommon = Insert_IntoCommon.Remove(Insert_IntoCommon.Length - 1); Insert_IntoCommon += ") Values "; // DataTable maxiddesid = MyCommonfile.selectBZ(" select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tablename + "'"); PKname = TableRelated.SatelliteSyncronisationrequiringTablesMaster_WherePKIDName(TableId); if (PKname.Length > 0) { } else { PKname = dts1.Rows[0]["column_name"].ToString(); } for (int iii = 0; iii < dtJob3.Rows.Count; iii++) { string Job3ID = dtJob3.Rows[iii]["Job3ID"].ToString(); string RecordID = dtJob3.Rows[iii]["RecordID"].ToString(); string Typeoperation = dtJob3.Rows[iii]["TypeOfOperationDone"].ToString(); deleteJob3ID += Job3ID + ","; try { if (Typeoperation == "1") { DataTable dtr = MyCommonfile.selectBZ(" Select * From " + TableName + " where " + PKname + "=" + RecordID + " "); foreach (DataRow itm in dtr.Rows) { c++; string Insert_Into = ""; Insert_Into += " ("; for (int k = 0; k < dts1.Rows.Count; k++) { Insert_Into += "'" + Encrypted(Convert.ToString(itm["" + dts1.Rows[k]["column_name"] + ""])) + "' ,"; } Insert_Into = Insert_Into.Remove(Insert_Into.Length - 1); Insert_Into += " ),"; Bunchinsert += Insert_Into; if (c == 200) { Bunchinsert = Bunchinsert.Remove(Bunchinsert.Length - 1); string ss = Insert_IntoCommon + Bunchinsert; SqlCommand ccm = new SqlCommand(ss, conn); if (conn.State.ToString() != "Open") { conn.Open(); } ccm.ExecuteNonQuery(); conn.Close(); deleteJob3ID = deleteJob3ID.Remove(deleteJob3ID.Length - 1); SqlCommand ccmm = new SqlCommand(" Delete From Satelite_Server_Sync_Log_Deatils Where ID IN (" + deleteJob3ID + ")", con); if (con.State.ToString() != "Open") { con.Open(); } ccmm.ExecuteNonQuery(); con.Close(); deleteJob3ID = ""; Bunchinsert = ""; c = 0; } } } totalrec++; //Permanent Record Functionality //----**** // // lblmsg.Text = " Successfully synchronization ";//" + totalrec + " records for " + lblname.Text + " server record " + lbl_RecordID.Text + "<br><br>"; } catch { seridstatus = SId; Bunchinsert = ""; lbl_Msg.Text = " Some problem when synchronization with " + ServerName + " server <br><br>";//e1.ToString()+"<br>"; } }//Job1 Loop if (Bunchinsert.Length > 0) { Bunchinsert = Bunchinsert.Remove(Bunchinsert.Length - 1); string ss = Insert_IntoCommon + Bunchinsert; SqlCommand ccm = new SqlCommand(ss, conn); if (conn.State.ToString() != "Open") { conn.Open(); } ccm.ExecuteNonQuery(); conn.Close(); deleteJob3ID = deleteJob3ID.Remove(deleteJob3ID.Length - 1); SqlCommand ccmm = new SqlCommand(" Delete From Satelite_Server_Sync_Log_Deatils Where ID IN (" + deleteJob3ID + ")", con); if (con.State.ToString() != "Open") { con.Open(); } ccmm.ExecuteNonQuery(); con.Close(); deleteJob3ID = ""; Bunchinsert = ""; c = 0; } // Boolean DeletestatusJob2 = Syncro_Tables.DeleteJob2____Satelite_Server_Sync_Log_Deatils(Job2ID); //Test DataTable dtfindtab = MyCommonfile.selectBZ(@" SELECT Count(dbo.Satelite_Server_Sync_Log_Deatils.ID) as TotalCount From dbo.Satellite_Server_Sync_Job_Details INNER JOIN dbo.ClientProductTableMaster INNER JOIN dbo.SatelliteSyncronisationrequiringTablesMaster ON dbo.SatelliteSyncronisationrequiringTablesMaster.TableID = dbo.ClientProductTableMaster.Id ON dbo.Satellite_Server_Sync_Job_Details.TableID = dbo.SatelliteSyncronisationrequiringTablesMaster.TableID AND dbo.Satellite_Server_Sync_Job_Details.TableID = dbo.ClientProductTableMaster.Id INNER JOIN dbo.Satelitte_Server_Sync_Job_Master ON dbo.Satellite_Server_Sync_Job_Details.Satelitte_Server_Sync_Job_Master_ID = dbo.Satelitte_Server_Sync_Job_Master.Id INNER JOIN dbo.ServerMasterTbl ON dbo.Satelitte_Server_Sync_Job_Master.SatelliteServerID = dbo.ServerMasterTbl.Id INNER JOIN dbo.Satelite_Server_Sync_Log_Deatils ON dbo.Satellite_Server_Sync_Job_Details.ID = dbo.Satelite_Server_Sync_Log_Deatils.Satellite_Server_Sync_Job_Details_ID INNER JOIN dbo.SyncActionMaster ON dbo.Satelite_Server_Sync_Log_Deatils.TypeOfOperationDone = dbo.SyncActionMaster.ID Where ServerMasterTbl.Id='" + SId + "' ");// and dbo.Satelitte_Server_Sync_Job_Master.Id='" + ViewState["JobID"] + "' and lbl_Msg.Text += " Please waite for some moment we syncronice " + dtfindtab.Rows[0]["TotalCount"] + " record at server "; } else { //Norecord in Job3 for Job2 Boolean DeletestatusJob2 = Syncro_Tables.DeleteJob2____Satellite_Server_Sync_Job_Details(Job2ID); } }//Job2 Lopp // Boolean DeletestatusJob1 = Syncro_Tables.DeleteJob1____Satelitte_Server_Sync_Job_Master(Job1ID); } else { //No Record in Job2 for selected job1 Boolean DeletestatusJob1 = Syncro_Tables.DeleteJob1____Satelitte_Server_Sync_Job_Master(Job1ID); } }//Job1 Loop } else { img_loading.Visible = false; lbl_Msg.Text += "<br> Job Done Successfully "; Timer1.Enabled = false; } } else { lbl_Msg.Text = " No connection possible with server <br> you are tying to connect database with this connection string ( " + conn.ConnectionString + " )";//e1.ToString()+"<br>"; } }
protected void CreateTableDesign(string tablename, string SId) { Boolean connnection = false; conn = new SqlConnection(); try { conn = ServerWizard.ServerDefaultInstanceConnetionTCPWithPublicIP_Serverid(SId); if (conn.State.ToString() != "Open") { conn.Open(); } conn.Close(); connnection = true; } catch (Exception ex) { Timer1.Enabled = true; lbl_Msg.Text = conn.ConnectionString + " Conetiong at here but some problem"; return; } if (connnection == true) { string st1 = "CREATE TABLE " + tablename + "("; DataTable dts1 = MyCommonfile.selectBZ("select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tablename + "'"); for (int k = 0; k < dts1.Rows.Count; k++) { if (k == 0) { //st1 += ("" + dts1.Rows[k]["column_name"] + " int Identity(1,1),"); st1 += ("" + dts1.Rows[k]["column_name"] + " nvarchar(500),"); } else { st1 += ("" + dts1.Rows[k]["column_name"] + " " + dts1.Rows[k]["data_type"] + "(" + dts1.Rows[k]["CHARACTER_MAXIMUM_LENGTH"] + "),"); } } st1 = st1.Remove(st1.Length - 1); st1 += ")"; //st1 = st1.Replace("int()", "int"); st1 = st1.Replace("bigint()", "nvarchar(500)"); st1 = st1.Replace("int()", "nvarchar(500)"); st1 = st1.Replace("(-1)", "(MAX)"); st1 = st1.Replace("datetime()", "nvarchar(500)"); st1 = st1.Replace("nvarchar(50)", "nvarchar(500)"); st1 = st1.Replace("decimal()", "nvarchar(500)"); st1 = st1.Replace("decimal", "nvarchar(500)"); st1 = st1.Replace("bit()", "nvarchar(500)");//st1 = st1.Replace("bit()", "bit"); st1 = st1.Replace("nvarchar(20)", "nvarchar(500)"); st1 = st1.Replace("nvarchar(10)", "nvarchar(500)"); st1 = st1.Replace("nvarchar(100)", "nvarchar(500)"); DataTable dts = selectSer("select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tablename + "'"); if (dts.Rows.Count <= 0) { SqlCommand cmdr = new SqlCommand(st1, conn); if (conn.State.ToString() != "Open") { conn.Open(); } cmdr.ExecuteNonQuery(); conn.Close(); } else { string strBC = " CREATE TABLE " + tablename + "("; DataTable DTBC = selectSer("select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tablename + "'"); for (int k = 0; k < DTBC.Rows.Count; k++) { if (k == 0) { strBC += ("" + DTBC.Rows[k]["column_name"] + " nvarchar(500),"); } else { strBC += ("" + DTBC.Rows[k]["column_name"] + " " + DTBC.Rows[k]["data_type"] + "(" + DTBC.Rows[k]["CHARACTER_MAXIMUM_LENGTH"] + "),"); } } strBC = strBC.Remove(strBC.Length - 1); strBC += ")"; st1 = st1.Replace("bigint()", "nvarchar(500)"); st1 = st1.Replace("int()", "nvarchar(500)"); st1 = st1.Replace("(-1)", "(MAX)"); st1 = st1.Replace("datetime()", "nvarchar(500)"); st1 = st1.Replace("nvarchar(50)", "nvarchar(500)"); st1 = st1.Replace("decimal()", "nvarchar(500)"); st1 = st1.Replace("decimal", "nvarchar(500)"); st1 = st1.Replace("bit()", "nvarchar(500)"); st1 = st1.Replace("nvarchar(20)", "nvarchar(500)"); st1 = st1.Replace("nvarchar(10)", "nvarchar(500)"); st1 = st1.Replace("nvarchar(100)", "nvarchar(500)"); if (strBC != st1) { SqlCommand cmdrX = new SqlCommand("Drop table " + tablename, conn); if (conn.State.ToString() != "Open") { conn.Open(); } cmdrX.ExecuteNonQuery(); //Create Table SqlCommand cmdr = new SqlCommand(st1, conn); cmdr.ExecuteNonQuery(); conn.Close(); } else { //SqlCommand cmdrX = new SqlCommand("Delete from " + tablename, conn); //if (conn.State.ToString() != "Open") //{ // conn.Open(); //} //cmdrX.ExecuteNonQuery(); } } } }
protected void SyncroniceData() { string portopenserID = ""; lblmsg.Text = ""; int totalrec = 0; string pcateid = ""; string seridstatus = ""; conn = new SqlConnection(); DataTable dtcln = new DataTable(); foreach (GridViewRow item in grdserver.Rows) { string syncreqid = grdserver.DataKeys[item.RowIndex].Value.ToString(); Label lbltabname = (Label)item.FindControl("lbltabname"); Label lblseid = (Label)item.FindControl("lblseid"); Label lblattempt = (Label)item.FindControl("lblattempt"); CheckBox cbItem = (CheckBox)item.FindControl("cbItem"); Label lbl_TableId = (Label)item.FindControl("lbl_TableId"); Label lbl_jobdetail = (Label)item.FindControl("lbl_jobdetail"); Label lbl_typeoperation = (Label)item.FindControl("lbl_typeoperation"); Label lbl_JobReordTableID = (Label)item.FindControl("lbl_JobReordTableID"); Label lbl_RecordID = (Label)item.FindControl("lbl_RecordID"); Label lblname = (Label)item.FindControl("lblname"); Boolean serconn = true; if (cbItem.Checked == true) { if (lblseid.Text != seridstatus) { if (portopenserID != lblseid.Text) { portopenserID = lblseid.Text; } try { conn = new SqlConnection(); conn = ServerWizard.ServerDefaultInstanceConnetionTCP_Serverid(lblseid.Text); if (conn.State.ToString() != "Open") { conn.Open(); } encstr = ServerWizard.ServerEncrDecriKEY(lblseid.Text); string tablename = lbltabname.Text; if (lbl_typeoperation.Text == "2" || lbl_typeoperation.Text == "3") { DeleteTableRecord(tablename, lbl_RecordID.Text); } if (lbl_typeoperation.Text == "1" || lbl_typeoperation.Text == "2") { DynamicalyTable(tablename, lbl_RecordID.Text); } totalrec++; Boolean Deletestatus = Delete_Only_ID_Satelite_Server_Sync_Log_Deatils(lbl_JobReordTableID.Text); Boolean statuss = Update_Satellite_Server_Sync_Job_Details(lbl_jobdetail.Text, true, true, DateTime.Now, true, DateTime.Now); try { DataTable Satallite_Server_Sync_RecordsMasterTblID = MyCommonfile.selectBZ(" Select Id as SatalliteServerSyncTblTecordStatusID From Satallite_Server_Sync_RecordsMasterTbl Where TableId='" + lbl_TableId.Text + "' and ServerID='" + lblseid.Text + "' "); if (lbl_typeoperation.Text == "1") { Insert___Satallite_Server_Sync_RecordsDetailTbl(Satallite_Server_Sync_RecordsMasterTblID.Rows[0]["Satallite_Server_Sync_RecordsMasterTblID"].ToString(), lbl_RecordID.Text, DateTime.Now, lbl_typeoperation.Text, lbl_typeoperation.Text); } if (lbl_typeoperation.Text == "3") { Delete___Satallite_Server_Sync_RecordsDetailTbl(Satallite_Server_Sync_RecordsMasterTblID.Rows[0]["Satallite_Server_Sync_RecordsMasterTblID"].ToString(), lbl_RecordID.Text); } } catch { } lblmsg.Text = " Successfully synchronization server record "; } catch { seridstatus = lblseid.Text; lblmsg.Text = " some problem when synchronization with server ";//e1.ToString()+"<br>"; } } } } }
protected void Dynamicaly_FullTable(string tanlename, string lbl_TableId) { encstr = ServerWizard.ServerEncrDecriKEY(ddlserver.SelectedValue); string PKname = ""; string Temp2 = " INSERT INTO " + tanlename + "( "; string Temp3val = ""; DataTable dts1 = MyCommonfile.selectBZ(" select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tanlename + "'"); for (int k = 0; k < dts1.Rows.Count; k++) { if (k == 0) { // PKname = dts1.Rows[k]["column_name"].ToString(); } Temp2 += ("" + dts1.Rows[k]["column_name"] + " ,"); } Temp2 = Temp2.Remove(Temp2.Length - 1); Temp2 += ") VAlues"; string InsertInto = Temp2; string AfterVAlues = ""; DataTable maxiddesid = MyCommonfile.selectBZ(" select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tanlename + "'"); string QueryName = ""; DataTable dtr; DataTable DtWhere = MyCommonfile.selectBZ(" Select * FROM SatelliteSyncronisationrequiringTablesMaster_SerWhere Where TableId='" + lbl_TableId + "'"); if (DtWhere.Rows.Count > 0) { //Select_Query string PKTableName = DtWhere.Rows[0]["PKTableName"].ToString(); string PKIdName = DtWhere.Rows[0]["PKIdName"].ToString(); string Select_Query = DtWhere.Rows[0]["Select_Query"].ToString(); string WhereForPKID = ""; // WhereForPKID = " Where " + PKTableName + "." + PKIdName + "=" + RecordID; string SelectWhere2 = " and PricePlanMaster.PricePlanId IN ( Select PricePlanId From CompanyMaster Where active=1 and ServerId=" + ddlserver.SelectedValue + ") "; Select_Query = Select_Query + WhereForPKID + SelectWhere2; dtr = MyCommonfile.selectBZ("" + Select_Query + " "); } else { dtr = MyCommonfile.selectBZ(" Select * From " + tanlename + " " + QueryName + ""); } try { //DataTable dtrcount = MyCommonfile.selectBZ(" Select Count(" + PKname + ") as PKname From " + tanlename + " " + QueryName + ""); //string ss = TableRelated.AAAAAAA_Record(tanlename, dtrcount.Rows[0]["PKname"].ToString(), ddlserver.SelectedValue); } catch { } int c = 0; int Cont = 0; string cccd = ""; string FilenamewithExt = ""; string filepath = Convert.ToString(Server.MapPath("")); foreach (DataRow itm in dtr.Rows) { FilenamewithExt = tanlename; c++; cccd = InsertInto + " ("; DataTable dtsccc = MyCommonfile.selectBZ("select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tanlename + "'"); for (int k = 0; k < dtsccc.Rows.Count; k++) { cccd += "'" + Encrypted(Convert.ToString(itm["" + dtsccc.Rows[k]["column_name"] + ""])) + "' ,"; } cccd = cccd.Remove(cccd.Length - 1); cccd += " )"; if (Temp3val.Length > 0) { // Temp3val += ","; } Temp3val += cccd; if (Temp3val.Length > 0 && c == 200) { Cont++; //if (conn.State.ToString() != "Open") //{ // conn.Open(); //} //SqlCommand ccm = new SqlCommand(Temp3val, conn); //ccm.ExecuteNonQuery(); //conn.Close(); //c = 0; //cccd = ""; string ss = SQLCommonfile.GenerateAndSaveFile(FilenamewithExt + Convert.ToString(Cont) + ".sql", Temp3val, filepath); cccd = ""; } } if (Temp3val.Length > 0) { Cont++; //if (conn.State.ToString() != "Open") //{ // conn.Open(); //} //SqlCommand ccm = new SqlCommand(Temp3val, conn); //ccm.ExecuteNonQuery(); //conn.Close(); string ss = SQLCommonfile.GenerateAndSaveFile(FilenamewithExt + Convert.ToString(Cont) + ".sql", Temp3val, filepath); } }
protected void SeprateDatabase() { Boolean connnection = false; string Delete_From = ""; string PKname = ""; conn = new SqlConnection(); try { conn = ServerWizard.ServerDefaultInstanceConnetionTCP_Serverid(ViewState["sid"].ToString()); if (conn.State.ToString() != "Open") { conn.Open(); } conn.Close(); connnection = true; } catch (Exception ex) { } if (connnection == true) { int totalrec = 0; string pcateid = ""; string seridstatus = ""; conn = new SqlConnection(); DataTable dtcln = new DataTable(); foreach (GridViewRow item in grdserver.Rows) { string syncreqid = grdserver.DataKeys[item.RowIndex].Value.ToString(); Label lbltabname = (Label)item.FindControl("lbltabname"); Label lblseid = (Label)item.FindControl("lblseid"); Label lblattempt = (Label)item.FindControl("lblattempt"); CheckBox cbItem = (CheckBox)item.FindControl("cbItem"); Label lbl_TableId = (Label)item.FindControl("lbl_TableId"); Label lbl_jobdetail = (Label)item.FindControl("lbl_jobdetail"); Label lbl_typeoperation = (Label)item.FindControl("lbl_typeoperation"); Label lbl_JobReordTableID = (Label)item.FindControl("lbl_JobReordTableID"); Label lbl_RecordID = (Label)item.FindControl("lbl_RecordID"); Label lblname = (Label)item.FindControl("lblname"); Boolean serconn = true; conn = ServerWizard.ServerDefaultInstanceConnetionTCP_Serverid(lblseid.Text); if (cbItem.Checked == true) { if (lblseid.Text != seridstatus) { try { encstr = ServerWizard.ServerEncrDecriKEY(lblseid.Text); string tablename = lbltabname.Text; if (lbl_typeoperation.Text == "2" || lbl_typeoperation.Text == "3") { // DeleteTableRecord(tablename, lbl_RecordID.Text); //((((((((((--Need To Delete Column)))))))))))))))))))) Delete_From = " Delete From " + tablename + " Where "; string Temp3val = ""; DataTable dts1 = MyCommonfile.selectBZ(" select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tablename + "'"); if (dts1.Rows.Count > 0) { PKname = TableRelated.SatelliteSyncronisationrequiringTablesMaster_WherePKIDName(lbl_TableId.Text); if (PKname.Length > 0) { Delete_From += "" + PKname + "=" + "'" + Encrypted(lbl_RecordID.Text) + "' "; } else { Delete_From += "" + dts1.Rows[0]["column_name"] + "=" + "'" + Encrypted(lbl_RecordID.Text) + "' "; } } try { SqlCommand ccm = new SqlCommand(Delete_From, conn); if (conn.State.ToString() != "Open") { conn.Open(); } ccm.ExecuteNonQuery(); conn.Close(); } catch { } //"""""""""""""--CLOSE Need To Delete Column""""""""""""""""" } if (lbl_typeoperation.Text == "1" || lbl_typeoperation.Text == "2") { //DynamicalyTable(tablename, lbl_RecordID.Text); //((((((((((--Need To Insert Column)))))))))))))))))))) string Insert_Into = " INSERT INTO " + tablename + "( "; string Temp3val = ""; DataTable dts1 = MyCommonfile.selectBZ(" select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tablename + "'"); for (int k = 0; k < dts1.Rows.Count; k++) { Insert_Into += ("" + dts1.Rows[k]["column_name"] + " ,"); } Insert_Into = Insert_Into.Remove(Insert_Into.Length - 1); Insert_Into += ") Values "; DataTable maxiddesid = MyCommonfile.selectBZ(" select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tablename + "'"); PKname = TableRelated.SatelliteSyncronisationrequiringTablesMaster_WherePKIDName(lbl_TableId.Text); if (PKname.Length > 0) { } else { PKname = dts1.Rows[0]["column_name"].ToString(); } DataTable dtr = MyCommonfile.selectBZ(" Select * From " + tablename + " where " + PKname + "=" + lbl_RecordID.Text + " "); foreach (DataRow itm in dtr.Rows) { int c = 0; Insert_Into += " ("; DataTable dtsccc = MyCommonfile.selectBZ("select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + tablename + "'"); for (int k = 0; k < dtsccc.Rows.Count; k++) { Insert_Into += "'" + Encrypted(Convert.ToString(itm["" + dtsccc.Rows[k]["column_name"] + ""])) + "' ,"; } Insert_Into = Insert_Into.Remove(Insert_Into.Length - 1); Insert_Into += " )"; } if (Insert_Into.Length > 0) { SqlCommand ccm = new SqlCommand(Insert_Into, conn); if (conn.State.ToString() != "Open") { conn.Open(); } ccm.ExecuteNonQuery(); conn.Close(); lblmsg.Text = ""; } //"""""""""""""--CLOSE Need To Insert Column""""""""""""""""" } totalrec++; // Boolean statuss = Update_Satellite_Server_Sync_Job_Details(lbl_jobdetail.Text, true, true, DateTime.Now, true, DateTime.Now); try { //DataTable Satallite_Server_Sync_RecordsMasterTblID = MyCommonfile.selectBZ(" Select Id as SatalliteServerSyncTblTecordStatusID From Satallite_Server_Sync_RecordsMasterTbl Where TableId='" + lbl_TableId.Text + "' and ServerID='" + lblseid.Text + "' "); //if (lbl_typeoperation.Text == "1") //{ // Insert___Satallite_Server_Sync_RecordsDetailTbl(Satallite_Server_Sync_RecordsMasterTblID.Rows[0]["Satallite_Server_Sync_RecordsMasterTblID"].ToString(), lbl_RecordID.Text, DateTime.Now, lbl_typeoperation.Text, lbl_typeoperation.Text); //} //if (lbl_typeoperation.Text == "3") //{ // Delete___Satallite_Server_Sync_RecordsDetailTbl(Satallite_Server_Sync_RecordsMasterTblID.Rows[0]["Satallite_Server_Sync_RecordsMasterTblID"].ToString(), lbl_RecordID.Text); //} } catch { } // lblmsg.Text = " Successfully synchronization ";//" + totalrec + " records for " + lblname.Text + " server record " + lbl_RecordID.Text + "<br><br>"; } catch { seridstatus = lblseid.Text; lblmsg.Text = " Some problem when synchronization with " + lblname.Text + " server <br><br>";//e1.ToString()+"<br>"; } Boolean Deletestatus = Delete_Only_ID_Satelite_Server_Sync_Log_Deatils(lbl_JobReordTableID.Text); } } else { } } } else { lblmsg.Text = " No connection possible with server <br> you are tying to connect database with this connection string ( " + conn.ConnectionString + " )"; //e1.ToString()+"<br>"; } }
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 "; } } } }
protected void btnSubmit_Click(object sender, EventArgs e) { //if (con.State.ToString() != "Open") //{ // con.Open(); //} //SqlCommand cmddel = new SqlCommand("MasterSaelliteServerSyncRequiringTablesTbl_AddDelUpdtSelect", con); //cmddel.CommandType = CommandType.StoredProcedure; //cmddel.Parameters.AddWithValue("@StatementType", "Delete"); //cmddel.ExecuteNonQuery(); if (btn_submit.Text == "Update") { foreach (GridViewRow item in GV_ServerTable.Rows) { Label lbl_TableID = (Label)(item.FindControl("lbl_TableID")); Label lbl_LBDAtabaseName = (Label)(item.FindControl("lbl_LBDAtabaseName")); Label lnl_LBInstance = (Label)(item.FindControl("lnl_LBInstance")); Label lbl_serverid = (Label)(item.FindControl("lbl_serverid")); CheckBox cbItem = (CheckBox)(item.FindControl("cbItem")); DropDownList DDLLiceTableName = (DropDownList)(item.FindControl("DDLLiceTableName")); string TbleName = DDLLiceTableName.SelectedItem.Text; Boolean servConn = true; conn = ServerWizard.ServerDatabaseFromInstanceTCP(lbl_serverid.Text, lnl_LBInstance.Text, lbl_LBDAtabaseName.Text); try { if (conn.State.ToString() != "Open") { conn.Open(); } } catch { servConn = false; } if (DDLLiceTableName.SelectedIndex > 0 && servConn == true) { string filepath = Server.MapPath(""); DataTable GetColum1 = MyCommonfile.selectBZ("select column_name,data_type,CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name='" + DDLLiceTableName.SelectedItem.Text + "'"); string script1 = ""; string script2 = ""; string script3 = ""; Delete_TRIGGER(filepath, TbleName, GetColum1.Rows[0][0].ToString(), DDLLiceTableName.SelectedValue); Insert_TRIGGER(filepath, TbleName, GetColum1.Rows[0][0].ToString(), DDLLiceTableName.SelectedValue); Update_TRIGGER(filepath, TbleName, GetColum1.Rows[0][0].ToString(), DDLLiceTableName.SelectedValue); script1 = File.ReadAllText(filepath + "\\sqlfile1.sql"); script2 = File.ReadAllText(filepath + "\\sqlfile2.sql"); script3 = File.ReadAllText(filepath + "\\sqlfile3.sql"); try { if (conn.State.ToString() != "Open") { conn.Open(); } try { SqlCommand commandD1 = new SqlCommand("DROP TRIGGER [dbo].[" + TbleName + "_DELETE]", conn); commandD1.ExecuteNonQuery(); } catch { } SqlCommand command1 = new SqlCommand(script1, conn); command1.ExecuteNonQuery(); if (conn.State.ToString() != "Open") { conn.Open(); } try { SqlCommand commandD1 = new SqlCommand("DROP TRIGGER [dbo].[" + TbleName + "_INSERT]", conn); commandD1.ExecuteNonQuery(); } catch { } SqlCommand command2 = new SqlCommand(script2, conn); command2.ExecuteNonQuery(); if (conn.State.ToString() != "Open") { conn.Open(); } try { SqlCommand commandD1 = new SqlCommand("DROP TRIGGER [dbo].[" + TbleName + "_UPDATE]", conn); commandD1.ExecuteNonQuery(); } catch { } SqlCommand command3 = new SqlCommand(script3, conn); command3.ExecuteNonQuery(); } catch (Exception ex) { servConn = false; lblmsg.Text = ex.ToString(); } if (servConn == true) { SqlCommand cmd2 = new SqlCommand("SatelliteSyncronisationrequiringTablesMaster_AddDelUpdtSelect", con); cmd2.CommandType = CommandType.StoredProcedure; cmd2.Parameters.AddWithValue("@StatementType", "DeleteSTBLID"); cmd2.Parameters.AddWithValue("@ServerTableID", lbl_TableID.Text); if (con.State.ToString() != "Open") { con.Open(); } cmd2.ExecuteNonQuery(); SqlCommand cmd = new SqlCommand("SatelliteSyncronisationrequiringTablesMaster_AddDelUpdtSelect", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@StatementType", "Insert"); cmd.Parameters.AddWithValue("@ProductVersionID", LBproductversion); cmd.Parameters.AddWithValue("@TableId", DDLLiceTableName.SelectedValue); cmd.Parameters.AddWithValue("@Name", DDLLiceTableName.SelectedItem.Text); cmd.Parameters.AddWithValue("@Status", cbItem.Checked); cmd.Parameters.AddWithValue("@TableName", DDLLiceTableName.SelectedItem.Text); cmd.Parameters.AddWithValue("@ServerTableID", lbl_TableID.Text); cmd.Parameters.AddWithValue("@ServerDatabaseID", ddlcodetype.SelectedValue); cmd.Parameters.AddWithValue("@ServerProductVersionID", ddlProductname.SelectedValue); cmd.Parameters.AddWithValue("@ServerTableName", ddlProductname.SelectedValue); if (con.State.ToString() != "Open") { con.Open(); } cmd.ExecuteNonQuery(); con.Close(); } } else { SqlCommand cmd = new SqlCommand("SatelliteSyncronisationrequiringTablesMaster_AddDelUpdtSelect", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@StatementType", "DeleteSTBLID"); cmd.Parameters.AddWithValue("@ServerTableID", lbl_TableID.Text); if (con.State.ToString() != "Open") { con.Open(); } cmd.ExecuteNonQuery(); con.Close(); if (servConn == true) { try { SqlCommand commandD1 = new SqlCommand("DROP TRIGGER [dbo].[" + TbleName + "_DELETE]", conn); commandD1.ExecuteNonQuery(); } catch { } try { SqlCommand commandD1 = new SqlCommand("DROP TRIGGER [dbo].[" + TbleName + "_INSERT]", conn); commandD1.ExecuteNonQuery(); } catch { } try { SqlCommand commandD1 = new SqlCommand("DROP TRIGGER [dbo].[" + TbleName + "_UPDATE]", conn); commandD1.ExecuteNonQuery(); } catch { } } // DROP TRIGGER [dbo].[Customers_DELETE1] } } lblmsg.Text = "Record Update Successfully"; Cleare(); FillDefault(); btn_submit.Text = "Edit"; pnlpr.Enabled = false; } else { btn_submit.Text = "Update"; pnlpr.Enabled = true; } }
protected void Page_Load(object sender, EventArgs e) { string ss = BZ_Common.BZ_Decrypted("d2fu/WL5XmM="); string ssdd = BZ_Common.BZ_Decrypted("member"); string ssddfdf = BZ_Common.BZ_Encrypted("member"); //ABC Key Insert At Server DB if (Request.QueryString["comid"] != null && Request.QueryString["ABCenckey"] != null && Request.QueryString["returl"] != null) { //string hh = BZ_Common.BZ_Decrypted(Request.QueryString["comid"].ToString().Replace(" ", "+")); string companyid = BZ_Common.BZ_Decrypted(Request.QueryString["comid"].ToString().Replace(" ", "+")); DataTable DtServid = MyCommonfile.selectBZ(" Select ServerMasterTbl.Busiwizsatellitesiteurl,CompanyMaster.CompanyLoginId,ServerMasterTbl.Id FROM dbo.ServerMasterTbl INNER JOIN dbo.CompanyMaster ON dbo.ServerMasterTbl.Id = dbo.CompanyMaster.ServerId Where CompanyMaster.CompanyLoginId='" + companyid + "' "); if (DtServid.Rows.Count > 0) { string Busiwizsatellitesiteurl = DtServid.Rows[0]["Busiwizsatellitesiteurl"].ToString(); string ServerId = DtServid.Rows[0]["Id"].ToString(); Boolean Comp__Actve__Status = CompanyWizard.Company_Active_Status(companyid); Boolean Comp__Licen__Active = CompanyWizard.Company_LicenseExpire_Status(companyid); Boolean Server__Active = ServerWizard.Server_Active_Status(companyid); if (Comp__Actve__Status == true && Comp__Licen__Active == true && Server__Active == true) { Boolean Insert_Today_Key = CompKeyIns.BtnABCKey(companyid, ServerId); if (Insert_Today_Key == true) { string Z = ""; string D1 = ""; string D2 = ""; string D3 = ""; string D4 = ""; string D5 = ""; string E1 = ""; string E2 = ""; string E3 = ""; string E4 = ""; string E5 = ""; string F1 = ""; string F2 = ""; string F3 = ""; string F4 = ""; string F5 = ""; DataTable Dt = MyCommonfile.selectBZ(" Select TOP(15)* From CompanyABCDetail Where CompanyLoginId='" + companyid + "' Order By Id Desc "); foreach (DataRow drmaxdb in Dt.Rows) { Z += drmaxdb["Z"].ToString() + ","; D1 += drmaxdb["D1"].ToString() + ","; D2 += drmaxdb["D2"].ToString() + ","; D3 += drmaxdb["D3"].ToString() + ","; D4 += drmaxdb["D4"].ToString() + ","; D5 += drmaxdb["D5"].ToString() + ","; E1 += drmaxdb["E1"].ToString() + ","; E2 += drmaxdb["E2"].ToString() + ","; E3 += drmaxdb["E3"].ToString() + ","; E4 += drmaxdb["E4"].ToString() + ","; E5 += drmaxdb["E5"].ToString() + ","; F1 += drmaxdb["F1"].ToString() + ","; F2 += drmaxdb["F2"].ToString() + ","; F3 += drmaxdb["F3"].ToString() + ","; F4 += drmaxdb["F4"].ToString() + ","; F5 += drmaxdb["F5"].ToString() + ","; } if (Dt.Rows.Count > 0) { Z = Z.Remove(Z.Length - 1); D1 = D1.Remove(D1.Length - 1); D2 = D2.Remove(D2.Length - 1); D3 = D3.Remove(D3.Length - 1); D4 = D4.Remove(D4.Length - 1); D5 = D5.Remove(D5.Length - 1); E1 = E1.Remove(E1.Length - 1); E2 = E2.Remove(E2.Length - 1); E3 = E3.Remove(E3.Length - 1); E4 = E4.Remove(E4.Length - 1); E5 = E5.Remove(E5.Length - 1); F1 = F1.Remove(F1.Length - 1); F2 = F2.Remove(F2.Length - 1); F3 = F3.Remove(F3.Length - 1); F4 = F4.Remove(F4.Length - 1); F5 = F5.Remove(F5.Length - 1); //Response.Redirect("http://" + Busiwizsatellitesiteurl + "/Satelliteservfunction.aspx?Compid=" + BZ_Common.BZ_Encrypted(companyid) + "&E1=" + BZ_Common.BZ_Encrypted(E1) + "&E2=" + BZ_Common.BZ_Encrypted(E2) + "&E3=" + BZ_Common.BZ_Encrypted(E3) + "&E4=" + BZ_Common.BZ_Encrypted(E4) + "&E5=" + BZ_Common.BZ_Encrypted(E5) + "&D1=" + BZ_Common.BZ_Encrypted(D1) + "&D2=" + BZ_Common.BZ_Encrypted(D2) + "&D3=" + BZ_Common.BZ_Encrypted(D3) + "&D4=" + BZ_Common.BZ_Encrypted(D4) + "&D5=" + BZ_Common.BZ_Encrypted(D5) + "&Z=" + BZ_Common.BZ_Encrypted(Z) + "&F1=" + BZ_Common.BZ_Encrypted(F1) + "&F2=" + BZ_Common.BZ_Encrypted(F2) + "&F3=" + BZ_Common.BZ_Encrypted(F3) + "&F4=" + BZ_Common.BZ_Encrypted(F4) + "&F5=" + BZ_Common.BZ_Encrypted(F5) + ""); Response.Redirect("http://" + Busiwizsatellitesiteurl + "/Satelliteservfunction.aspx?Compid=" + BZ_Common.BZ_Encrypted(companyid) + "&E1=" + E1 + "&E2=" + E2 + "&E3=" + E3 + "&E4=" + E4 + "&E5=" + E5 + "&D1=" + D1 + "&D2=" + D2 + "&D3=" + D3 + "&D4=" + D4 + "&D5=" + D5 + "&Z=" + Z + "&F1=" + F1 + "&F2=" + F2 + "&F3=" + F3 + "&F4=" + F4 + "&F5=" + F5 + "&returl=" + Request.QueryString["returl"] + ""); } lbl_msg.Text = "Successfully "; } else { lbl_msg.Text = "Some problem when we try to adding records in database "; } } else if (Comp__Actve__Status == false) { lbl_msg.Text = "Company not active "; } else if (Comp__Licen__Active == false) { lbl_msg.Text = "License Expired"; } else if (Server__Active == false) { lbl_msg.Text = "Server Inactive"; } } } }