Example #1
0
        public List <MaterialOutDtlModel> GetMaterialOutDtlListByMaterialOutCode(int MaterialOutCode)
        {
            MaterialOutDtlQueryModel qmObj = new MaterialOutDtlQueryModel();

            qmObj.StartRecord          = 0;
            qmObj.MaxRecords           = -1;
            qmObj.SortColumns          = "MaterialOutDtlCode";
            qmObj.MaterialOutCodeEqual = (MaterialOutCode.ToString() == "0") ? "-1" : MaterialOutCode.ToString();
            return(this.Select(qmObj));
        }
Example #2
0
        public List <MaterialOutDtlModel> GetMaterialOutDtlListByContract(string ContractCode)
        {
            MaterialOutDtlQueryModel qmObj = new MaterialOutDtlQueryModel();

            qmObj.StartRecord       = 0;
            qmObj.MaxRecords        = -1;
            qmObj.SortColumns       = "MaterialOutDtlCode";
            qmObj.ContractCodeEqual = (ContractCode == "") ? "-1" : ContractCode;
            return(this.Select(qmObj));
        }
Example #3
0
        private List <MaterialOutDtlModel> _Select(MaterialOutDtlQueryModel qmObj)
        {
            List <MaterialOutDtlModel> list2;

            try
            {
                List <MaterialOutDtlModel> list = new List <MaterialOutDtlModel>();
                StringBuilder builder           = new StringBuilder();
                builder.Append("select * from V_MaterialOutDtl as MaterialOutDtl ");
                builder.Append(qmObj.QueryConditionStr);
                if ((qmObj.SortColumns == null) || (qmObj.SortColumns.Length == 0))
                {
                    builder.Append(" ORDER BY MaterialOutDtlCode desc");
                }
                else
                {
                    builder.Append(" ORDER BY " + qmObj.SortColumns);
                }
                this._DataProcess.CommandText   = builder.ToString();
                this._DataProcess.SqlParameters = qmObj.Parameters;
                SqlDataReader sqlDataReader = null;
                int           num           = 0;
                try
                {
                    sqlDataReader = this._DataProcess.GetSqlDataReader();
                    while (sqlDataReader.Read())
                    {
                        if ((num >= qmObj.StartRecord) && ((list.Count < qmObj.MaxRecords) || (qmObj.MaxRecords == -1)))
                        {
                            MaterialOutDtlModel model = new MaterialOutDtlModel();
                            this.Initialize(sqlDataReader, model);
                            list.Add(model);
                        }
                        num++;
                    }
                }
                catch (Exception exception)
                {
                    throw exception;
                }
                finally
                {
                    if (sqlDataReader != null)
                    {
                        sqlDataReader.Close();
                    }
                }
                list2 = list;
            }
            catch (Exception exception2)
            {
                throw exception2;
            }
            return(list2);
        }
Example #4
0
        public List <MaterialOutDtlModel> GetModels(MaterialOutDtlQueryModel ObjQueryModel, SqlTransaction Transaction)
        {
            List <MaterialOutDtlModel> list;

            try
            {
                list = new MaterialOutDtlDAL(Transaction).Select(ObjQueryModel);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(list);
        }
Example #5
0
        public List <MaterialOutDtlModel> Select(MaterialOutDtlQueryModel qmObj)
        {
            List <MaterialOutDtlModel> list;

            try
            {
                list = this._Select(qmObj);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(list);
        }
Example #6
0
        public int Delete(int Code, SqlTransaction Transaction)
        {
            int num;

            try
            {
                MaterialOutDAL           tdal  = new MaterialOutDAL(Transaction);
                MaterialOutDtlDAL        ldal  = new MaterialOutDtlDAL(Transaction);
                MaterialOutDtlQueryModel qmObj = new MaterialOutDtlQueryModel();
                qmObj.MaterialOutCodeEqual = Code.ToString();
                foreach (MaterialOutDtlModel model2 in ldal.Select(qmObj))
                {
                    ldal.Delete(model2.MaterialOutDtlCode);
                }
                num = tdal.Delete(Code);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(num);
        }