private static void UpdateShareHolder(SqlConnection Connection, SqlTransaction Transaction, Guid?AccountID, Guid?ShareHolderID, string ShareHolderName, double?Percentage, int BumiShare, Guid?CountryRegionID) { using (SqlCommand com = new SqlCommand("", Connection)) { System.Text.StringBuilder sql = new System.Text.StringBuilder(); sql.AppendLine("UPDATE ShareHolder SET"); sql.AppendLine("ShareHolderName = @ShareHolderName,"); sql.AppendLine("Percentage = @Percentage,"); sql.AppendLine("BumiShare = @BumiShare,"); sql.AppendLine("Status = 1,"); sql.AppendLine("CountryRegionID = @CountryRegionID,"); sql.AppendLine("ModifiedBy = @ModifiedBy,"); sql.AppendLine("ModifiedByName = @ModifiedByName,"); sql.AppendLine("ModifiedDate = GETDATE()"); sql.AppendLine("WHERE ShareHolderID = @ShareHolderID"); com.CommandText = sql.ToString(); com.CommandType = CommandType.Text; com.Connection = Connection; com.Transaction = Transaction; com.CommandTimeout = int.MaxValue; com.Parameters.Add(new SqlParameter("@ShareHolderID", ShareHolderID)); com.Parameters.Add(new SqlParameter("@ShareHolderName", ShareHolderName)); com.Parameters.Add(new SqlParameter("@Percentage", Percentage)); com.Parameters.Add(new SqlParameter("@BumiShare", BumiShare)); com.Parameters.Add(new SqlParameter("@CountryRegionID", CountryRegionID)); com.Parameters.Add(new SqlParameter("@ModifiedBy", SyncHelper.AdminID)); com.Parameters.Add(new SqlParameter("@ModifiedByName", SyncHelper.AdminName)); try { //con.Open( com.ExecuteNonQuery(); //Company Change Log - MSC History BOL.AuditLog.Modules.AccountLog alMgr = new BOL.AuditLog.Modules.AccountLog(); DataRow newLogData = alMgr.SelectAccountForLog_MSCStatus_Wizard(Connection, Transaction, ShareHolderID.Value); alMgr.CreateAccountLog_Shareholder_Wizard(Connection, Transaction, ShareHolderID.Value, AccountID.Value, null, newLogData, new Guid(SyncHelper.AdminID), SyncHelper.AdminName); } catch (Exception ex) { throw; } } }
public void UpdateMSCStatusHistory(SqlConnection Connection, SqlTransaction Transaction, Guid?AccountID, Guid?MSCStatusHistoryID, DateTime?MSCApprovalDate) { SqlCommand com = new SqlCommand(); System.Text.StringBuilder sql = new System.Text.StringBuilder(); sql.AppendLine("UPDATE MSCStatusHistory SET"); sql.AppendLine("MSCApprovalDate = @MSCApprovalDate,"); sql.AppendLine("DataSource = @DataSource,"); sql.AppendLine("ModifiedBy = @ModifiedBy,"); sql.AppendLine("ModifiedByName = @ModifiedByName,"); sql.AppendLine("ModifiedDate = GETDATE()"); sql.AppendLine("WHERE MSCStatusHistoryID = @MSCStatusHistoryID"); com.CommandText = sql.ToString(); com.CommandType = CommandType.Text; com.Connection = Connection; com.Transaction = Transaction; com.CommandTimeout = int.MaxValue; com.Parameters.Add(new SqlParameter("@MSCStatusHistoryID", MSCStatusHistoryID)); com.Parameters.Add(new SqlParameter("@MSCApprovalDate", MSCApprovalDate)); com.Parameters.Add(new SqlParameter("@DataSource", SyncHelper.DataSource)); com.Parameters.Add(new SqlParameter("@ModifiedBy", SyncHelper.AdminID)); com.Parameters.Add(new SqlParameter("@ModifiedByName", SyncHelper.AdminName)); try { com.ExecuteNonQuery(); //Company Change Log - MSC History BOL.AuditLog.Modules.AccountLog alMgr = new BOL.AuditLog.Modules.AccountLog(); DataRow newLogData = alMgr.SelectAccountForLog_MSCStatus_Wizard(Connection, Transaction, MSCStatusHistoryID.Value); alMgr.CreateAccountLog_MSCStatusHistory_Wizard(Connection, Transaction, MSCStatusHistoryID.Value, AccountID.Value, null, newLogData, new Guid(SyncHelper.AdminID), SyncHelper.AdminName); } catch (Exception ex) { throw; //Finally // con.Close() } }
private static void DeleteShareholder(SqlConnection Connection, SqlTransaction Transaction, Guid?AccountID, string ShareHolderName) { SqlCommand com = new SqlCommand(); System.Text.StringBuilder sql = new System.Text.StringBuilder(); BOL.AuditLog.Modules.AccountLog alMgr = new BOL.AuditLog.Modules.AccountLog(); Guid ShareHolderID = Guid.NewGuid(); DataRow currentLogData = alMgr.SelectAccountForLog_Shareholder_Wizard(Connection, Transaction, ShareHolderID); sql.AppendLine("DELETE FROM ShareHolder "); sql.AppendLine("WHERE AccountID = @AccountID "); sql.AppendLine(" AND ShareholderName = @ShareholderName "); com.Parameters.Add(new SqlParameter("@AccountID", AccountID)); com.Parameters.Add(new SqlParameter("@ShareholderName", ShareHolderName)); com.CommandText = sql.ToString(); com.CommandType = CommandType.Text; com.Connection = Connection; com.Transaction = Transaction; com.CommandTimeout = int.MaxValue; try { //con.Open() com.ExecuteNonQuery(); //Company Change Log - Shareholder DataRow newLogData = alMgr.SelectAccountForLog_Shareholder_Wizard(Connection, Transaction, ShareHolderID); if (currentLogData != null && newLogData != null) { alMgr.CreateAccountLog_Shareholder_Wizard(Connection, Transaction, ShareHolderID, AccountID.Value, currentLogData, newLogData, new Guid(SyncHelper.AdminID), SyncHelper.AdminName); } } catch (Exception ex) { throw; //Finally // con.Close() } }
internal void UpdateRelocationDeadline(SqlConnection Connection, SqlTransaction Transaction, Guid?AccountID, Guid?RelocationID, Nullable <DateTime> RelocationDeadline) { SqlCommand com = new SqlCommand(); System.Text.StringBuilder sql = new System.Text.StringBuilder(); sql.AppendLine("UPDATE relocation"); sql.AppendLine("SET relocationdeadline = @relocationdeadline, "); sql.AppendLine(" modifiedby = @modifiedby, "); sql.AppendLine(" modifiedbyname = @modifiedbyname, "); sql.AppendLine(" modifieddate = @modifieddate "); sql.AppendLine("FROM relocation"); sql.AppendLine("WHERE relocationid = @relocationid"); com.CommandText = sql.ToString(); com.CommandType = CommandType.Text; com.Connection = Connection; com.Transaction = Transaction; com.CommandTimeout = int.MaxValue; com.Parameters.Add(new SqlParameter("@relocationid", RelocationID)); com.Parameters.Add(new SqlParameter("@relocationdeadline", ConvertToNull(RelocationDeadline))); com.Parameters.Add(new SqlParameter("@modifiedby", SyncHelper.AdminID)); com.Parameters.Add(new SqlParameter("@modifiedbyname", SyncHelper.AdminName)); com.Parameters.Add(new SqlParameter("@modifieddate", DateTime.Now)); try { com.ExecuteNonQuery(); BOL.AuditLog.Modules.AccountLog alMgr = new BOL.AuditLog.Modules.AccountLog(); DataRow newLogData = alMgr.SelectAccountForLog_Relocation_Wizard(Connection, Transaction, RelocationID.Value); alMgr.CreateAccountLog_Relocation_Wizard(Connection, Transaction, RelocationID.Value, AccountID.Value, null, newLogData, new Guid(SyncHelper.AdminID), SyncHelper.AdminName); } catch (Exception ex) { } }
internal void CreateMSCStatusHistory(SqlConnection Connection, SqlTransaction Transaction, Guid?AccountID, Guid?MSCApprovalStatusCID, DateTime?MSCApprovalDate) { SqlCommand com = new SqlCommand(); StringBuilder sql = new StringBuilder(); sql.AppendLine("INSERT INTO MSCStatusHistory ("); sql.AppendLine("MSCStatusHistoryID, "); sql.AppendLine("AccountID,"); sql.AppendLine("MSCApprovalStatusCID,"); sql.AppendLine("MSCApprovalDate,"); sql.AppendLine("DataSource,"); sql.AppendLine("CreatedBy,"); sql.AppendLine("CreatedByName,"); sql.AppendLine("CreatedDate,"); sql.AppendLine("ModifiedBy,"); sql.AppendLine("ModifiedByName,"); sql.AppendLine("ModifiedDate"); sql.AppendLine(")"); sql.AppendLine("VALUES ("); sql.AppendLine("@MSCStatusHistoryID, "); sql.AppendLine("@AccountID,"); sql.AppendLine("@MSCApprovalStatusCID,"); sql.AppendLine("@MSCApprovalDate,"); sql.AppendLine("@DataSource,"); sql.AppendLine("@CreatedBy,"); sql.AppendLine("@CreatedByName,"); sql.AppendLine("GETDATE(),"); sql.AppendLine("@CreatedBy,"); sql.AppendLine("@CreatedByName,"); sql.AppendLine("GETDATE()"); sql.AppendLine(")"); com.CommandText = sql.ToString(); com.CommandType = CommandType.Text; com.Connection = Connection; com.Transaction = Transaction; com.CommandTimeout = int.MaxValue; Guid MSCStatusHistoryID = Guid.NewGuid(); com.Parameters.Add(new SqlParameter("@MSCStatusHistoryID", MSCStatusHistoryID)); com.Parameters.Add(new SqlParameter("@AccountID", AccountID)); com.Parameters.Add(new SqlParameter("@MSCApprovalStatusCID", MSCApprovalStatusCID)); com.Parameters.Add(new SqlParameter("@MSCApprovalDate", MSCApprovalDate)); com.Parameters.Add(new SqlParameter("@DataSource", SyncHelper.DataSource)); com.Parameters.Add(new SqlParameter("@CreatedBy", SyncHelper.AdminID)); com.Parameters.Add(new SqlParameter("@CreatedByName", SyncHelper.AdminName)); try { //con.Open() com.ExecuteNonQuery(); //Company Change Log - MSC History BOL.AuditLog.Modules.AccountLog alMgr = new BOL.AuditLog.Modules.AccountLog(); DataRow newLogData = alMgr.SelectAccountForLog_MSCStatus_Wizard(Connection, Transaction, MSCStatusHistoryID); alMgr.CreateAccountLog_MSCStatusHistory_Wizard(Connection, Transaction, MSCStatusHistoryID, AccountID.Value, null, newLogData, new Guid(SyncHelper.AdminID), SyncHelper.AdminName); } catch (Exception ex) { throw; //Finally // con.Close() } }
internal void CreateRelocationDeadline(SqlConnection Connection, SqlTransaction Transaction, Guid?AccountID, Guid?RelocationStatusID, Nullable <DateTime> RelocationDeadline) { SqlCommand com = new SqlCommand(); StringBuilder sql = new StringBuilder(); sql.AppendLine("INSERT INTO relocation "); sql.AppendLine(" (relocationid, "); sql.AppendLine(" accountid, "); sql.AppendLine(" relocationstatus, "); sql.AppendLine(" relocationdeadline, "); sql.AppendLine(" createddate, "); sql.AppendLine(" modifieddate, "); sql.AppendLine(" createdby, "); sql.AppendLine(" modifiedby, "); sql.AppendLine(" createdbyname, "); sql.AppendLine(" modifiedbyname) "); sql.AppendLine("VALUES (@relocationid, "); sql.AppendLine(" @accountid, "); sql.AppendLine(" @relocationstatus, "); sql.AppendLine(" @relocationdeadline, "); sql.AppendLine(" @createddate, "); sql.AppendLine(" @modifieddate, "); sql.AppendLine(" @createdby, "); sql.AppendLine(" @modifiedby, "); sql.AppendLine(" @createdbyname, "); sql.AppendLine(" @modifiedbyname) "); com.CommandText = sql.ToString(); com.CommandType = CommandType.Text; com.Connection = Connection; com.Transaction = Transaction; com.CommandTimeout = int.MaxValue; Guid RelocationID = Guid.NewGuid(); com.Parameters.Add(new SqlParameter("@relocationid", RelocationID)); com.Parameters.Add(new SqlParameter("@accountid", AccountID)); com.Parameters.Add(new SqlParameter("@relocationstatus", RelocationStatusID)); com.Parameters.Add(new SqlParameter("@relocationdeadline", ConvertToNull(RelocationDeadline))); com.Parameters.Add(new SqlParameter("@createdby", SyncHelper.AdminID)); com.Parameters.Add(new SqlParameter("@createdbyname", SyncHelper.AdminName)); com.Parameters.Add(new SqlParameter("@createddate", DateTime.Now)); com.Parameters.Add(new SqlParameter("@modifiedby", SyncHelper.AdminID)); com.Parameters.Add(new SqlParameter("@modifiedbyname", SyncHelper.AdminName)); com.Parameters.Add(new SqlParameter("@modifieddate", DateTime.Now)); try { //con.Open() com.ExecuteNonQuery(); //Company Change Log - MSC History BOL.AuditLog.Modules.AccountLog alMgr = new BOL.AuditLog.Modules.AccountLog(); DataRow newLogData = alMgr.SelectAccountForLog_Relocation_Wizard(Connection, Transaction, RelocationID); alMgr.CreateAccountLog_Relocation_Wizard(Connection, Transaction, RelocationID, AccountID.Value, null, newLogData, new Guid(SyncHelper.AdminID), SyncHelper.AdminName); } catch (Exception ex) { } }
public static void CreateShareHolder(SqlConnection Connection, SqlTransaction Transaction, Guid?AccountID, string ShareHolderName, double?Percentage, int BumiShare, Guid?CountryRegionID, DateTime DateNow) { using (SqlCommand com = new SqlCommand("", Connection)) { System.Text.StringBuilder sql = new System.Text.StringBuilder(); //sql.AppendLine("DELETE FROM ShareHolder") //sql.AppendLine("WHERE AccountID = @AccountID ") //sql.AppendLine("AND ModifiedDate <> @DateNow ") sql.AppendLine("INSERT INTO ShareHolder ("); sql.AppendLine("ShareHolderID, "); sql.AppendLine("AccountID,"); sql.AppendLine("ShareHolderName,"); sql.AppendLine("Percentage,"); sql.AppendLine("BumiShare,"); sql.AppendLine("CountryRegionID,"); sql.AppendLine("CreatedBy,"); sql.AppendLine("CreatedByName,"); sql.AppendLine("CreatedDate,"); sql.AppendLine("ModifiedBy,"); sql.AppendLine("ModifiedByName,"); sql.AppendLine("ModifiedDate,"); sql.AppendLine("Status"); sql.AppendLine(")"); sql.AppendLine("VALUES ("); sql.AppendLine("@ShareHolderID, "); sql.AppendLine("@AccountID,"); sql.AppendLine("@ShareHolderName,"); sql.AppendLine("@Percentage,"); sql.AppendLine("@BumiShare,"); sql.AppendLine("@CountryRegionID,"); sql.AppendLine("@CreatedBy,"); sql.AppendLine("@CreatedByName,"); sql.AppendLine("@DateNow,"); sql.AppendLine("@CreatedBy,"); sql.AppendLine("@CreatedByName,"); sql.AppendLine("@DateNow,"); sql.AppendLine("1"); sql.AppendLine(")"); com.CommandText = sql.ToString(); com.CommandType = CommandType.Text; com.Connection = Connection; com.Transaction = Transaction; com.CommandTimeout = int.MaxValue; Guid ShareHolderID = Guid.NewGuid(); com.Parameters.Add(new SqlParameter("@ShareHolderID", ShareHolderID)); com.Parameters.Add(new SqlParameter("@AccountID", AccountID)); com.Parameters.Add(new SqlParameter("@ShareHolderName", ShareHolderName)); com.Parameters.Add(new SqlParameter("@Percentage", Percentage)); com.Parameters.Add(new SqlParameter("@BumiShare", BumiShare)); com.Parameters.Add(new SqlParameter("@DateNow", DateNow)); com.Parameters.Add(new SqlParameter("@CountryRegionID", CountryRegionID)); com.Parameters.Add(new SqlParameter("@CreatedBy", SyncHelper.AdminID)); com.Parameters.Add(new SqlParameter("@CreatedByName", SyncHelper.AdminName)); try { //con.Open() com.ExecuteNonQuery(); //Company Change Log - MSC History BOL.AuditLog.Modules.AccountLog alMgr = new BOL.AuditLog.Modules.AccountLog(); DataRow newLogData = alMgr.SelectAccountForLog_MSCStatus_Wizard(Connection, Transaction, ShareHolderID); alMgr.CreateAccountLog_Shareholder_Wizard(Connection, Transaction, ShareHolderID, AccountID.Value, null, newLogData, new Guid(SyncHelper.AdminID), SyncHelper.AdminName); } catch (Exception ex) { throw; //Finally // con.Close() } } }