public ActionResult Edit([Bind(Include = "AfficheID,AfficheNom,CombatID,Lutteur_A,Lutteru_B,DateCombat,Vaincqueur,imageUrl")] Affiche affiche, HttpPostedFileBase ImageUpload)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (ImageUpload != null)
                    {
                        string fileName  = Path.GetFileNameWithoutExtension(ImageUpload.FileName);
                        string extension = Path.GetExtension(ImageUpload.FileName);
                        fileName         = fileName + DateTime.Now.ToString("yymmssff") + extension;
                        affiche.imageUrl = fileName;
                        ImageUpload.SaveAs(Path.Combine(Server.MapPath("~/Images/Image-Affiche"), fileName));
                    }
                    db.Entry(affiche).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch (Exception)
                {
                    return(RedirectToAction("Index", "Error"));
                }
            }


            ViewBag.AfficheID = new SelectList(db.AvisAffiches, "AvisAfficheID", "Auteur", affiche.AfficheID);
            ViewBag.Lutteur_A = new SelectList(db.Lutteurs, "LutteurID", "LutteurName", affiche.Lutteur_A);
            ViewBag.Lutteru_B = new SelectList(db.Lutteurs, "LutteurID", "LutteurName", affiche.Lutteru_B);
            ViewBag.CombatID  = new SelectList(db.Combats, "CombatID", "Combat_Description", affiche.CombatID);

            return(View(affiche));
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string type    = context.Request.Form["type"];
            string account = context.Request.Form["account"];
            string content = context.Request.Form["content"];
            string name    = context.Request.Form["name"];

            if (type == "set")
            {
                AfficheModel affiche = new AfficheModel(account, content, name);
                if (Affiche.setAffiche(affiche))
                {
                    context.Response.Write("true");
                }
                else
                {
                    context.Response.Write("false");
                }
            }
            else
            {
                string data = Affiche.getAffiche();
                context.Response.Write(data);
            }
        }
Ejemplo n.º 3
0
        private Affiche CreateAffiche(DataRow dr)
        {
            Affiche affiche = new Affiche();

            affiche.AfficheNumber        = dr["AfficheNum"].ToString();
            affiche.CountyId             = Convert.ToInt32(dr["CountyId"]);
            affiche.CreateTime           = Convert.ToDateTime(dr["CreateDatetime"]);
            affiche.CreatorId            = Convert.ToInt32(dr["CreatorId"]);
            affiche.AfficheType          = "网上交易公告";
            affiche.ComeForm             = dr["ComeForm"].ToString();
            affiche.IsRelease            = Convert.ToInt32(dr["IsRelease"]) == 1;
            affiche.Notice               = dr["Notice"].ToString();
            affiche.OtherContent         = dr["afficheOther"].ToString();
            affiche.QualificationRequire = dr["Require"].ToString();
            affiche.RatificationNumber   = dr["AffichePassCode"].ToString();
            affiche.RatificationOrg      = dr["AffichePassUnit"].ToString();
            affiche.ReleaseTime          = Convert.ToDateTime(dr["updatedatetime"]);
            if (dr["ReleasedateTime"] != DBNull.Value)
            {
                affiche.UpdateTime = Convert.ToDateTime(dr["ReleasedateTime"]);
            }
            affiche.SellModel      = "网上挂牌";
            affiche.SignBeginTime  = Convert.ToDateTime(dr["SignBeginTime"]);
            affiche.SignEndTime    = Convert.ToDateTime(dr["SignEndTime"]);
            affiche.TradeBeginTime = Convert.ToDateTime(dr["TradeBeginTime"]);
            affiche.TradeEndTime   = Convert.ToDateTime(dr["TradeEndTime"]);
            affiche.Title          = dr["Title"].ToString();
            affiche.VerifyStatus   = Tlw.ZPG.Domain.Enums.AfficheVerifyStatus.None;
            return(affiche);
        }
