public bool UpdateLogo(Company cobj) { bool update = false; DataTable dt; string sqlQuery; try { //5/23/2013 NS modified sqlQuery = "SELECT * FROM Company"; dt = objAdaptor.FetchData(sqlQuery); if (dt.Rows.Count > 0) { sqlQuery = "UPDATE Company SET LogoPath = @LogoPath,CompanyName = @CompanyName"; SqlCommand cmd = new SqlCommand(sqlQuery); cmd.Parameters.AddWithValue("@LogoPath", (object)cobj.LogoPath ?? DBNull.Value); cmd.Parameters.AddWithValue("@CompanyName", (object)cobj.CompanyName ?? DBNull.Value); update = objAdaptor.ExecuteNonQuerywithcmd(cmd); } else { sqlQuery = "INSERT INTO Company VALUES (@CompanyName,@LogoPath)"; SqlCommand cmd = new SqlCommand(sqlQuery); cmd.Parameters.AddWithValue("@LogoPath", (object)cobj.LogoPath ?? DBNull.Value); cmd.Parameters.AddWithValue("@CompanyName", (object)cobj.CompanyName ?? DBNull.Value); update = objAdaptor.ExecuteNonQuerywithcmd(cmd); } //update= objAdaptor.ExecuteNonQuery(sqlQuery); } catch (Exception ex) { throw ex; } return(update); }
public Object dagdetailsdata2(DagSettings ServerObject) { Object Update; try { DataTable dt = GetAttributes(ServerObject.ServerID); if (dt.Rows.Count > 0) { string SqlQuery = "UPDATE DagSettings SET ServerID = @ServerID,PrimaryConnection = @PrimaryConnection,BackupConnection = @BackupConnection where ServerID = @ServerID"; SqlCommand cmd = new SqlCommand(SqlQuery); cmd.Parameters.AddWithValue("@ServerID", (object)ServerObject.ServerID ?? DBNull.Value); cmd.Parameters.AddWithValue("@PrimaryConnection", (object)ServerObject.PrimaryConnection ?? DBNull.Value); cmd.Parameters.AddWithValue("@BackupConnection", (object)ServerObject.BackupConnection ?? DBNull.Value); Update = objAdaptor.ExecuteNonQuerywithcmd(cmd); //Update = objAdaptor.ExecuteNonQuery(SqlQuery); } else { Update = InsertAttributesData(ServerObject); } } catch { Update = false; } finally { } return(Update); }
public Object insertBlackBerryService(BlackBerryServers BlackBerryServerObject) { Object insertBlackBerryServer; try { //string str = "insert into BlackBerryServers(Address,Name,Description,Category,ScanInterval,OffHoursScanInterval,Enabled,RetryInterval,Alert,Policy,Synchronization,Controller,Messaging,MDSServices,MDSConnection,OtherServices,BESVersion,Attachment,Router,AlertIP,RouterIP,AttachmentIP,PendingThreshold,TimeZoneAdjustment,USDateFormat,NotificationGroup) values('" + BlackBerryServerObject.Address + "','" + BlackBerryServerObject.Name + "','" + BlackBerryServerObject.Description + // "','" + BlackBerryServerObject.Category + "'," + BlackBerryServerObject.ScanInterval + "," + BlackBerryServerObject.OffHoursScanInterval + ",'" + BlackBerryServerObject.Enabled + "'," + BlackBerryServerObject.RetryInterval + ",'" + BlackBerryServerObject.Alert + "','"+BlackBerryServerObject.Policy+"','"+BlackBerryServerObject.Synchronization+"','"+BlackBerryServerObject.Controller+"','"+BlackBerryServerObject.Messaging+"','"+BlackBerryServerObject.MDSServices+"','"+BlackBerryServerObject.MDSConnection+"','"+BlackBerryServerObject.OtherServices+"','"+BlackBerryServerObject.BESVersion+"','"+BlackBerryServerObject.Attachment+"','"+BlackBerryServerObject.Router+"','"+BlackBerryServerObject.AlertIP+"','"+BlackBerryServerObject.RouterIP+"','"+BlackBerryServerObject.AttachmentIP+"',"+BlackBerryServerObject.PendingThreshold+","+BlackBerryServerObject.TimeZoneAdjustment+",'"+BlackBerryServerObject.USDateFormat+"','"+BlackBerryServerObject.NotificationGroup+"')"; string str = "insert into BlackBerryServers(ServerID,Category,ScanInterval,OffHoursScanInterval,Enabled,RetryInterval,Alert,Policy,Synchronization,Controller,Messaging,MDSServices,MDSConnection,OtherServices,BESVersion,Attachment,Router,AlertIP,RouterIP,AttachmentIP,PendingThreshold,TimeZoneAdjustment,USDateFormat,NotificationGroup,SNMPCommunity,HAOption,HAPartner) values(@ServerID , @Category ,@ScanInterval ,@OffHoursScanInterval,@Enabled ,@RetryInterval ,@Alert ,@Policy ,@Synchronization ,@Controller,@Messaging,@MDSServices ,@MDSConnection ,@OtherServices ,@BESVersion ,@Attachment ,@Router ,@AlertIP ,@RouterIP ,@AttachmentIP ,@PendingThreshold ,@TimeZoneAdjustment ,@USDateFormat ,@NotificationGroup ,@SNMPCommunity ,@HAOption,@HAPartner)"; SqlCommand cmd = new SqlCommand(str); cmd.Parameters.AddWithValue("@ServerID", BlackBerryServerObject.ServerID); cmd.Parameters.AddWithValue("@Category", BlackBerryServerObject.Category); cmd.Parameters.AddWithValue("@ScanInterval", BlackBerryServerObject.ScanInterval); cmd.Parameters.AddWithValue("@OffHoursScanInterval", BlackBerryServerObject.OffHoursScanInterval); cmd.Parameters.AddWithValue("@Enabled", BlackBerryServerObject.Enabled); cmd.Parameters.AddWithValue("@RetryInterval", BlackBerryServerObject.RetryInterval); cmd.Parameters.AddWithValue("@Alert", BlackBerryServerObject.Alert); cmd.Parameters.AddWithValue("@Policy", BlackBerryServerObject.Policy); cmd.Parameters.AddWithValue("@Synchronization", BlackBerryServerObject.Synchronization); cmd.Parameters.AddWithValue("@Controller", BlackBerryServerObject.Controller); cmd.Parameters.AddWithValue("@Messaging", BlackBerryServerObject.Messaging); cmd.Parameters.AddWithValue("@MDSServices", BlackBerryServerObject.MDSServices); cmd.Parameters.AddWithValue("@MDSConnection", BlackBerryServerObject.MDSConnection); cmd.Parameters.AddWithValue("@OtherServices", BlackBerryServerObject.OtherServices); cmd.Parameters.AddWithValue("@BESVersion", BlackBerryServerObject.BESVersion); cmd.Parameters.AddWithValue("@Attachment", BlackBerryServerObject.Attachment); cmd.Parameters.AddWithValue("@Router", BlackBerryServerObject.Router); cmd.Parameters.AddWithValue("@AlertIP", BlackBerryServerObject.AlertIP); cmd.Parameters.AddWithValue("@RouterIP", BlackBerryServerObject.RouterIP); cmd.Parameters.AddWithValue("@AttachmentIP", BlackBerryServerObject.AttachmentIP); cmd.Parameters.AddWithValue("@PendingThreshold", BlackBerryServerObject.PendingThreshold); cmd.Parameters.AddWithValue("@TimeZoneAdjustment", BlackBerryServerObject.TimeZoneAdjustment); cmd.Parameters.AddWithValue("@USDateFormat", BlackBerryServerObject.USDateFormat); cmd.Parameters.AddWithValue("@NotificationGroup", BlackBerryServerObject.NotificationGroup); cmd.Parameters.AddWithValue("@SNMPCommunity", BlackBerryServerObject.SNMPCommunity); cmd.Parameters.AddWithValue("@HAOption", BlackBerryServerObject.HAOption); cmd.Parameters.AddWithValue("@HAPartner", BlackBerryServerObject.HAPartner); insertBlackBerryServer = objAdaptor.ExecuteNonQuerywithcmd(cmd); //insertBlackBerryServer = objAdaptor.ExecuteNonQuery(str); //insertBlackBerryServer = objAdaptor.ExecuteNonQuery(str); } catch (Exception e) { throw e; } return(insertBlackBerryServer); }
public bool UpdateData(Credentials LOCbject) { string SqlQuery = ""; bool Update; try { //7/10/2015 NS modified for VSPLUS-1985 //if (LOCbject.Password == " ") if (LOCbject.Password == "test") { SqlQuery = "UPDATE Credentials SET AliasName = @AliasName,UserID = @UserID, ServerTypeID= @ServerTypeID WHERE ID = @ID"; SqlCommand cmd = new SqlCommand(SqlQuery); cmd.Parameters.AddWithValue("@AliasName", (object)LOCbject.AliasName ?? DBNull.Value); cmd.Parameters.AddWithValue("@UserID", (object)LOCbject.UserID ?? DBNull.Value); cmd.Parameters.AddWithValue("@ServerTypeID", (object)LOCbject.ServerTypeID ?? DBNull.Value); cmd.Parameters.AddWithValue("@ID", (object)LOCbject.ID ?? DBNull.Value); Update = objAdaptor.ExecuteNonQuerywithcmd(cmd); } else { SqlQuery = "UPDATE Credentials SET AliasName= @AliasName,UserID= @UserID, Password= @Password, ServerTypeID= @ServerTypeID WHERE ID = @ID"; SqlCommand cmd = new SqlCommand(SqlQuery); cmd.Parameters.AddWithValue("@AliasName", (object)LOCbject.AliasName ?? DBNull.Value); cmd.Parameters.AddWithValue("@UserID", (object)LOCbject.UserID ?? DBNull.Value); cmd.Parameters.AddWithValue("@Password", (object)LOCbject.Password ?? DBNull.Value); cmd.Parameters.AddWithValue("@ServerTypeID", (object)LOCbject.ServerTypeID ?? DBNull.Value); cmd.Parameters.AddWithValue("@ID", (object)LOCbject.ID ?? DBNull.Value); Update = objAdaptor.ExecuteNonQuerywithcmd(cmd); } //Update = objAdaptor.ExecuteNonQuery(SqlQuery); } catch { Update = false; } finally { } return(Update); }
/// <summary> /// Insert data into URLs table /// </summary> /// <param name="DSObject">URLs object</param> /// <returns></returns> public bool InsertData(CloudApplicationsServer CloudApplicationsServerObject) { bool Insert = false; try { string SqlQuery = "INSERT INTO CloudDetails (URL,Name,Category,ScanInterval,OffHoursScanInterval,Enabled" + ",ResponseThreshold,RetryInterval,SearchString,AlertStringFound,UserName,PW,Location,ServerTypeId,FailureThreshold,Imageurl)" + "VALUES(@URL,@Name,@Category,@ScanInterval" + ",@OffHoursScanInterval,@Enabled,@ResponseThreshold,@RetryInterval" + ",@SearchString,@AlertStringFound,@UserName,@PW" + ", @Location,@ServerTypeId,@FailureThreshold,@Imageurl)"; SqlCommand cmd = new SqlCommand(SqlQuery); cmd.Parameters.AddWithValue("@URL", (object)CloudApplicationsServerObject.URL ?? DBNull.Value); cmd.Parameters.AddWithValue("@Name", (object)CloudApplicationsServerObject.Name ?? DBNull.Value); cmd.Parameters.AddWithValue("@Category", (object)CloudApplicationsServerObject.Category ?? DBNull.Value); cmd.Parameters.AddWithValue("@ScanInterval", (object)CloudApplicationsServerObject.ScanInterval ?? DBNull.Value); cmd.Parameters.AddWithValue("@OffHoursScanInterval", (object)CloudApplicationsServerObject.OffHoursScanInterval ?? DBNull.Value); cmd.Parameters.AddWithValue("@Enabled", (object)CloudApplicationsServerObject.Enabled ?? DBNull.Value); cmd.Parameters.AddWithValue("@ResponseThreshold", (object)CloudApplicationsServerObject.ResponseThreshold ?? DBNull.Value); cmd.Parameters.AddWithValue("@RetryInterval", (object)CloudApplicationsServerObject.RetryInterval ?? DBNull.Value); cmd.Parameters.AddWithValue("@SearchString", (object)CloudApplicationsServerObject.SearchStringNotFound ?? DBNull.Value); cmd.Parameters.AddWithValue("@AlertStringFound", (object)CloudApplicationsServerObject.SearchStringFound ?? DBNull.Value); cmd.Parameters.AddWithValue("@UserName", (object)CloudApplicationsServerObject.UserName ?? DBNull.Value); cmd.Parameters.AddWithValue("@PW", (object)CloudApplicationsServerObject.PW ?? DBNull.Value); cmd.Parameters.AddWithValue("@Location", (object)CloudApplicationsServerObject.LocationId ?? DBNull.Value); cmd.Parameters.AddWithValue("@ServerTypeId", (object)CloudApplicationsServerObject.ServerTypeId ?? DBNull.Value); cmd.Parameters.AddWithValue("@FailureThreshold", (object)CloudApplicationsServerObject.FailureThreshold ?? DBNull.Value); cmd.Parameters.AddWithValue("@Imageurl", (object)CloudApplicationsServerObject.imageurl ?? DBNull.Value); Insert = objAdaptor.ExecuteNonQuerywithcmd(cmd); } catch { Insert = false; } finally { } return(Insert); }
public Object InsertExchangeSettings(ExchangeSettings objExchange) { //4/25/2016 Sowjanya modified for VSPLUS-2850 Object returnval; try { string st = "Insert into ExchangeSettings(ServerID, " + "CASSmtp , CASPop3 , CASImap , CASOARPC , CASOWA, CASActiveSync ," + "CASEWS , CASAutoDiscovery , " + "SubQThreshold , PoisonQThreshold , UnReachableQThreshold , TotalQThreshold , " + "VersionNo,ActiveSyncCredentialsId, ShadowQThreshold, AuthenticationType) values" + //"ActiveSyncCredentialsId) values" + "(@ServerID, @CASSmtp ,@CASPop3,@CASImap,@CASOARPC,@CASOWA,@CASActiveSync,@CASEWS,@CASAutoDiscovery,@SubQThreshold ,@PoisonQThreshold ,@UnReachableQThreshold ,@TotalQThreshold ,@VersionNo,@ACCredentialsId , @ShadowQThreshold ,@AuthenticationType )"; //objExchange.ACCredentialsId.ToString() + ")"; SqlCommand cmd = new SqlCommand(st); cmd.Parameters.AddWithValue("@ServerID", objExchange.ServerID); cmd.Parameters.AddWithValue("@CASSmtp", objExchange.CASSmtp); cmd.Parameters.AddWithValue("@CASPop3", objExchange.CASPop3); cmd.Parameters.AddWithValue("@CASImap", objExchange.CASImap); cmd.Parameters.AddWithValue("@CASOARPC", objExchange.CASOARPC); cmd.Parameters.AddWithValue("@CASOWA", objExchange.CASOWA); cmd.Parameters.AddWithValue("@CASActiveSync", objExchange.CASActiveSync); cmd.Parameters.AddWithValue("@CASEWS", objExchange.CASEWS); //cmd.Parameters.AddWithValue("@CASECP", objExchange.CASECP); cmd.Parameters.AddWithValue("@CASAutoDiscovery", objExchange.CASAutoDiscovery); //cmd.Parameters.AddWithValue("@CASOAB", objExchange.CASOAB); cmd.Parameters.AddWithValue("@SubQThreshold", objExchange.SubQThreshold); cmd.Parameters.AddWithValue("@PoisonQThreshold", objExchange.PoisonQThreshold); cmd.Parameters.AddWithValue("@UnReachableQThreshold", objExchange.UnReachableQThreshold); cmd.Parameters.AddWithValue("@TotalQThreshold", objExchange.TotalQThreshold); cmd.Parameters.AddWithValue("@VersionNo", 0); cmd.Parameters.AddWithValue("@ACCredentialsId", objExchange.ACCredentialsId.ToString()); cmd.Parameters.AddWithValue("@ShadowQThreshold", objExchange.ShadowQThreshold); cmd.Parameters.AddWithValue("@AuthenticationType", objExchange.AuthenticationType); returnval = objAdaptor.ExecuteNonQuerywithcmd(cmd); } catch (Exception e) { throw e; } return(returnval); }