Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List <Press> pressList = paperTransferManager.GetAllPressInfoByDropDownList();
                Press        press     = new Press();
                press.PressId   = -1;
                press.PressName = "<-- Select One Option -->";
                pressList.Insert(0, press);
                fromPressNameDropDownList.DataSource     = pressList;
                fromPressNameDropDownList.DataValueField = "PressId";
                fromPressNameDropDownList.DataTextField  = "PressName";
                fromPressNameDropDownList.DataBind();

                press.PressId   = -1;
                press.PressName = "<-- Select One Option -->";
                pressList.Insert(0, press);
                toPressNameDropDownList.DataSource     = pressList;
                toPressNameDropDownList.DataValueField = "PressId";
                toPressNameDropDownList.DataTextField  = "PressName";
                toPressNameDropDownList.DataBind();

                List <Paper> paperList = paperTransferManager.GetAllPaperInfoByDropDownList();
                Paper        paper     = new Paper();
                paper.PaperId   = -1;
                paper.PaperName = "<-- Select One Option -->";
                paperList.Insert(0, paper);
                paperNameDropDownList.DataSource     = paperList;
                paperNameDropDownList.DataValueField = "PaperId";
                paperNameDropDownList.DataTextField  = "PaperName";
                paperNameDropDownList.DataBind();

                transferNoTextBox.Text = LoadNextTransferNo();
            }
        }
Exemple #2
0
 public void SendMail(Object Sender, ImageClickEventArgs E)
 {
     tabFirmas.Visible = false;
     Consulta_Click(Sender, E);
     Utils.MostrarAlerta(Response, Press.PressOnEmail(reportTitle, tbEmail.Text, tabPreHeader, dg));
     tabFirmas.Visible = true;
 }
