Beispiel #1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        protected void SaveData()
        {
            DataEntities ent = new DataEntities();

            int id = WS.RequestInt("id");
            var i = (from l in ent.Info where l.id == id select l).FirstOrDefault();

            i.Address = WS.RequestString("address");
            i.bit1 = WS.RequestString("bit1").ToBoolean();
            i.bit2 = WS.RequestString("bit2").ToBoolean();
            i.bit3 = WS.RequestString("bit3").ToBoolean();
            i.bit4 = WS.RequestString("bit4").ToBoolean();
            i.bit5 = WS.RequestString("bit5").ToBoolean();

            var cls = NewsAction.NewsClass.Where(p => p.ID == WS.RequestInt("class")).First();
            i.ClassID = cls.ID;
            i.ClassName = cls.ClassName;
            i.ClickCount = WS.RequestInt("clickcount",0);
            i.Contact = WS.RequestString("contact");
            i.ContactType = WS.RequestString("contacttype", "个人");

            i.decimal1 = WS.RequestString("decimal1").ToDecimal(0);
            i.decimal2 = WS.RequestString("decimal2").ToDecimal(0);
            i.decimal3 = WS.RequestString("decimal3").ToDecimal(0);
            i.decimal4 = WS.RequestString("decimal4").ToDecimal(0);
            i.decimal5 = WS.RequestString("decimal5").ToDecimal(0);

            i.ImageCount = WS.RequestInt("imagecount",0);
            i.InfoTypeID = TypeID.ToS();
            i.Intro = WS.RequestString("intro");
            i.IsSetTop = WS.RequestString("issettop").ToBoolean();

            i.num1 = WS.RequestInt("num1",0);
            i.num2 = WS.RequestInt("num2", 0);
            i.num3 = WS.RequestInt("num3", 0);
            i.num4 = WS.RequestInt("num4", 0);
            i.num5 = WS.RequestInt("num5", 0);
            i.num6 = WS.RequestInt("num6", 0);
            i.num7 = WS.RequestInt("num7", 0);
            i.num8 = WS.RequestInt("num8", 0);
            i.num9 = WS.RequestInt("num9", 0);
            i.num10 = WS.RequestInt("num10", 0);

            i.nvarchar1 = WS.RequestString("nvarchar1");
            i.nvarchar2 = WS.RequestString("nvarchar2");
            i.nvarchar3 = WS.RequestString("nvarchar3");
            i.nvarchar4 = WS.RequestString("nvarchar4");
            i.nvarchar5 = WS.RequestString("nvarchar5");
            i.nvarchar6 = WS.RequestString("nvarchar6");
            i.nvarchar7 = WS.RequestString("nvarchar7");
            i.nvarchar8 = WS.RequestString("nvarchar8");
            i.nvarchar9 = WS.RequestString("nvarchar9");
            i.nvarchar10 = WS.RequestString("nvarchar10");
            i.nvarchar11 = WS.RequestString("nvarchar11");
            i.nvarchar12 = WS.RequestString("nvarchar12");
            i.nvarchar13 = WS.RequestString("nvarchar13");
            i.nvarchar14 = WS.RequestString("nvarchar14");
            i.nvarchar15 = WS.RequestString("nvarchar15");

            i.OutTime = WS.RequestString("outtime").ToDateTime();
            i.PostTime = WS.RequestString("posttime").ToDateTime();
            i.ReplyCount = WS.RequestInt("replycount",0);
            i.Tel = WS.RequestString("tel");
            i.TelLocation = WS.RequestString("tellocation");

            i.text1 = WS.RequestString("text1");
            i.text2 = WS.RequestString("text2");
            i.text3 = WS.RequestString("text3");
            i.text4 = WS.RequestString("text4");
            i.text5 = WS.RequestString("text5");

            i.Title = WS.RequestString("title");
            i.UserID = SysUserAction.LocalUser.ID;
            i.UserName = SysUserAction.LocalUser.UserName;
            i.ZtID = 0;
            i.ZtName = "";

            if (id <=0)
            {
                ent.AddToInfo(i);
            }
            ent.SaveChanges();
            ent.Dispose();
            Response.Redirect("InfoList.aspx?type=" + TypeID);
        }