Example #1
0
        public NotaEntity traerNotaCompleta(string ItemID)
        {
            NotaEntity myNota = new NotaEntity();

            try
            {
                string query = "SELECT * FROM G_Notas Where PK_ID = " + ItemID;
                ds = _GetAllData(query);


                if (ds.Tables[0].Rows.Count > 0)
                {
                    myNota.User_id            = ds.Tables[0].Rows[0][enumTableNota.FK_User.ToString()].ToString().Trim() + "";
                    myNota.User_AdminID       = ds.Tables[0].Rows[0][enumTableNota.FK_Techician.ToString()].ToString().Trim() + "";
                    myNota.User_Tipo          = ds.Tables[0].Rows[0][enumTableNota.tipo.ToString()].ToString().Trim() + "";
                    myNota.User_Titulo        = ds.Tables[0].Rows[0][enumTableNota.Title.ToString()].ToString().Trim() + "";
                    myNota.User_Nota          = ds.Tables[0].Rows[0][enumTableNota.description.ToString()].ToString().Trim() + "";
                    myNota.User_Fecha         = ds.Tables[0].Rows[0][enumTableNota.Date.ToString()].ToString().Trim() + "";
                    myNota.User_MostrarInicio = ds.Tables[0].Rows[0]["estado"].ToString().Trim() + "";

                    if (myNota.User_Fecha.Equals(""))
                    {
                        myNota.User_Fecha = DateTime.Now.ToShortDateString();
                    }
                }

                //cerrar();
                return(myNota);
            }
            catch
            {
                return(myNota);
            }
        }
Example #2
0
        public void SalvarNota(bool isNew, string NotaID, NotaEntity myNota)
        {
            try
            {
                string query = "SELECT * FROM G_Notas Where PK_ID = " + NotaID;
                ds = _GetAllData(query);

                DataRow dr;
                if (isNew)
                {
                    dr = ds.Tables[0].NewRow();
                }
                else
                {
                    dr = ds.Tables[0].Rows[0];
                }

                dr[enumTableNota.FK_User.ToString()]      = myNota.User_UserID;
                dr[enumTableNota.FK_Techician.ToString()] = myNota.User_AdminID;
                dr[enumTableNota.tipo.ToString()]         = myNota.User_Tipo;
                dr[enumTableNota.Title.ToString()]        = myNota.User_Titulo;
                dr[enumTableNota.description.ToString()]  = myNota.User_Nota;
                dr[enumTableNota.Date.ToString()]         = myNota.User_Fecha;
                dr["estado"] = myNota.User_MostrarInicio;

                if (isNew)
                {
                    ds.Tables[0].Rows.Add(dr);
                }

                dest.Update(ds, ds.Tables[0].TableName.ToString());
                cerrar();
                return;
            }
            catch (Exception e)
            {
                throw(e);
            }
        }