Exemple #3
0
        public async void PressWillCallBackWithNewsListSpecified()
        {
            var sut = new Press();
            var res = await sut.GetNews();

            Assert.IsTrue(res.Count > 1);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            HtmlGenericControl _nc = (HtmlGenericControl)Master.FindControl("navPress");
            _nc.Attributes.Add("class", "active");

            dd_Status.DataSource = this.LogedInUser.GetAllStatuses();
            dd_Status.DataTextField = "Description";
            dd_Status.DataValueField = "ID";
            dd_Status.DataBind();

            dd_Format.DataSource = this.LogedInUser.GetPressTypes();
            dd_Format.DataTextField = "Description";
            dd_Format.DataValueField = "ID";
            dd_Format.DataBind();

            dd_Format.Items.Insert(0, new ListItem("---- Select One-----", ""));

            String _pressId = Request.QueryString["pressId"];
            if (!String.IsNullOrEmpty(_pressId))
            {
                ViewState.Add("pressId", _pressId);

                Press _press = new Press(this.ConnectionString);
                _press.LitePopulate(_pressId, false);

                if (dd_Format.Items.FindByValue(Convert.ToInt32(_press.ContentType).ToString()) != null)
                {
                    dd_Format.ClearSelection();
                    dd_Format.Items.FindByValue(Convert.ToInt32(_press.ContentType).ToString()).Selected = true;
                    dd_Format.Enabled = false;
                }

                txt_Title.Text = HttpUtility.HtmlDecode(_press.PressTitle);
                txt_Desc.Text = HttpUtility.HtmlDecode(_press.Deacription);
                txt_Date.Text = _press.PressDate;
                txt_Link.Text = _press.WebLink;
                if (dd_Status.Items.FindByValue(_press.Status.ToString()) != null)
                {
                    dd_Status.ClearSelection();
                    dd_Status.Items.FindByValue(_press.Status.ToString()).Selected = true;
                }

                val_AudFile.Enabled = false;
                val_AudThumb.Enabled = false;
                val_MThumb.Enabled = false;
                val_VidFile.Enabled = false;
                val_VidThumb.Enabled = false;
                val_TxtThumb.Enabled = false;
                Format_IndexChanged(dd_Format, EventArgs.Empty);

                lbl_Header.Text = _press.PressTitle;
            }
            else
            {
                lbl_Header.Text = "Add New";
            }
        }
    }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,ImageUrl,Link,Description,Date,Source,Status, CreateDate, Language")] Press press)
        {
            if (id != press.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    press.Category = _category;
                    _context.Update(press);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PressExists(press.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(press));
        }
Exemple #6
0
 public void SendMail(Object Sender, ImageClickEventArgs E)
 {
     Consulta_Click(Sender, E);
     Utils.MostrarAlerta(Response, Press.PressOnEmail(reportTitle, tbEmail.Text, tabPreHeader, dg));
     dg.EnableViewState = false;
     //this.ClearChildViewState();
 }
Exemple #7
0
 /// <summary>
 /// Raises event 'Press'
 /// </summary>
 protected virtual void OnPress()
 {
     if (Press != null)
     {
         Press.Invoke(this, System.EventArgs.Empty);
     }
 }
Exemple #8
0
        public ActionResult Create([Bind(Include = "id,press_title,press_keyName,press_img")] Press press, HttpPostedFileBase press_img, List <string> content, List <string> langlist, List <string> title)
        {
            if (ModelState.IsValid)
            {
                Random random       = new Random();
                int    randomNumber = random.Next(0, 100000);
                int    randomKey    = random.Next(0, 1000000);
                var    filename     = Path.GetFileName(press_img.FileName);
                var    src          = Path.Combine(Server.MapPath("~/Uploads/"), randomNumber + filename);
                press_img.SaveAs(src);
                press.press_img     = "/Uploads/" + randomNumber + filename;
                press.press_keyName = randomKey.ToString();
                db.Presses.Add(press);
                db.SaveChanges();
                var titleandcontent = title.Zip(content, (t, c) => new { Title = t, Content = c });

                int i = 0;
                foreach (var item in titleandcontent)
                {
                    Keystring newkey = new Keystring();
                    newkey.keyName = randomKey.ToString();
                    newkey.content = item.Content;
                    newkey.title   = item.Title;
                    int lang = Convert.ToInt16(langlist[i]);
                    newkey.language_id = lang;
                    db.Keystrings.Add(newkey);
                    db.SaveChanges();
                    i++;
                }
                return(RedirectToAction("Index"));
            }

            return(View(press));
        }
Exemple #9
0
 public void Visit(Press press)
 {
     commandAcceptFlag = isPress(nowCommandLogPosition.data, press.button);
     if (commandAcceptFlag)
     {
         nowCommandLogPosition = nowCommandLogPosition.Next;
     }
 }
Exemple #10
0
 public virtual bool OnPress(object sender, MouseEventArgs args)
 {
     if (Press != null)
     {
         return(Press.Invoke(sender, args));
     }
     return(true);
 }
Exemple #11
0
        public ActionResult DeleteConfirmed(int id)
        {
            Press press = db.Presses.Find(id);

            db.Presses.Remove(press);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #12
0
 public void ButtonUp(T button)
 {
     if (buttonsDown.Contains(button))
     {
         buttonsDown.Remove(button);
         Press?.Invoke(button);
     }
 }
Exemple #13
0
        protected void  generar(Object Sender, EventArgs e)
        {
            string [] pr = new string[2];


            pr[0] = pr[1] = "";
            Press frontEnd = new Press(new DataSet(), reportTitle);

            frontEnd.PreHeader(tabPreHeader, Grid.Width, pr);
            frontEnd.Firmas(tabFirmas, Grid.Width);

            lb.Text = "";

            this.PrepararTabla();
            lineas = new DataSet();
            DBFunctions.Request(lineas, IncludeSchema.NO, "select distinct  pcv.pcat_descripcion as modelo,mpv.mped_valounit as valor_total, mpv.mped_valounit/(1+(pcv.piva_porciva*0.01)) as valorunitario, mpv.mped_valounit - (mpv.mped_valounit/(1+(pcv.piva_porciva*0.01))) as valor_iva from dbxschema.mpedidovehiculo mpv, dbxschema.pcatalogovehiculo pcv,dbxschema.mcatalogovehiculo mcv, dbxschema.mnit mn, dbxschema.mvehiculo mv, dbxschema.mfacturacliente mfc, dbxschema.pvendedor pv, dbxschema.masignacionvehiculo mav,dbxschema.pclasevehiculo pclv, dbxschema.mfacturapedidovehiculo mfpv where mfc.pven_codigo = pv.pven_codigo and mfpv.pdoc_codigo = mfc.pdoc_codigo and mfpv.mped_codigo = mpv.pdoc_codigo and mfpv.mped_numepedi = mpv.mped_numepedi and mpv.pdoc_codigo = mav.pdoc_codigo and mpv.mped_numepedi = mav.mped_numepedi and mav.mveh_inventario = mv.mveh_inventario and mv.mcat_vin = mcv.mcat_vin and mcv.pcat_codigo = pcv.pcat_codigo and pcv.pcla_codigo = pclv.pcla_codigo");
            for (int i = 0; i < lineas.Tables[0].Rows.Count; i++)
            {
                //Vamos a crear una fila para nuestro DataTable resultado, que almacene los resultados de las operaciones anteriores
                DataRow fila;
                Valto    = Convert.ToInt32(lineas.Tables[0].Rows[i].ItemArray[1]);
                Valun    = Convert.ToInt32(lineas.Tables[0].Rows[i].ItemArray[2]);
                total    = Convert.ToDouble(lineas.Tables[0].Rows[i].ItemArray[1]);
                unitario = Convert.ToDouble(lineas.Tables[0].Rows[i].ItemArray[2]);
                poiva    = Convert.ToDouble(lineas.Tables[0].Rows[i].ItemArray[3]);
                ///////////////////////////////////
                total1    = String.Format("{0:C}", total);
                unitario1 = String.Format("{0:C}", unitario);
                poiva1    = String.Format("{0:C}", poiva);
                ////////////////////////////

                int cantidad = 0;
                cantidad              = (Valto / Valun);
                fila                  = resultado.NewRow();
                fila["MODELO"]        = lineas.Tables[0].Rows[i].ItemArray[0].ToString();
                fila["VALORUNITARIO"] = unitario1;
                fila["VALORTOTAL"]    = total1;
                fila["PORCENTAJE"]    = poiva1;
                fila["CANTIDAD"]      = cantidad;
                resultado.Rows.Add(fila);
            }            //fin sentencia FOR

            Grid.DataSource = resultado;
            Grid.DataBind();
            StringBuilder  SB     = new StringBuilder();
            StringWriter   SW     = new StringWriter(SB);
            HtmlTextWriter htmlTW = new HtmlTextWriter(SW);

            tabPreHeader.RenderControl(htmlTW);
            Grid.RenderControl(htmlTW);
            tabFirmas.RenderControl(htmlTW);
            string strRep;

            strRep = SB.ToString();
            Session.Clear();
            Session["Rep"] = strRep;
            //toolsHolder.Visible = true;
        }
Exemple #14
0
        protected void  generar(Object Sender, EventArgs e)
        {
            string [] pr = new string[2];
            pr[0] = pr[1] = "";
            Press frontEnd = new Press(new DataSet(), reportTitle);

            frontEnd.PreHeader(tabPreHeader, Grid.Width, pr);
            frontEnd.Firmas(tabFirmas, Grid.Width);
            lb.Text = "";
            Año     = Convert.ToInt32(año.SelectedValue.ToString());
            Mes     = Convert.ToInt32(DBFunctions.SingleData("SELECT pmes_mes FROM DBXSCHEMA.pmes WHERE pmes_nombre='" + mes.SelectedValue.ToString() + "' "));


            ///////////////////////////////////////////////////////
            this.PrepararTabla();
            lineas = new DataSet();
            DBFunctions.Request(lineas, IncludeSchema.NO, "select MBR.MBUSR_FECHA,MBR.MCAT_PLACA,MBR.ORIGEN,MBR.DESTINO,MBR.NOMBRE_RESERVA,MBR.VALOR_RESERVA FROM DBXSCHEMA.MBUS_RENTADO MBR,DBXSCHEMA.MBUSAFILIADO MBUS WHERE MBR.MCAT_PLACA=MBUS.MCAT_PLACA AND MBUS.TESTA_CODIGO=6 AND year(MBR.MBUSR_FECHA)=" + Año + " and month(MBR.MBUSR_FECHA)=" + Mes + " ");
            for (int i = 0; i < lineas.Tables[0].Rows.Count; i++)
            {
                //Vamos a crear una fila para nuestro DataTable resultado, que almacene los resultados de las operaciones anteriores
                DataRow fila;


                //SaldoFinal1=String.Format("{0:C}",saldoLinea);
                fila = resultado.NewRow();
                double valor        = 0;
                string ValorFormato = null;
                valor               = Convert.ToDouble(lineas.Tables[0].Rows[i].ItemArray[5].ToString());
                ValorFormato        = String.Format("{0:C}", valor);
                fila["FECHA"]       = lineas.Tables[0].Rows[i].ItemArray[0].ToString();
                fila["PLACA"]       = lineas.Tables[0].Rows[i].ItemArray[1].ToString();
                fila["ORIGEN"]      = lineas.Tables[0].Rows[i].ItemArray[2].ToString();
                fila["DESTINO"]     = lineas.Tables[0].Rows[i].ItemArray[3].ToString();
                fila["CONTRATANTE"] = lineas.Tables[0].Rows[i].ItemArray[4].ToString();
                fila["VALCONTRATO"] = ValorFormato.ToString();


                resultado.Rows.Add(fila);
            }

            //fin sentencia FOR
            Grid.DataSource = resultado;
            Grid.DataBind();
            StringBuilder  SB     = new StringBuilder();
            StringWriter   SW     = new StringWriter(SB);
            HtmlTextWriter htmlTW = new HtmlTextWriter(SW);

            tabPreHeader.RenderControl(htmlTW);
            Grid.RenderControl(htmlTW);
            tabFirmas.RenderControl(htmlTW);
            string strRep;

            strRep = SB.ToString();
            Session.Clear();
            Session["Rep"]      = strRep;
            toolsHolder.Visible = true;
        }
Exemple #15
0
    public void ChangeInputValue()
    {
        Transform pressbox    = this.transform.parent.parent;
        Press     PressScript = pressbox.GetComponent <Press>();

        if (this.name == "InputKey")
        {
            PressScript.button = this.GetComponent <InputField>().text;
        }
    }
Exemple #16
0
 public ActionResult Edit([Bind(Include = "Id,Name")] Press press)
 {
     if (ModelState.IsValid)
     {
         db.Entry(press).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(press));
 }
 public JObject ToJson(int weightSum)
 {
     return(new JObject
     {
         { "width", Weight / (double)weightSum },
         { "showText", !Discrete },
         { "tap", Tap.ToString() },
         { "press", Press.ToString() }
     });
 }
Exemple #18
0
    public void DeletePress(long id)
    {
        Press press = context.Presses.Find(id);

        if (press is not null)
        {
            context.Presses.Remove(press);
            context.SaveChanges();
        }
    }
        public static IList <Book> GetBooks()
        {
            if (_books != null)
            {
                return(_books);
            }

            _books = new List <Book>();

            // book #1
            Book book = new()
            {
                Id       = 1,
                ISBN     = "978-0-321-87758-1",
                Title    = "Essential C#5.0",
                Author   = "Mark Michaelis",
                Price    = 59.99m,
                Location = new Address {
                    City = "Redmond", Street = "156TH AVE NE"
                },
                Press = new Press
                {
                    Id       = 1,
                    Name     = "Addison-Wesley",
                    Email    = "*****@*****.**",
                    Category = Category.Book
                }
            };

            _books.Add(book);

            // book #2
            book = new Book
            {
                Id       = 2,
                ISBN     = "063-6-920-02371-5",
                Title    = "Enterprise Games",
                Author   = "Michael Hugos",
                Price    = 49.99m,
                Location = new Address {
                    City = "Bellevue", Street = "Main ST"
                },
                Press = new Press
                {
                    Id       = 2,
                    Name     = "O'Reilly",
                    Email    = "*****@*****.**",
                    Category = Category.EBook,
                }
            };
            _books.Add(book);

            return(_books);
        }
    }
        /**
         * @brief RequestTimer start procedure.
         */
        private void StartTimerPress()
        {
            if (RequestTimerPress == null)
            {
                RequestTimerPress          = new Timer(config.SampleTime);
                RequestTimerPress.Elapsed += new ElapsedEventHandler(RequestTimerElapsedPress);
                RequestTimerPress.Enabled  = true;

                Press.ResetAllAxes();
            }
        }
Exemple #21
0
        public ActionResult Create([Bind(Include = "Id,Name")] Press press)
        {
            if (ModelState.IsValid)
            {
                db.Presses.Add(press);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(press));
        }
Exemple #22
0
    public void UpdatePress(Press press)
    {
        Press p = context.Presses.Find(press.Id);

        if (p is not null)
        {
            p.Name = press.Name;
            context.Entry(p).State = EntityState.Modified;
            context.SaveChanges();
        }
    }
Exemple #23
0
 public string Save(Press press)
 {
     if (pressGateway.Insert(press) > 0)
     {
         return("Saved Successfully!!");
     }
     else
     {
         return("Could Not Save Data in Database!!");
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        String _conn = ConfigurationManager.ConnectionStrings["TopRockConnection"].ConnectionString;
        Press _ev = new Press(_conn);

        String _pressThumb = ConfigurationManager.AppSettings["PressThumbPath"].Replace("../", "");
        String _musicPath = ConfigurationManager.AppSettings["PressAudioPath"].Replace("../", "");
        String _contThumb = ConfigurationManager.AppSettings["PressContentThumbPath"].Replace("../", "");
        String _videoPath = ConfigurationManager.AppSettings["PressVideoPath"].Replace("../", "");

        DisplayResult(_ev.GetPressXml(Enums.enumStatuses.Active, _pressThumb, _musicPath, _contThumb, _videoPath));
    }
Exemple #25
0
    public long InsertPress(Press press)
    {
        context.Presses.Add(press);
        context.SaveChanges();

        // В этом нет необходимости, поскольку EF по после вызова SaveChanges()
        // сам заполняет автоинкрементные поля в добавленных объектах в соответствии
        // с полученными значениями для этих полей при добавлении в БД
        //return Convert.ToInt64(context.Database.SqlQuery<decimal>("SELECT IDENT_CURRENT('Presses')").SingleOrDefault());

        return(press.Id);
    }
        public async Task <IActionResult> Create([Bind("Id,Title,ImageUrl,Link,Description,Date,Source,Status,Category,CreateDate, Language")] Press press)
        {
            if (ModelState.IsValid)
            {
                press.Category   = _category;
                press.CreateDate = DateTime.Now;
                _context.Add(press);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(press));
        }
        public int Insert(Press press)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        quary      = "INSERT INTO tbl_press VALUES('" + press.PressCode + "','" + press.PressName + "','" +
                                       press.PressAddress + "','" + press.PressOpeningBalance + "')";
            SqlCommand command = new SqlCommand(quary, connection);

            connection.Open();
            int rowAffected = command.ExecuteNonQuery();

            connection.Close();
            return(rowAffected);
        }
Exemple #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List <Binder> binderList = binderOrderManager.GetAllBinderInfoByDropDownList();
                Binder        binder     = new Binder();
                binder.BinderId   = -1;
                binder.BinderName = "<--Select One Option-->";
                binderList.Insert(0, binder);
                binderNameDropDownList.DataSource     = binderList;
                binderNameDropDownList.DataValueField = "BinderId";
                binderNameDropDownList.DataTextField  = "BinderName";
                binderNameDropDownList.DataBind();

                List <Group> groupList = binderOrderManager.GetAllGroupInfoByDropDownList();
                Group        group     = new Group();
                group.GroupId   = -1;
                group.GroupCode = "<--Select One Option-->";
                groupList.Insert(0, group);
                groupCodeDropDownList.DataSource     = groupList;
                groupCodeDropDownList.DataValueField = "GroupId";
                groupCodeDropDownList.DataTextField  = "GroupCode";
                groupCodeDropDownList.DataBind();

                List <BookInfo> bookInfoList = binderOrderManager.GetAllBookInfoByDropDownList();
                BookInfo        bookInfo     = new BookInfo();
                bookInfo.BookInfoId = -1;
                bookInfo.BookCode   = "<--Select One Option-->";
                bookInfoList.Insert(0, bookInfo);
                bookCodeDropDownList.DataSource     = bookInfoList;
                bookCodeDropDownList.DataValueField = "BookInfoId";
                bookCodeDropDownList.DataTextField  = "BookCode";
                bookCodeDropDownList.DataBind();

                List <Press> pressList = binderOrderManager.GetAllPressInfoByDropDownList();
                Press        press     = new Press();
                press.PressId   = -1;
                press.PressName = "<-- Select One Option -->";
                pressList.Insert(0, press);
                pressNameDropDownList.DataSource     = pressList;
                pressNameDropDownList.DataValueField = "PressId";
                pressNameDropDownList.DataTextField  = "PressName";
                pressNameDropDownList.DataBind();

                orderNoTextBox.Text = LoadNextOrderNo();

                List <BinderOrder> binderOrderList = binderOrderManager.GetAllBinderOrder();
                Session["binderOrder"] = binderOrderList;
                Session["active"]      = -1;
            }
        }
