Click here to Skip to main content
15,885,919 members
Home / Discussions / C#
   

C#

 
AnswerRe: Sign Language Recognition Pin
Eddy Vluggen3-Jun-12 2:55
professionalEddy Vluggen3-Jun-12 2:55 
GeneralRe: Sign Language Recognition Pin
RimaTeliani3-Jun-12 3:06
RimaTeliani3-Jun-12 3:06 
GeneralRe: Sign Language Recognition Pin
Eddy Vluggen3-Jun-12 4:38
professionalEddy Vluggen3-Jun-12 4:38 
GeneralRe: Sign Language Recognition Pin
RimaTeliani3-Jun-12 21:14
RimaTeliani3-Jun-12 21:14 
QuestionHow to sleep the thread in this example? Pin
daCrazyDude2-Jun-12 17:22
daCrazyDude2-Jun-12 17:22 
AnswerRe: How to sleep the thread in this example? Pin
Luc Pattyn3-Jun-12 4:57
sitebuilderLuc Pattyn3-Jun-12 4:57 
AnswerRe: How to sleep the thread in this example? Pin
daCrazyDude6-Jun-12 15:48
daCrazyDude6-Jun-12 15:48 
Questioncombine edits Pin
dcof2-Jun-12 16:27
dcof2-Jun-12 16:27 
can you tell me how to combine the edits for field1 and field2 together into the same edit? The fields need to be edited together.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IMpt.Interfaces;
using System.Data;
using System.Collections;