Ejemplo n.º 4
0
 protected void grdAffList_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "imgBtnModify")
         {
             string guid = e.CommandArgument.ToString();
             Server.Transfer("AfficheMan.aspx?GUID=" + guid);
         }
         if (e.CommandName == "imgBtnDel")
         {
             int     rowIndex = Convert.ToInt32(e.CommandArgument);
             string  guid     = ((HtmlInputHidden)this.grdAffList.Rows[rowIndex].Cells[6].FindControl("hidGuid")).Value.Trim();
             string  fileName = ((HtmlInputHidden)this.grdAffList.Rows[rowIndex].Cells[6].FindControl("hidFileName")).Value.Trim();
             Affiche aff      = new Affiche();
             aff.GUID = guid;
             aff.Delete();
             BindGrid();
             deleteFile(fileName);
             return;
         }
         if (e.CommandName == "imgBtnCha")
         {
             string guid  = e.CommandArgument.ToString();
             string strJV = "window.open('AfficheView.aspx?GUID=" + guid + "','','toolbar=0,status=0,location=0,menubar=0,scrollbars=0');";
             this.WriteClientJava(strJV);
         }
     }
     catch
     {
         this.PrintfError("系统错误!");
         return;
     }
 }
Ejemplo n.º 5
0
        private void SetAfficheContent(Affiche affiche)
        {
            var templete = System.IO.File.ReadAllText("affiche.html");

            affiche.FormatContent(templete);
            affiche.Content = affiche.Content.Replace("{Affiche_HandModeAndBidMethod}", "1、采取在“福建省国有建设用地使用权出让网上交易系统”挂牌的方式进行。 竞买申请人登录“福建省国有建设用地使用权出让网上交易系统”(以下简称网上交易系统)注册登记,提出竞买申请,经挂牌人审查确认,获得登录网上交易系统的竞买号和初始交易密码,在规定的期间内登录网上交易系统进行网上报价和竞买等。<br/>&nbsp;&nbsp;&nbsp;2、竞买人初次报价可等于或大于挂牌起始价,之后每次报价必须比当前最高报价递增一个加价幅度以上的价格(不要求按加价幅度的整数倍报价)。挂牌出让按照价高者得的原则确定竞得人。");
        }
        public ActionResult SaveComment(string commentaire, string note, int afficheID)
        {
            AvisAffiche nouvelAvis = new AvisAffiche();

            nouvelAvis.DateAvis = DateTime.Now;
            nouvelAvis.Message  = commentaire;
            nouvelAvis.Auteur   = User.Identity.Name;
            double dnote = 0;

            if (!double.TryParse(note, NumberStyles.Any, CultureInfo.InvariantCulture, out dnote))
            {
                throw new Exception("Impossible de parser la note" + note);
            }
            nouvelAvis.note = dnote;
            using (var context = new CNGLUTTEDBEntities())
            {
                Affiche aff = context.Affiches.Where(a => a.AfficheID == afficheID).SingleOrDefault();
                if (aff == null)
                {
                    return(RedirectToAction("Index", "AfficheUser"));
                }
                //var p = context.AvisAffiches.ToList();
                //var maxId = p.Max(x => x.AvisAfficheID);
                //nouvelAvis.AvisAfficheID = maxId + 1;
                nouvelAvis.AfficheID = aff.AfficheID;
                context.AvisAffiches.Add(nouvelAvis);
                context.SaveChanges();
            }
            return(RedirectToAction("DetailsAfficheAvecAvis", "AfficheUser", new { id = afficheID }));
        }