Exemple #29
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Press press = db.Presses.Find(id);

            if (press == null)
            {
                return(HttpNotFound());
            }
            return(View(press));
        }
    private void BindData()
    {
        Press _th = new Press(this.ConnectionString);
        gv_Press.DataSource = _th.GetPress(Enums.enumStatuses.Active);
        gv_Press.DataBind();

        PressCollection<Press> _coll = new PressCollection<Press>(this.ConnectionString);

        _coll.AddRange(_th.GetPress(Enums.enumStatuses.Inactive));
        _coll.AddRange(_th.GetPress(Enums.enumStatuses.Pending));

        gv_PressNotActive.DataSource = _coll;
        gv_PressNotActive.DataBind();
    }
Exemple #31
0
        // GET: AdminPanel/Presses/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Press press = db.Presses.Find(id);

            ViewBag.KeyWords = db.Keystrings.Where(s => s.keyName == press.press_keyName).ToList();

            if (press == null)
            {
                return(HttpNotFound());
            }
            return(View(press));
        }
Exemple #32
0
 public Press[] GetList()
 {
     Press[] pr = null;
     if ( Shared.Storage.FileExists( FileLinks.ROOT_WTEXT + FileLinks.PRESS_LISTF ) )
     {
         XDocument Xml = XDocument.Parse( Shared.Storage.GetString( FileLinks.ROOT_WTEXT + FileLinks.PRESS_LISTF ) );
         IEnumerable<XElement> press = Xml.Descendants( "item" );
         int l;
         pr = new Press[l = press.Count()];
         for ( int i = 0; i < l; i++ )
         {
             pr[i] = new Press( press.ElementAt( i ).Value, press.ElementAt( i ).Attribute( "sort" ).Value, "" );
         }
     }
     return pr;
 }
