private static Guid GetAccountTypeCID(Guid AccountID) { SqlConnection con = SyncHelper.NewCRMConnection(); SqlCommand com = new SqlCommand(); SqlDataAdapter ad = new SqlDataAdapter(com); System.Text.StringBuilder sql = new System.Text.StringBuilder(); sql.AppendLine("SELECT AccountTypeCID FROM Account WHERE AccountID = @AccountID"); com.CommandText = sql.ToString(); com.CommandType = CommandType.Text; com.Connection = con; com.CommandTimeout = int.MaxValue; try { con.Open(); com.Parameters.Add(new SqlParameter("@AccountID", AccountID)); DataTable dt = new DataTable(); ad.Fill(dt); return(new Guid(dt.Rows[0][0].ToString())); } catch (Exception ex) { throw; } finally { con.Close(); } }
public void UpdateApprovalLetterDate(Guid AccountID, Guid MSCStatusHistoryID, DateTime MOFApprovalDate) { SqlConnection con = SyncHelper.NewCRMConnection(); 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 = @ModifiedDate"); sql.AppendLine("WHERE MSCStatusHistoryID = @MSCStatusHistoryID"); com.CommandText = sql.ToString(); com.CommandType = CommandType.Text; com.Connection = con; com.CommandTimeout = int.MaxValue; com.Parameters.Add(new SqlParameter("@MSCStatusHistoryID", MSCStatusHistoryID)); com.Parameters.Add(new SqlParameter("@MSCApprovalDate", MOFApprovalDate)); com.Parameters.Add(new SqlParameter("@DataSource", BOL.Wizard.SyncHelper.DataSource)); 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 { BOL.AuditLog.Modules.AccountLog alMgr = new BOL.AuditLog.Modules.AccountLog(); DataRow oldLogData = alMgr.SelectAccountForLog_MSCStatus(MSCStatusHistoryID); con.Open(); com.ExecuteNonQuery(); //Company Change Log - MSC History DataRow newLogData = alMgr.SelectAccountForLog_MSCStatus(MSCStatusHistoryID); //alMgr.CreateAccountLog_MSCStatusHistory(MSCStatusHistoryID, AccountID, Nothing, newLogData, New Guid(SyncHelper.AdminID), SyncHelper.AdminName) alMgr.CreateAccountLog_MSCStatusHistory(MSCStatusHistoryID, AccountID, oldLogData, newLogData, new Guid(SyncHelper.AdminID), SyncHelper.AdminName); } catch (Exception ex) { throw; } finally { con.Close(); } }
private bool IsDifferentApprovalDate(Guid?MSCStatusHistoryID, string ApprovalLetterDate) { DateTime dApprovalLetterDate = Convert.ToDateTime(ApprovalLetterDate); string sApprovalLetterDate = dApprovalLetterDate.ToString("dd/MM/yyyy"); SqlConnection con = SyncHelper.NewCRMConnection(); SqlCommand com = new SqlCommand(); SqlDataAdapter ad = new SqlDataAdapter(com); System.Text.StringBuilder sql = new System.Text.StringBuilder(); sql.AppendLine("SELECT * "); sql.AppendLine("FROM MSCStatusHistory "); sql.AppendLine("WHERE MSCStatusHistoryID = @MSCStatusHistoryID "); sql.AppendLine("AND CONVERT(VARCHAR(12),MSCApprovalDate,103) = @MSCApprovalLetterDate "); com.CommandText = sql.ToString(); com.CommandType = CommandType.Text; com.Connection = con; com.CommandTimeout = int.MaxValue; con.Open(); try { com.Parameters.Add(new SqlParameter("@MSCStatusHistoryID", MSCStatusHistoryID)); com.Parameters.Add(new SqlParameter("@MSCApprovalLetterDate", sApprovalLetterDate)); DataTable dt = new DataTable(); ad.Fill(dt); if (dt.Rows.Count == 0) { return(true); } else { return(false); } } catch (Exception ex) { throw; } finally { con.Close(); } }
public Guid?GetMSCStatusHistoryID(Guid AccountID, Guid MSCApprovalStatusCID) { Guid output = new Guid(); SqlConnection con = SyncHelper.NewCRMConnection(); SqlCommand com = new SqlCommand(); SqlDataAdapter ad = new SqlDataAdapter(com); System.Text.StringBuilder sql = new System.Text.StringBuilder(); sql.AppendLine("SELECT MSCStatusHistoryID"); sql.AppendLine("FROM MSCStatusHistory"); sql.AppendLine("WHERE AccountID = @AccountID"); sql.AppendLine("AND MSCApprovalStatusCID = @MSCApprovalStatusCID"); com.CommandText = sql.ToString(); com.CommandType = CommandType.Text; com.Connection = con; com.CommandTimeout = int.MaxValue; con.Open(); try { com.Parameters.Add(new SqlParameter("@AccountID", AccountID)); com.Parameters.Add(new SqlParameter("@MSCApprovalStatusCID", MSCApprovalStatusCID)); DataTable dt = new DataTable(); ad.Fill(dt); if (dt.Rows.Count > 0) { output = new Guid(dt.Rows[0][0].ToString()); } else { return(null); } } catch (Exception ex) { throw; } finally { con.Close(); } return(output); }
public static Guid?GetAccountIDByFileID(string FileID) { Guid output = new Guid(); SqlConnection con = SyncHelper.NewCRMConnection(); SqlCommand com = new SqlCommand(); SqlDataAdapter ad = new SqlDataAdapter(com); System.Text.StringBuilder sql = new System.Text.StringBuilder(); sql.AppendLine("SELECT AccountID FROM Account WHERE MSCFileID = @FileID"); com.CommandText = sql.ToString(); com.CommandType = CommandType.Text; com.Connection = con; com.CommandTimeout = int.MaxValue; //con.Open() try { com.Parameters.Add(new SqlParameter("@FileID", FileID)); DataTable dt = new DataTable(); ad.Fill(dt); if (dt.Rows.Count > 0) { output = new Guid(dt.Rows[0][0].ToString()); } else { return(null); } } catch (Exception ex) { throw; } finally { con.Close(); } return(output); }