//public bool Save(IIndentConsolidation objIndentConsolidation, int intConsolidationStatus, ref int intConsolidationId, ref string poNumbers, ref string toiNumbers, ref string errorMessage)
        public bool Save(IIndentConsolidation objIndentConsolidation, int intConsolidationStatus, ref int intConsolidationId, ref string errorMessage)
        {
            string          USP_INDENT_SAVE = "usp_IndentConsolidationSave";
            DBParameterList dbParam;
            bool            isSuccess = false;

            using (DataTaskManager dtManager = new DataTaskManager())
            {
                //dtManager.BeginTransaction();
                {
                    dbParam = new DBParameterList();
                    dbParam.Add(new DBParameter(Common.PARAM_DATA, Common.ToXml(objIndentConsolidation), DbType.String));
                    dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, errorMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                    DataTable dt = dtManager.ExecuteDataTable(USP_INDENT_SAVE, dbParam);
                    errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();
                    if (errorMessage.Length > 0)
                    {
                        isSuccess = false;
                        //dtManager.RollbackTransaction();
                    }
                    else
                    {
                        if (dt == null)
                        {
                            isSuccess = false;
                            // dtManager.RollbackTransaction();
                        }
                        else
                        {
                            isSuccess          = true;
                            intConsolidationId = Convert.ToInt32(Validators.CheckForDBNull(dt.Rows[0]["ConsolidationId"], Common.INT_DBNULL));
                            //poNumbers = dt.Rows[0]["PONumbers"].ToString();
                            //toiNumbers = dt.Rows[0]["TOINumbers"].ToString();
                            //dtManager.CommitTransaction();
                        }
                    }
                }
            }
            return(isSuccess);
        }
        public List <IndentConsolidation> Search(IIndentConsolidation objIndentConsolidationReq, string PONumber, string TOINumber, ref string errorMessage)
        {
            string USP_INDENT_SEARCH = "usp_IndentConsolidationSearch";
            List <IndentConsolidation> lstIndentConsolidation = new List <IndentConsolidation>();
            DBParameterList            dbParam;

            using (DataTaskManager dtManager = new DataTaskManager())
            {
                dbParam = new DBParameterList();
                dbParam.Add(new DBParameter(Common.PARAM_DATA, Common.ToXml(objIndentConsolidationReq), DbType.String));
                dbParam.Add(new DBParameter(Common.PARAM_DATA2, Common.INT_DBNULL, DbType.Int32));
                dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, errorMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));
                dbParam.Add(new DBParameter("@PONumber", PONumber, DbType.String));
                dbParam.Add(new DBParameter("@TOINumber", TOINumber, DbType.String));

                DataTable dt = dtManager.ExecuteDataTable(USP_INDENT_SEARCH, dbParam);
                errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();

                if (dt != null)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        IndentConsolidation indentConsolidation = new IndentConsolidation();

                        // indentConsolidation.IndentNo = dt.Rows[i]["IndentNo"].ToString();
                        indentConsolidation.ConsolidationId = Convert.ToInt32(dt.Rows[i]["ConsolidationId"]);
                        indentConsolidation.Status          = Convert.ToInt32(dt.Rows[i]["StatusVal"]);
                        indentConsolidation.StatusCap       = Convert.ToString(dt.Rows[i]["StatusCap"]);
                        indentConsolidation.Source          = Convert.ToInt32(dt.Rows[i]["SourceVal"]);
                        indentConsolidation.SourceCap       = Convert.ToString(dt.Rows[i]["SourceCap"]);
                        indentConsolidation.CreatedDate     = Convert.ToDateTime(dt.Rows[i]["CreatedDate"]).ToString(Common.DATE_TIME_FORMAT);
                        indentConsolidation.ModifiedDate    = Convert.ToDateTime(dt.Rows[i]["ModifiedDate"]).ToString(Common.DATE_TIME_FORMAT);
                        lstIndentConsolidation.Add(indentConsolidation);
                    }
                }
            }
            return(lstIndentConsolidation);
        }