Ejemplo n.º 7
0
    string getHtml()
    {
        StringBuilder Html = new StringBuilder();
        DataSet       ds   = Affiche.GetAllAffiches();

        if (ds != null)
        {
            int Count = ds.Tables[0].Rows.Count;
            int Nbr   = 0;
            if (Count > 13)
            {
                Nbr = 13;
            }
            else
            {
                Nbr = Count;
            }
            Html.Append("<TABLE rules=\"rows\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" align=\"center\" border=\"0\" class=\"Flowtable\">");
            for (int i = 0; i < Nbr; i++)
            {
                DataRow Row   = ds.Tables[0].Rows[i];
                string  title = Row["Title"].ToString();
                string  flag  = Row["TypeNbr"].ToString();
                string  guid  = Row["Guid"].ToString();
                Html.Append("<TR>");
                Html.Append("<TD height=\"20\" width=\"5%\" class=\"SystemDashedTd\" vAlign=\"middle\"><IMG src=\"Images/down/ImWorkSmall.gif\">");
                Html.Append("</TD>");
                if (flag == "0")
                {
                    Html.Append("<TD height=\"20\" width=\"95%\" class=\"SystemDashedTd\" vAlign=\"center\" align=\"left\" style=\"PADDING-TOP: 4px\" nowrap=\"false\"><font style=\"COLOR: #94939B\">通告:" + title.Trim() + "</font>");
                }
                else
                {
                    Html.Append("<TD height=\"20\" width=\"95%\" class=\"SystemDashedTd\"  vAlign=\"center\" align=\"left\" style=\"PADDING-TOP: 4px\" nowrap=\"false\"><font style=\"COLOR: #94939B\">发文:</font><A title=\"" + title.Trim() + "\" target=\"_blank\" href=\"SiteBll/SysMan/AfficheView.aspx?GUID=" + guid + "\">" + title.Trim() + "</A>");
                }
                Html.Append("</TD>");
                Html.Append("</TR>");
            }
            if (Count > 13)
            {
                Html.Append("<TR>");
                Html.Append("<td colspan=\"2\" height=\"5\" width=\"100%\">");
                Html.Append("</td>");
                Html.Append("</TR>");
                Html.Append("<TR>");
                Html.Append("<td colspan=\"2\" vAlign=\"middle\" align=\"right\" width=\"100%\"><A href=\"SiteBll/SysMan/AfficheList.aspx\" target=\"frm\"><IMG src=\"Images/icon/More.gif\" border=\"0\"></A>");
                Html.Append("</td>");
                Html.Append("</TR>");
            }
            else
            {
                Html.Append("<TR>");
                Html.Append("<td colspan=\"2\" height=\"5\" width=\"100%\">");
                Html.Append("</td>");
                Html.Append("</TR>");
            }
            Html.Append("</TABLE>");
        }
        return(Html.ToString());
    }
