예제 #1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            var           minutes = Math.Round(Convert.ToDecimal(Request.Form["slMinutes"].ToString()) / 60, 2);
            var           hours   = Convert.ToInt32(Request.Form["slHours"].ToString()) + minutes;
            Ent_tticol085 data085 = new Ent_tticol085()
            {
                mcno = _machine,
                type = Convert.ToInt32(slType.SelectedValue.Trim()),
                tano = Convert.ToInt32(Request.Form["slTask"].ToString()),
                cwtt = Request.Form["slHoursLaborType"].ToString(),
                hrea = hours,
                comm = Request.Form["slComments"].ToString(),
                logn = HttpContext.Current.Session["user"].ToString()
            };

            var validInsert = _idaltticol085.insertarRegistro(ref data085, ref strError);

            if (validInsert > 0)
            {
                divTable.InnerHtml    = String.Empty;
                divBtnGuardar.Visible = false;
                txtMachine.Text       = String.Empty;
                lblConfirm.Text       = mensajes("msjsave");
                lblError.Text         = string.Empty;
                return;
            }
            else
            {
                lblError.Text   = mensajes("errorsave");
                lblConfirm.Text = string.Empty;
                return;
            }
        }
예제 #2
0
        public int insertarRegistro(ref Ent_tticol085 parametrosIn, ref string strError)
        {
            int retorno = -1;

            try
            {
                retorno = dal.insertarRegistro(ref parametrosIn, ref strError);
                return(retorno);
            }
            catch (Exception ex)
            {
                throw new Exception(strError += "\nPila: " + ex.Message);
            }
        }
예제 #3
0
        private List <Ent_ParametrosDAL> AdicionaParametrosComunes(Ent_tticol085 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$MCNO", DbType.String, parametros.mcno);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$TYPE", DbType.Int32, parametros.type);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$TANO", DbType.Int32, parametros.tano);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$CWTT", DbType.String, parametros.cwtt);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$HREA", DbType.Double, parametros.hrea);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$COMM", DbType.String, parametros.comm);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$LOGN", DbType.String, parametros.logn);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$PROC", DbType.Int32, parametros.proc);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$CHEC", DbType.Int32, parametros.chec);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$MESS", DbType.String, parametros.mess);
                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 [301]. 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);
        }
예제 #4
0
        public int insertarRegistro(ref Ent_tticol085 parametro, ref string strError)
        {
            method = MethodBase.GetCurrentMethod();
            bool retorno = false;

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

                parametrosIn = AdicionaParametrosComunes(parametro);
                retorno      = DAL.BaseDAL.BaseDal.EjecutarCrud("text", strSentencia, ref parametersOut, parametrosIn, false);

                return(Convert.ToInt32(retorno));
            }

            catch (Exception ex)
            {
                strError = ex.InnerException != null ?
                           ex.Message + " (" + ex.InnerException + ")" :
                           ex.Message;
            }

            return(Convert.ToInt32(retorno));
        }