namespace Data.Transactions
{
public class Trans : BaseTransaction
{

#region TransactionType implementation methods

/// <summary>
/// Overrides BaseTransaction function to add additional columns
/// </summary>
/// <returns></returns>
public override List<ColumnNames> GetColumnNames()
{
List<ColumnNames> list = base.GetColumnNames();
list.Add(ColumnNames.filed1);
list.Add(ColumnNames.field2);

return list;
}

public override List<RuleError> ValidateData(DateTime receivedDate)
{
//Call the base class function to do
// common data validations
base.ValidateData(receivedDate);

DataTable excelData = ExcelDataTable;
IMptDataContext didc = new IMptDataContext();
Hashtable colMap = base.ColumnMap;
List<RuleError> masterList = new List<RuleError>();
string colName = ColumnNames.field2.ToString();
string field2ColName = colMap[colName].ToString();
colName = ColumnNames.filed1.ToString();
string field1ColName = colMap[colName].ToString();

int iEnd = excelData.Rows.Count;
for (int i = DataRowNumber - 1; i < iEnd; i++)
{
//First validate all common fields from ColumnMap
DataRow dr = excelData.Rows[i];


{
//Call Base class function to validate common fields
List<RuleError> list = Validate(dr, receivedDate, didc);
if (list == null)
list = new List<RuleError>();

string field1 = dr[field1ColName].ToString();
re = Validatefield1ible(field1);
if (re != null)
{
list.Add(re);
}

string colVal = dr[field2ColName].ToString();
re = Validatefield1(colVal);
if (re != null)
{
list.Add(re);
}


}
excelData.AcceptChanges();
didc.Dispose();

return masterList;
}

/// <summary>
/// Validates data and updates DataTable with error messages and Loads data into DB.
/// </summary>
/// <param name="dtData">Excel data to be loaded into database</param>
/// <param name="wb">ImWorkbook DB entity object.</param>
/// <returns>List of RuleError objects</returns>
public override List<RuleError> LoadData(ImportWkbk wb, string destDocLoc)
{
if (IsDupCheckRequired())
{
DateTime firstDate = new DateTime(1753, 1, 1);

//Create DB context
IMptDataContext didc = new IMptDataContext();
didc.CommandTimeout = AutoCode.SQL_CMD_TIMEOUT;
//Create list of master errors
List<RuleError> masterList = new List<RuleError>();
//Get the column map hashtable
Hashtable colMap = base.ColumnMap;
//Get the columns names from the mapping Hashtable
//Get the columns names from the mapping Hashtable

string colName = ColumnNames.field2.ToString();
string field2ColName = colMap[colName].ToString();
colName = ColumnNames.filed1.ToString();
string field1ColName = colMap[colName].ToString();

Hashtable htSubs = new Hashtable();

Int64 submissionID = 0;
VCust firstCust = null;
int iEnd = ExcelDataTable.Rows.Count;
for (int i = DataRowNumber - 1; i < iEnd; i++)
{
DataRow dr = ExcelDataTable.Rows[i];
try
{
//Get the cust id from database
//VCust nextCust = FindCust(didc, dr[cnColName].ToString());
VCust nextCust = FindCust(dr[cnColName].ToString().Trim().ToUpper());


string field1 = dr[field1ColName].ToString().Trim().ToUpper();
lis.filed1 = field1.Length > 0 ? field1 : null;
string field2 = dr[field2ColName].ToString().Trim().ToUpper();
lis.field2 = field2.Length > 0 ? field2 : null;

didc.SubmitChanges();
didc.Dispose();
return null;
}


null;
string field1 = dr[field1ColName].ToString().ToUpper().Trim();
field1 = field1.Length > 0 ? field1 : null;

) &&
(
(field1 == null && d.filed1 == null) ||
(field1 == d.filed1)
) &&
(
(field2 == null && d.field2 == null) ||
(field2 == d.field2)
) &&
(

orderby d.Transaction_ID descending
select d).ToArray();


}
}
}
excelData.AcceptChanges();
didc.Dispose();
}


public RuleError Validatefield1ible(string field1)
{
RuleError re = null;
if (field1 == null || field1.Trim().Length < 1)
return null;

if (field1.Trim().ToUpper().Equals (field1ibleStatus.PART) ||
field1.Trim().ToUpper().Equals (field1ibleStatus.aLL)
)
{
return null;
}

re = new RuleError(RuleErrorCodes.OTHER, RuleErrorTypes.ERROR, "error 1");
return re;
}

/// <summary>
/// Validates Institutional Status value.
/// </summary>
/// <param name="field2us"></param>
/// <returns></returns>
public RuleError Validatefield1(string field2us)
{
RuleError re = null;
if (field2us == null || field2us.Trim().Length < 1)
return null;

if(field2us.Trim().ToUpper().Equals(field2.NO) ||
field2us.Trim().ToUpper().Equals(field2.YES) ||
field2us.Trim().ToUpper().Equals(field2.maybe)
)
{
return null;
}

re = new RuleError(RuleErrorCodes.OTHER, RuleErrorTypes.ERROR, "error 2.");
return re;
}

}
AnswerRe: combine edits Pin
OriginalGriff3-Jun-12 0:27
mveOriginalGriff3-Jun-12 0:27 
GeneralRe: combine edits Pin
dcof3-Jun-12 18:04
dcof3-Jun-12 18:04 
AnswerRe: combine edits Pin
Paul Conrad4-Jun-12 6:38
professionalPaul Conrad4-Jun-12 6:38 
AnswerRe: combine edits Pin
Luc Pattyn3-Jun-12 4:58
sitebuilderLuc Pattyn3-Jun-12 4:58 
Questionbst Pin
negar parham2-Jun-12 7:02
negar parham2-Jun-12 7:02 
AnswerRe: bst Pin
Paul Conrad2-Jun-12 7:07
professionalPaul Conrad2-Jun-12 7:07 
AnswerRe: bst Pin
AmitGajjar4-Jun-12 2:11
professionalAmitGajjar4-Jun-12 2:11 
QuestionC# working with strings Pin
dcof2-Jun-12 6:48
dcof2-Jun-12 6:48 
AnswerRe: C# working with strings Pin
Paul Conrad2-Jun-12 7:02
professionalPaul Conrad2-Jun-12 7:02 
AnswerRe: C# working with strings Pin
OriginalGriff2-Jun-12 9:01
mveOriginalGriff2-Jun-12 9:01 
Questionsend SMS in C# Pin
sina rahimzadeh1-Jun-12 21:48
sina rahimzadeh1-Jun-12 21:48 
AnswerRe: send SMS in C# Pin
Richard MacCutchan1-Jun-12 22:32
mveRichard MacCutchan1-Jun-12 22:32 
AnswerRe: send SMS in C# Pin
Sander Rossel2-Jun-12 0:43
professionalSander Rossel2-Jun-12 0:43 
AnswerRe: send SMS in C# Pin
taha bahraminezhad Jooneghani3-Jun-12 1:56
taha bahraminezhad Jooneghani3-Jun-12 1:56 
QuestionHow to hold dice in yahtzee Pin
Member 83368481-Jun-12 16:05
Member 83368481-Jun-12 16:05 
AnswerRe: How to hold dice in yahtzee Pin
sina rahimzadeh1-Jun-12 21:46
sina rahimzadeh1-Jun-12 21:46 
GeneralRe: How to hold dice in yahtzee Pin
Member 83368481-Jun-12 23:18
Member 83368481-Jun-12 23:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.