Beispiel #1
0
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<GZS.Model.Invest.InvestCostM> DataTableToList(DataTable dt)
		{
			List<InvestCostM> modelList = new List<InvestCostM>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				GZS.Model.Invest.InvestCostM model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new InvestCostM();
					if(dt.Rows[n]["Costid"].ToString()!="")
					{
						model.Costid=int.Parse(dt.Rows[n]["Costid"].ToString());
					}
					model.loginName=dt.Rows[n]["loginName"].ToString();
					model.Chineseintroduced=dt.Rows[n]["Chineseintroduced"].ToString();
					model.Englishintroduction=dt.Rows[n]["Englishintroduction"].ToString();
					if(dt.Rows[n]["createdate"].ToString()!="")
					{
						model.createdate=DateTime.Parse(dt.Rows[n]["createdate"].ToString());
					}
					if(dt.Rows[n]["hits"].ToString()!="")
					{
						model.hits=int.Parse(dt.Rows[n]["hits"].ToString());
					}
					modelList.Add(model);
				}
			}
			return modelList;
		}
 protected void bindModel(string loginName)
 {
     costM = costBll.GetModels(loginName);
     //ViewState["id"] = costM.Costid.ToString();
     txtChina.Text   = costM.Chineseintroduced.ToString();
     txtEnglish.Text = costM.Englishintroduction.ToString();
 }
Beispiel #3
0
        public int StaticHtml(int id, string loginName)
        {
            try
            {
                //string TempFileName = InvestTem.ToString();
                //string Tem = Compage.Reader(TempFileName); //读取模板内容
                //string TempSoure = Tem;
                //string boolS = boolStr(loginName);


                //TempSoure = TempSoure.Replace("$InvestID$", id.ToString());
                //TempSoure = TempSoure.Replace("$Content$", content(loginName, boolS));
                //TempSoure = TempSoure.Replace("$loginName$", loginName);
                //CompanyShow com = new CompanyShow();
                //TempSoure = TempSoure.Replace("$CompanyName$", com.GetCompanyNameByLoginName(loginName));
                //string htmlFile = "cost.htm";
                //string wenjian = InvestPath + loginName;
                //if (!Directory.Exists(wenjian))
                //{
                //    Directory.CreateDirectory(wenjian);
                //}
                //string htmlpaths = wenjian + "/" + htmlFile;
                //Compage.Writer(htmlpaths, TempSoure);
                //return 1;


                string        TempFileName = InvestTem.ToString();
                string        Tem          = Compage.Reader(TempFileName); //读取模板内容
                string        TempSoure    = Tem;
                InvestCostM   costm        = new InvestCostM();
                InvestCostDAL costb        = new InvestCostDAL();
                if (id == 0)
                {
                    costm = costb.GetModels(loginName);
                }
                else
                {
                    costm = costb.GetModel(id);
                }
                TempSoure = TempSoure.Replace("$zhongwencontex$", costm.Chineseintroduced.ToString());
                TempSoure = TempSoure.Replace("$EnglishContext$", costm.Englishintroduction.ToString());
                TempSoure = TempSoure.Replace("$loginName$", loginName);
                CompanyShow com = new CompanyShow();
                TempSoure = TempSoure.Replace("$CompanyName$", com.GetCompanyNameByLoginName(loginName));
                string htmlFile = "cost.htm";
                string wenjian  = InvestPath + loginName;
                if (!Directory.Exists(wenjian))
                {
                    Directory.CreateDirectory(wenjian);
                }
                string htmlpaths = wenjian + "/" + htmlFile;
                Compage.Writer(htmlpaths, TempSoure);
                return(1);
            }
            catch (Exception e)
            {
                return(0);
            }
        }
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     loginName = ViewState["LoginName"].ToString();
     //costM.Costid = int.Parse(ViewState["id"].ToString());
     costM = costBll.GetModels(loginName);
     costM.Chineseintroduced   = txtChina.Text.ToString();
     costM.Englishintroduction = txtEnglish.Text.ToString();
     costM.loginName           = loginName;
     costM.hits = 0;
     if (costBll.Update(costM))
     {
         sta.StaticHtml(0, loginName);
         Response.Write("<script>alert('修改成功!');location.href='InvestManage.aspx';</script>");
     }
     else
     {
         Response.Write("<script>alert('修改失败!');</script>");
     }
 }
Beispiel #5
0
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(InvestCostM model)
		{
			return dal.Update(model);
		}