Ejemplo n.º 8
0
    protected void btnSumbit_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            if (string.IsNullOrEmpty(this.m_txtTitle.Text))
            {
                this.PrintfError("标题不能为空!");
                return;
            }

            Affiche aff         = new Affiche();
            string  des         = FreeTextBox1.Text.ToString();
            string  Guid        = System.Guid.NewGuid().ToString();
            string  Requestguid = this.Request["Guid"];
            if (!string.IsNullOrEmpty(Requestguid))
            {
                Guid = Requestguid.ToString();
            }
            aff.GUID = Guid;
            string year = System.DateTime.Now.Date.Year.ToString();
            string path = Server.MapPath("../../AffFiles/" + year + "/");
            if (!string.IsNullOrEmpty(des))
            {
                aff.TypeNbr = 1;//直接发布信息
                if (!Directory.Exists(path))
                {
                    DirectoryInfo di = Directory.CreateDirectory(path);
                }
                StreamWriter write;
                write = File.CreateText(path + "\\" + Guid + ".ini");
                write.Write(des);
                write.Close();
                aff.FileName = path + "\\" + Guid + ".ini";
            }
            else
            {
                aff.TypeNbr = 0;
            }
            aff.Title    = this.m_txtTitle.Text;
            aff.PTime    = DateTime.Now;
            aff.UserID   = this.CUSER.UserID;
            aff.UserName = this.CUSER.UserName;
            if (!string.IsNullOrEmpty(Requestguid))
            {
                aff.Update();
            }
            else
            {
                aff.Add();
            }
            this.PrintfError("操作成功!");
        }
        catch
        {
            this.PrintfError("数据访问错误!");
            return;
        }
    }
        public ActionResult Create([Bind(Include = "AfficheID,AfficheNom,CombatID,Lutteur_A,Lutteru_B,DateCombat,Vaincqueur,imageUrl")] Affiche affiche, HttpPostedFileBase ImageUpload)
        {
            if (ModelState.IsValid)
            {
                ViewBag.AfficheID = new SelectList(db.AvisAffiches, "AvisAfficheID", "Auteur", affiche.AfficheID);
                ViewBag.Lutteur_A = new SelectList(db.Lutteurs, "LutteurID", "LutteurName", affiche.Lutteur_A);
                ViewBag.Lutteru_B = new SelectList(db.Lutteurs, "LutteurID", "LutteurName", affiche.Lutteru_B);
                ViewBag.CombatID  = new SelectList(db.Combats, "CombatID", "Combat_Description", affiche.CombatID);

                ViewBag.result = "";

                Affiche verifLut_date = db.Affiches.Where(x => x.DateCombat == affiche.DateCombat &&
                                                          (((x.Lutteur_A == affiche.Lutteur_A) || (x.Lutteur_A == affiche.Lutteru_B)) ||
                                                           ((x.Lutteru_B == affiche.Lutteur_A) || (x.Lutteru_B == affiche.Lutteru_B))
                                                          )).FirstOrDefault();

                try
                {
                    if (ImageUpload != null)
                    {
                        string fileName  = Path.GetFileNameWithoutExtension(ImageUpload.FileName);
                        string extension = Path.GetExtension(ImageUpload.FileName);
                        fileName         = fileName + DateTime.Now.ToString("yymmssff") + extension;
                        affiche.imageUrl = fileName;
                        ImageUpload.SaveAs(Path.Combine(Server.MapPath("~/Images/Image-Affiche"), fileName));
                    }
                    if (affiche.Lutteur_A == affiche.Lutteru_B)
                    {
                        ViewBag.result = "Vous ne pouvez pas choisir le meme lutteur deux fois dans le meme combat";
                        return(View(affiche));
                    }
                    if (verifLut_date != null)
                    {
                        ViewBag.result = "Un des deux lutteurs que vous avez choisit à déja un combat à cette date ";

                        return(View(affiche));
                    }


                    db.Affiches.Add(affiche);
                    db.SaveChanges();



                    return(RedirectToAction("Index"));
                }
                catch (Exception)
                {
                    return(RedirectToAction("Index", "Error"));
                }
            }

            return(View(affiche));
        }
Ejemplo n.º 10
0
 private void BindGrid()
 {
     try
     {
         DataSet ds = Affiche.GetAllAffiches();
         this.grdAffList.DataSource = ds;
         this.grdAffList.DataBind();
     }
     catch
     {
         this.PrintfError("系统错误!");
     }
 }
        // GET: Affiche/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Affiche affiche = db.Affiches.Find(id);

            if (affiche == null)
            {
                return(HttpNotFound());
            }
            return(View(affiche));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Affiche            affiche = db.Affiches.Find(id);
            List <AvisAffiche> laa     = db.AvisAffiches.Where(v => v.AfficheID == id).ToList();

            foreach (var item in laa)
            {
                db.AvisAffiches.Remove(item);
            }

            db.Affiches.Remove(affiche);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 13
0
 private void SetUI()
 {
     try
     {
         string  guid = Request["GUID"];
         Affiche a    = Affiche.GetAffiche(guid);
         this.lblTitle.Text    = a.Title;
         this.lblUserName.Text = a.UserName;
         this.lblTime.Text     = a.PTime.ToString();
         this.liContent.Text   = ReadFile(a.FileName);
     }
     catch
     {
         PrintfError("数据访问错误!");
         return;
     }
 }
        public ActionResult LaisserUnAvis(int afficheID)
        {
            LaisserUnAvisViewModel vm = new LaisserUnAvisViewModel();

            using (var context = new CNGLUTTEDBEntities())
            {
                Affiche aff = context.Affiches.Where(a => a.AfficheID == afficheID).SingleOrDefault();
                if (aff == null)
                {
                    return(RedirectToAction("Index", "AfficheUser"));
                }
                vm.AfficheID  = aff.AfficheID;
                vm.NomAffiche = aff.AfficheNom;
            }

            return(View(vm));
        }
        // GET: Affiche/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Affiche affiche = db.Affiches.Find(id);

            if (affiche == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AfficheID = new SelectList(db.AvisAffiches, "AvisAfficheID", "Auteur", affiche.AfficheID);
            ViewBag.Lutteur_A = new SelectList(db.Lutteurs, "LutteurID", "LutteurName", affiche.Lutteur_A);
            ViewBag.Lutteru_B = new SelectList(db.Lutteurs, "LutteurID", "LutteurName", affiche.Lutteru_B);
            ViewBag.CombatID  = new SelectList(db.Combats, "CombatID", "Combat_Description", affiche.CombatID);
            return(View(affiche));
        }
