public static List <string> GetCustodianTransactionErrors(ROM_Transactioin _obj)
        {
            List <string>           ErrorResult = new List <string>();
            ValidationContext       _context    = new ValidationContext(_obj);
            List <ValidationResult> _results    = new List <ValidationResult>();
            bool Valid = Validator.TryValidateObject(_obj, _context, _results, true);

            if (!Valid)
            {
                foreach (var item in _results)
                {
                    ErrorResult.Add(item.ErrorMessage);
                }
            }
            return(ErrorResult);
        }
        public bool Validate_File(string _fileName)
        {
            // List<string>ErrorFile = new List<string>();
            int LineNum = 1;
            List <CommonValidation.ErrorFile_list> _ErrorFile = new List <CommonValidation.ErrorFile_list>();

            // Object _obj_Header;

            foreach (string Line in File.ReadAllLines(_fileName))
            {
                string record_type = Line.Substring(0, 1);
                string NewLine     = Line.Remove(0, 2);
                try{
                    switch (record_type)
                    {
                    case "0":
                        string[]   _obj_array = NewLine.Split('~');
                        ROM_Header _objHeader = new ROM_Header()
                        {
                            Batch_No = _obj_array[0],
                            Event_No = _obj_array[1],
                            Count    = _obj_array[2],
                            Shares   = _obj_array[3]
                        };
                        // _obj_Header = _objHeader;
                        // ErrorFile.AddRange(CommonValidation.GetHeaderErrors(_obj));
                        CommonValidation.ErrorFile_list new_objHeader = new CommonValidation.ErrorFile_list();
                        new_objHeader.LineNum       = LineNum;
                        new_objHeader.ErrorResponse = CommonCustodianValidation.GetCustodianHeaderErrors(_objHeader);
                        if (new_objHeader.ErrorResponse.Count > 0)
                        {
                            _ErrorFile.Add(new_objHeader);
                        }
                        break;

                    case "1":
                        // var checkDetail = NewLine.Split('~').Cast<Detail>();
                        string[]   _obj_DetailArray = NewLine.Split('~');
                        ROM_Detail _ObjDetail       = new ROM_Detail()
                        {
                            Sr_no             = _obj_DetailArray[0],
                            DPCL              = _obj_DetailArray[1],
                            ResolutionId      = _obj_DetailArray[2],
                            InFavourShares    = _obj_DetailArray[3],
                            NotInFavourShares = _obj_DetailArray[4],
                            AbstainShares     = _obj_DetailArray[5],
                            TotalShares       = _obj_DetailArray[6],
                        };

                        CommonValidation.ErrorFile_list new_objDetail = new CommonValidation.ErrorFile_list();
                        new_objDetail.LineNum       = LineNum;
                        new_objDetail.ErrorResponse = CommonCustodianValidation.GetCustodianDetailErrors(_ObjDetail);
                        if (new_objDetail.ErrorResponse.Count > 0)
                        {
                            _ErrorFile.Add(new_objDetail);
                        }
                        break;

                    case "2":
                        // var checkDetail = NewLine.Split('~').Cast<Detail>();
                        string[]         _obj_TransactionArray = NewLine.Split('~');
                        ROM_Transactioin _ObjTransaction       = new ROM_Transactioin()
                        {
                            Sr_no               = _obj_TransactionArray[0],
                            TransResolutionId   = _obj_TransactionArray[1],
                            TransInFavShares    = _obj_TransactionArray[2],
                            TransNotInFavShares = _obj_TransactionArray[3],
                            TransAbstainShares  = _obj_TransactionArray[4],
                        };

                        CommonValidation.ErrorFile_list new_objTransaction = new CommonValidation.ErrorFile_list();
                        new_objTransaction.LineNum       = LineNum;
                        new_objTransaction.ErrorResponse = CommonCustodianValidation.GetCustodianTransactionErrors(_ObjTransaction);
                        if (new_objTransaction.ErrorResponse.Count > 0)
                        {
                            _ErrorFile.Add(new_objTransaction);
                        }
                        break;
                    }
                }
                catch (Exception ex)
                {
                    CommonValidation.ErrorFile_list new_objDetail = new CommonValidation.ErrorFile_list();
                    new_objDetail.LineNum       = LineNum;
                    new_objDetail.ErrorResponse = new List <string>()
                    {
                        ex.Message
                    };
                }
                finally
                {
                    LineNum++;
                }
            }

            if (_ErrorFile.Count > 0)
            {
                WriteErrorFile(_ErrorFile);
                return(false);
            }
            else
            {
                return(true);
            }
        }