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

C#

 
GeneralRe: Saving data to SQL from dynamically made comboboxes... Pin
Vidor4-Jun-12 5:00
professionalVidor4-Jun-12 5:00 
GeneralRe: Saving data to SQL from dynamically made comboboxes... Pin
AmitGajjar4-Jun-12 17:55
professionalAmitGajjar4-Jun-12 17:55 
SuggestionRe: Saving data to SQL from dynamically made comboboxes... Pin
Paul Conrad4-Jun-12 17:07
professionalPaul Conrad4-Jun-12 17:07 
Questiondatabinding in the constuctor not working properly Pin
matleeds3-Jun-12 22:02
matleeds3-Jun-12 22:02 
AnswerRe: databinding in the constuctor not working properly Pin
matleeds3-Jun-12 22:57
matleeds3-Jun-12 22:57 
GeneralRe: databinding in the constuctor not working properly Pin
Luc Pattyn4-Jun-12 4:18
sitebuilderLuc Pattyn4-Jun-12 4:18 
AnswerRe: databinding in the constuctor not working properly Pin
mallikharjuna2214-Jun-12 21:20
mallikharjuna2214-Jun-12 21:20 
QuestionC# 2010 edit Pin
dcof3-Jun-12 18:08
dcof3-Jun-12 18:08 
Right now a C#.net 2010 application edits the columns for field1 and field2 separately. Now I need to combine the edits together since the two columns are related to each other alot.

Thus here is the following code, can you tell me how you would combine the edits together for these two columns:

(note: data table is obtained from information loaded into an excel 2003 spreadsheet)


        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)
        {
           
            base.ValidateData(receivedDate);
            DataTable excelData = ExcelDataTable;          
            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 = Validatefield2(colVal);
                    if (re != null)
                    {
                        list.Add(re);
                    }
             
            }
            excelData.AcceptChanges();
            didc.Dispose();

            return masterList;
        }

        public override List<RuleError> LoadData(ImportWkbk wb, string destDocLoc)
        {
           

            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
                    {
                                        
                        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;
        }

       
                   

      
        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;
        }

       
        public RuleError Validatefield2(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: C# 2010 edit Pin
Richard MacCutchan3-Jun-12 22:09
mveRichard MacCutchan3-Jun-12 22:09 
AnswerRe: C# 2010 edit Pin
Eddy Vluggen4-Jun-12 3:30
professionalEddy Vluggen4-Jun-12 3:30 
Questionc# DataGridView EditMode and DeleteKey Pin
blissMaster3-Jun-12 15:25
blissMaster3-Jun-12 15:25 
AnswerRe: c# DataGridView EditMode and DeleteKey Pin
Abhinav S3-Jun-12 17:16
Abhinav S3-Jun-12 17:16 
Questionconvert part of a list to an array Pin
a.fatemeh3-Jun-12 7:18
a.fatemeh3-Jun-12 7:18 
AnswerRe: convert part of a list to an array Pin
Dave Kreskowiak3-Jun-12 7:30
mveDave Kreskowiak3-Jun-12 7:30 
GeneralRe: convert part of a list to an array Pin
VJ Reddy3-Jun-12 7:56
VJ Reddy3-Jun-12 7:56 
GeneralRe: convert part of a list to an array Pin
Luc Pattyn3-Jun-12 8:59
sitebuilderLuc Pattyn3-Jun-12 8:59 
GeneralRe: convert part of a list to an array Pin
VJ Reddy3-Jun-12 14:05
VJ Reddy3-Jun-12 14:05 
AnswerRe: convert part of a list to an array Pin
Richard Andrew x643-Jun-12 7:33
professionalRichard Andrew x643-Jun-12 7:33 
GeneralRe: convert part of a list to an array Pin
VJ Reddy3-Jun-12 7:57
VJ Reddy3-Jun-12 7:57 
GeneralRe: convert part of a list to an array Pin
Luc Pattyn3-Jun-12 9:00
sitebuilderLuc Pattyn3-Jun-12 9:00 
AnswerRe: convert part of a list to an array Pin
VJ Reddy3-Jun-12 7:53
VJ Reddy3-Jun-12 7:53 
GeneralRe: convert part of a list to an array Pin
Richard Andrew x643-Jun-12 8:00
professionalRichard Andrew x643-Jun-12 8:00 
GeneralRe: convert part of a list to an array Pin
Luc Pattyn3-Jun-12 9:00
sitebuilderLuc Pattyn3-Jun-12 9:00 
AnswerRe: convert part of a list to an array Pin
taha bahraminezhad Jooneghani3-Jun-12 8:05
taha bahraminezhad Jooneghani3-Jun-12 8:05 
AnswerRe: convert part of a list to an array PinPopular
Luc Pattyn3-Jun-12 8:58
sitebuilderLuc Pattyn3-Jun-12 8:58 

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.