Beispiel #1
0
        protected void LoadTreeZonas()
        {
            RadTreeNode oNode;
            DBConn      oConn = new DBConn();

            if (oConn.Open())
            {
                CmsZona oZona = new CmsZona(ref oConn);
                oZona.EstZona = "V";
                DataTable dZona = oZona.Get();
                if (dZona != null)
                {
                    if (dZona.Rows.Count > 0)
                    {
                        foreach (DataRow oRow in dZona.Rows)
                        {
                            oNode = new RadTreeNode(oRow["nom_zona"].ToString(), "zona_" + oRow["cod_zona"].ToString());
                            rdTreeZona.Nodes.Add(oNode);
                        }
                    }
                }
                dZona = null;
                oConn.Close();
            }
        }
Beispiel #2
0
        protected void btnGrabar_Click(object sender, EventArgs e)
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                oConn.BeginTransaction();
                string  cPath = Server.MapPath(".") + @"\binary\";
                CmsZona oZona = new CmsZona(ref oConn);
                oZona.CodZona     = CodZona.Value;
                oZona.NomZona     = txtTitulo.Text;
                oZona.TextoZona   = rdDescripcion.Content;
                oZona.EstZona     = rdCmbEstado.SelectedValue;
                oZona.IndDespCont = (chk_despliegue.Checked == true ? "V" : "N");
                oZona.Accion      = (string.IsNullOrEmpty(CodZona.Value) ? "CREAR" : "EDITAR");
                oZona.Put();
                CodZona.Value = oZona.CodZona;
                if (string.IsNullOrEmpty(oZona.Error))
                {
                    oConn.Commit();
                    string sFile = "Zona_" + oZona.CodZona + ".bin";
                    oZona.SerializaZona(ref oConn, cPath, sFile);
                }
                else
                {
                    oConn.Rollback();
                }

                oConn.Close();
            }
        }
Beispiel #3
0
        protected void rdZona_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "cmdEdit":
                string[] cParam = new string[2];
                cParam[0] = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["cod_zona"].ToString();
                Response.Redirect(String.Format("Zona.aspx?CodZona={0}", cParam));
                break;

            case "cmdDelete":
                string pCodZona = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["cod_zona"].ToString();
                DBConn oConn    = new DBConn();
                if (oConn.Open())
                {
                    string sPath = Server.MapPath(".") + @"\binary\Zona_" + pCodZona + ".bin";
                    File.Delete(sPath);

                    CmsZona oZona = new CmsZona(ref oConn);
                    oZona.CodZona = pCodZona;
                    oZona.Accion  = "ELIMINAR";
                    oZona.Put();

                    oConn.Close();
                }
                rdZona.Rebind();
                break;
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            oWeb.ValidaSessionAdm();
            if (!IsPostBack)
            {
                CodZona.Value = oWeb.GetData("CodZona");
                if (!string.IsNullOrEmpty(CodZona.Value))
                {
                    DBConn oConn = new DBConn();
                    if (oConn.Open())
                    {
                        CmsZona oZona = new CmsZona(ref oConn);
                        oZona.CodZona = CodZona.Value;
                        DataTable dZona = oZona.Get();
                        if (dZona != null)
                        {
                            if (dZona.Rows.Count > 0)
                            {
                                txtTitulo.Text        = dZona.Rows[0]["nom_zona"].ToString();
                                rdDescripcion.Content = dZona.Rows[0]["texto_zona"].ToString();
                                rdCmbEstado.Items.FindItemByValue(dZona.Rows[0]["est_zona"].ToString()).Selected = true;
                                chk_despliegue.Checked = (dZona.Rows[0]["ind_desp_cont"].ToString() == "V" ? true : false);
                            }
                        }
                        dZona = null;

                        oConn.Close();
                    }
                }
            }
        }
Beispiel #5
0
        protected void rdZona_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                CmsZona oZona = new CmsZona(ref oConn);

                GridColumn oGridColumn;

                oGridColumn            = rdZona.MasterTableView.Columns.FindByUniqueName("NomZona");
                oGridColumn.HeaderText = oCulture.GetResource("Zona", "NomZona");

                oGridColumn            = rdZona.MasterTableView.Columns.FindByUniqueName("EstZona");
                oGridColumn.HeaderText = oCulture.GetResource("Zona", "EstZona");

                rdZona.DataSource = oZona.Get();

                oConn.Close();
            }
        }