Exemple #33
0
 public Press[] GetList()
 {
     Press[] pr = null;
     if (Shared.Storage.FileExists(FileLinks.ROOT_WTEXT + FileLinks.PRESS_LISTF))
     {
         XDocument Xml = XDocument.Parse(Shared.Storage.GetString(FileLinks.ROOT_WTEXT + FileLinks.PRESS_LISTF));
         IEnumerable <XElement> press = Xml.Descendants("item");
         int l;
         pr = new Press[l = press.Count()];
         for (int i = 0; i < l; i++)
         {
             pr[i] = new Press(press.ElementAt(i).Value, press.ElementAt(i).Attribute("sort").Value, "");
         }
     }
     return(pr);
 }
Exemple #34
0
        public async Task AddPress(Press press)
        {
            if (connection.State != ConnectionState.Open)
            {
                connection.Open();
            }

            SqlCommand command = connection.CreateCommand();

            command.CommandText = "INSERT INTO Press(Id,Name) " +
                                  " VALUES(@Id,@Name);";
            command.Parameters.AddWithValue("@Id", press.Id);
            command.Parameters.AddWithValue("@Name", press.Name);
            int row = await command.ExecuteNonQueryAsync();

            connection.Close();
        }
    protected void Save_Click(object sender, EventArgs e)
    {
        if (IsValid)
        {
            Press _press = new Press(this.ConnectionString);

            if (ViewState["pressId"] != null)
            {
                _press.LitePopulate(ViewState["pressId"], false);
            }

            _press.PressTitle = HttpUtility.HtmlEncode(txt_Title.Text);
            _press.ContentType = (Press.enumPressTypes)Enum.Parse(typeof(Press.enumPressTypes), dd_Format.SelectedValue);
            _press.Deacription = HttpUtility.HtmlEncode(txt_Desc.Text);
            _press.PressDate = txt_Date.Text;
            _press.Status = Convert.ToInt32(dd_Status.SelectedValue);

            String _pressImgType = "";
            if(fu_MThumb.HasFile)
            {
                _pressImgType = fu_MThumb.FileName.Split('.')[1];
                _press.PressThumbImgType = _pressImgType;
            }
            String _contThumb = "";
            String _contFile = "";
            switch (_press.ContentType)
            {
                case Press.enumPressTypes.Audio:
                    if (fu_AudThumb.HasFile)
                    {
                        _contThumb = fu_AudThumb.FileName.Split('.')[1];
                        _press.ContentThumbImgType = _contThumb;
                    }
                    if (fu_AudFile.HasFile)
                    {
                        _contFile = fu_AudFile.FileName.Split('.')[1];
                        _press.MusicType = _contFile;
                    }
                    break;
                case Press.enumPressTypes.Video:
                    if (fu_VidThumb.HasFile)
                    {
                        _contThumb = fu_VidThumb.FileName.Split('.')[1];
                        _press.ContentThumbImgType = _contThumb;
                    }
                    if (fu_VidFile.HasFile)
                    {
                        _contThumb = fu_VidFile.FileName.Split('.')[1];
                        _press.VideoType = _contThumb;
                    }
                    break;
                case Press.enumPressTypes.Text:
                    if (fu_TxtThumb.HasFile)
                    {
                        _contThumb = fu_TxtThumb.FileName.Split('.')[1];
                        _press.ContentThumbImgType = _contThumb;
                    }
                    _press.WebLink = txt_Link.Text;
                    break;
                default:
                    break;
            }

            if (_press.Save())
            {
                String _path;
                switch (_press.ContentType)
                {
                    case Press.enumPressTypes.Audio:
                        if (fu_AudThumb.HasFile)
                        {
                            _path = Server.MapPath(String.Format(ConfigurationManager.AppSettings["PressContentThumbPath"], _press.ID.ToString(), _press.ContentThumbImgType));
                            fu_AudThumb.SaveAs(_path);
                        }
                        if (fu_AudFile.HasFile)
                        {
                            _path = Server.MapPath(String.Format(ConfigurationManager.AppSettings["PressAudioPath"], _press.ID.ToString(), _press.MusicType));
                            fu_AudFile.SaveAs(_path);
                        }
                        break;
                    case Press.enumPressTypes.Video:
                        if (fu_VidThumb.HasFile)
                        {
                            _path = Server.MapPath(String.Format(ConfigurationManager.AppSettings["PressContentThumbPath"], _press.ID.ToString(), _press.ContentThumbImgType));
                            fu_VidThumb.SaveAs(_path);
                        }
                        if (fu_VidFile.HasFile)
                        {
                            _path = Server.MapPath(String.Format(ConfigurationManager.AppSettings["PressVideoPath"], _press.ID.ToString(), _press.VideoType));
                            fu_VidFile.SaveAs(_path);
                        }
                        break;
                    case Press.enumPressTypes.Text:
                        if (fu_TxtThumb.HasFile)
                        {
                            _path = Server.MapPath(String.Format(ConfigurationManager.AppSettings["PressContentThumbPath"], _press.ID.ToString(), _press.ContentThumbImgType));
                            fu_TxtThumb.SaveAs(_path);
                        }
                        break;
                    default:
                        break;
                }
                if (fu_MThumb.HasFile)
                {
                    _path = Server.MapPath(String.Format(ConfigurationManager.AppSettings["PressThumbPath"], _press.ID.ToString(), _press.PressThumbImgType));
                    fu_MThumb.SaveAs(_path);

                }

                this.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "alert('Record has been updated successfully.');self.location = 'PressList.aspx';", true);
            }
            else
            {
                lbl_Error.Text = "An unexpected error has occurred. Please try again.";
                lbl_Error.Visible = true;
            }
        }
    }
Exemple #36
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Key"/> class.
		/// </summary>
		public KeyEvent()
		{
			keyType = KeyType.NoKey;
			press = Press.Make;
			character = (char)0x00;
		}