Ejemplo n.º 16
0
 private void Import_Affiche()
 {
     try
     {
         var    db    = GetDbContext();
         string sql   = @"select t1.*,t2.AfficheNum,t2.AfficheOther,t2.AffichePassCode,t2.AffichePassUnit,t2.Require
                 from afficheall t1
                 left join AfficheContent t2 on t1.AfficheId=t2.AfficheId 
                 order by allid";
         var    dt    = GetTableBySelectSql(sql);
         var    query = dt.AsEnumerable().GroupBy((r) => { return((int)r["AfficheId"]); }).ToList();
         foreach (var item in query)
         {
             var afficheId = item.Key;
             if (item.Count() == 1)
             {
                 //没有补充的公告,补充公告需要手动录入
                 Affiche affiche = CreateAffiche(item.First());
                 SetAfficheContent(affiche);
                 db.Set <Affiche>().Add(affiche);
                 db.SaveChanges();
             }
             else if (item.Count() == 2)
             {
                 var     first   = item.First();
                 Affiche affiche = CreateAffiche(item.First());
                 SetAfficheContent(affiche);
                 db.Set <Affiche>().Add(affiche);
                 db.SaveChanges();
                 var second     = item.Skip(1).First();
                 var affiche_bc = CreateAfficheBC(second);
                 affiche_bc.ParentId = affiche.ID;
                 affiche_bc.Content  = second["Content"].ToString();
                 //SetAfficheContent(affiche_bc);
                 db.Set <Affiche>().Add(affiche_bc);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception ex)
     {
         WriteLog(ex.StackTrace + Environment.NewLine + ex.Message);
     }
 }
        // GET: AfficheUser/Details/5
        public ActionResult DetailsAfficheAvecAvis(int id)
        {
            try
            {
                Affiche affiche = db.Affiches
                                  .Include(a => a.Combat)
                                  .Include(a => a.Lutteur)
                                  .Include(a => a.Lutteur1)
                                  .Where(s => s.AfficheID == id).FirstOrDefault();
                List <AvisAffiche> listAvis = db.AvisAffiches.Where(c => c.AfficheID == id).ToList();
                if (affiche == null)
                {
                    return(RedirectToAction("Index"));
                }

                AfficheAvecAvis vm = new AfficheAvecAvis();
                vm.AfficheID  = affiche.AfficheID;
                vm.AfficheNom = affiche.AfficheNom;
                vm.Combat     = affiche.Combat;
                vm.Lutteur    = affiche.Lutteur;
                vm.Lutteur1   = affiche.Lutteur1;
                vm.DateCombat = affiche.DateCombat;
                vm.Vaincqueur = affiche.Vaincqueur;
                vm.imageUrl   = affiche.imageUrl;
                if (listAvis.Count != 0)
                {
                    vm.Avis = listAvis.OrderByDescending(o => o.DateAvis).ToList();
                }

                return(View(vm));
            }
            catch (Exception)
            {
                return(RedirectToAction("Index", "Error"));
            }
        }
Ejemplo n.º 18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // 在此处放置用户代码以初始化页面
     if (!this.Page.IsPostBack)
     {
         try
         {
             if (!string.IsNullOrEmpty(Request["GUID"]))
             {
                 Affiche a = Affiche.GetAffiche(Request["GUID"]);
                 if (a != null)
                 {
                     this.m_txtTitle.Text = a.Title;
                 }
                 readFile(Request["GUID"]);
             }
         }
         catch
         {
             this.PrintfError("数据访问错误!");
             return;
         }
     }
 }