示例#1
0
        private List <Ent_ParametrosDAL> AdicionaParametrosComunes(Ent_twhcol018 parametros, bool blnUsarPRetorno = false)
        {
            method = MethodBase.GetCurrentMethod();
            string strError = string.Empty;

            List <Ent_ParametrosDAL> parameterCollection = new List <Ent_ParametrosDAL>();

            try
            {
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$TGID", DbType.String, parametros.tgid);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$ITEM", DbType.String, parametros.item);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$CLOT", DbType.String, parametros.clot);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$QTDL", DbType.Decimal, Convert.ToDecimal(System.Math.Abs(parametros.qtdl)).ToString("#.##0,0000"));
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$CUNI", DbType.String, parametros.cuni);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$REFCNTD", DbType.Int32, parametros.refcntd);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$REFCNTU", DbType.Int32, parametros.refcntu);

                if (blnUsarPRetorno)
                {
                    Ent_ParametrosDAL pDal = new Ent_ParametrosDAL();
                    pDal.Name         = "@p_Int_Resultado";
                    pDal.Type         = DbType.Int32;
                    pDal.ParDirection = ParameterDirection.Output;
                    parameterCollection.Add(pDal);
                }
            }
            catch (Exception ex)
            {
                strError = "Error when creating parameters [twhcol018]. Try again or contact your administrator \n";
                log.escribirError(strError + Console.Out.NewLine + ex.Message, stackTrace.GetFrame(1).GetMethod().Name, method.Name, method.ReflectedType.Name);
            }
            return(parameterCollection);
        }
示例#2
0
        private string nextTag_Id(Ent_twhcol018 reg, ref string strError)
        {
            string strTagId = string.Empty;

            method = MethodBase.GetCurrentMethod();

            paramList = new Dictionary <string, object>();
            paramList.Add("p1", reg.orno.Trim().ToUpperInvariant());
            strTagId = recursos.readStatement(method.ReflectedType.Name, "labelRegrind_verificaTagId_Param", ref owner, ref env, tabla, paramList);

            consulta = DAL.BaseDAL.BaseDal.EjecutarCons("Text", strTagId, ref parametersOut, null, true);
            bool blVerificaNext = false;

            strTagId = consulta.Rows[0]["CONS"].ToString();

            if (strTagId.Length < 3)
            {
                strTagId.PadLeft(3, '0');
            }

            switch (strTagId)
            {
            case "0":
                strTagId = reg.orno.Trim().ToUpperInvariant() + '-' + ConfigurationManager.AppSettings["initialConsecTagId"].ToString();
                break;

            case "000":
                strTagId = reg.orno.Trim().ToUpperInvariant() + '-' + ConfigurationManager.AppSettings["initialConsecTagId"].ToString();
                break;

            case "999":
                strError = "Consec has maximum Value (999). Can't create new ID";
                log.escribirError(strError + Console.Out.NewLine, method.Module.Name, method.Name, method.ReflectedType.Name);
                break;

            default:
                strTagId       = reg.orno.Trim().ToUpperInvariant() + '-' + (Convert.ToInt32(strTagId) + 1).ToString();
                blVerificaNext = true;
                break;
            }

            if (blVerificaNext)
            {
                paramList = new Dictionary <string, object>();
                paramList.Add("p1", strTagId);
                string strBusca = recursos.readStatement(method.ReflectedType.Name, "labelRegrind_buscaTagId_Param", ref owner, ref env, tabla, paramList);
                consulta = DAL.BaseDAL.BaseDal.EjecutarCons("Text", strBusca, ref parametersOut, null, true);
                if (consulta.Rows.Count > 0)
                {
                    strError = "Next Tag id already (" + strTagId + ") exists. Can't create new ID";
                    log.escribirError(strError + Console.Out.NewLine, method.Module.Name, method.Name, method.ReflectedType.Name);
                }
            }
            return(strTagId);
        }
示例#3
0
        public int insertarRegistro_regrindM(ref List <Ent_tticol080> parametros, ref string strError, ref string strTagId)
        {
            method = MethodBase.GetCurrentMethod();
            bool retorno = false;

            Ent_twhcol018        obj018;
            twhcol018            dal018 = new twhcol018();
            List <Ent_twhcol018> Listparametros018;
            int retorno018;

            try
            {
                strSentencia = recursos.readStatement(method.ReflectedType.Name, method.Name, ref owner, ref env, tabla);
                int cant = parametros.Count;

                foreach (Ent_tticol080 reg in parametros)
                {
                    obj018       = new Ent_twhcol018();
                    parametrosIn = AdicionaParametrosComunes(reg);
                    retorno      = DAL.BaseDAL.BaseDal.EjecutarCrud("text", strSentencia, ref parametersOut, parametrosIn, false);
                    if (retorno)
                    {
                        Listparametros018 = new List <Ent_twhcol018>();

                        obj018.orno    = reg.orno;
                        obj018.item    = reg.item;
                        obj018.cuni    = reg.idrecord;
                        obj018.qtdl    = reg.qune;
                        obj018.clot    = " ";
                        obj018.refcntd = 0;
                        obj018.refcntu = 0;
                        Listparametros018.Add(obj018);
                        retorno018 = dal018.insertarRegistro(ref Listparametros018, ref strError, ref strTagId);

                        if (retorno018 < 1 || !string.IsNullOrEmpty(strError))
                        {
                            break;
                        }
                        cant++;
                    }
                }
                return(Convert.ToInt32(retorno));
            }

            catch (Exception ex)
            {
                strError = "Error when inserting data [tticol080]. Try again or contact your administrator";
                log.escribirError(strError + Console.Out.NewLine + ex.Message, method.Module.Name, method.Name, method.ReflectedType.Name);
            }
            return(Convert.ToInt32(retorno));
        }