Ejemplo n.º 1
0
 public void BindData()
 {
     Model.InTeam cp = Factory.GetExecution().SelectByID <Model.InTeam>(requestID);
     if (view_action == "notify")
     {
         if (cp != null)
         {
             if (cp.Language == 1)
             {
                 Chinese.Checked = true;
             }
             else if (cp.Language == 3)
             {
                 English.Checked = true;
             }
             else if (cp.Language == 2)
             {
                 Traditional.Checked = true;
             }
             txtTitle.Text        = cp.Title;
             txtCreatePeople.Text = cp.CreatePeople;
             txtContent1.Text     = cp.Content1;
             txtContent2.Text     = cp.Content2;
             txtContent3.Text     = cp.Content3;
             txtKeywords.Text     = cp.Keywords;
             txtDescription.Text  = cp.Description;
             //修改过
             List <string> sp        = new List <string>();
             var           photolist = cp.TeamPicname;
             if (!string.IsNullOrEmpty(photolist))
             {
                 for (int i = 0; i < photolist.Split(',').Length; i++)
                 {
                     sp.Add(WebSite.IMAGESERVER_WEBPATH + PhotoPath + photolist.Split(',')[i]);
                 }
             }
             //如果是只读状态,不需要显示默认图片
             if (sp.Count < ProductShowMaxCount)
             {
                 sp.Add(defaultPhoto);
             }
             rptShowPhotoes.DataSource = sp;
             rptShowPhotoes.DataBind();
         }
     }
     else
     {
         List <string> showPhotos = new List <string>();
         showPhotos.Add(defaultPhoto);
         rptShowPhotoes.DataSource = showPhotos;
         rptShowPhotoes.DataBind();
     }
 }
Ejemplo n.º 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     DBOperation.DBOperationManagment dbm = new DBOperation.DBOperationManagment();
     try
     {
         MoveFile();
         string code       = "";
         var    photo_list = UpdateLogo(out code);
         dbm.Open();
         if (view_action == "notify")
         {
             Model.InTeam cp = Factory.GetExecution().SelectByID <Model.InTeam>(requestID);
             if (cp != null)
             {
                 cp.Language     = Convert.ToInt32(Request.Form["language"]);
                 cp.Title        = txtTitle.Text;
                 cp.CreatePeople = txtCreatePeople.Text;
                 cp.Content1     = txtContent1.Text;
                 cp.Content2     = txtContent2.Text;
                 cp.Content3     = txtContent3.Text;
                 cp.UpdateTime   = DateTime.Now;
                 cp.Keywords     = txtKeywords.Text.Trim();
                 cp.Description  = txtDescription.Text.Trim();
                 if (!string.IsNullOrEmpty(photo_list[0]))
                 {
                     cp.TeamPicname = photo_list[0].Trim(',');
                 }
                 bool flag = Factory.GetExecution().Update <Model.InTeam>(cp);
                 if (flag)
                 {
                     Common.MessageBox.ShowRedirect(this, "/Carousel/TeamCarousel.aspx");
                 }
             }
         }
         else
         {
             Model.InTeam cp = new Model.InTeam();
             cp.Language     = Convert.ToInt32(Request.Form["language"]);
             cp.Title        = txtTitle.Text;
             cp.Content1     = txtContent1.Text;
             cp.Content2     = txtContent2.Text;
             cp.Content3     = txtContent3.Text;
             cp.CreatePeople = txtCreatePeople.Text;
             cp.UpdateTime   = DateTime.Now;
             cp.CreateTime   = DateTime.Now;
             cp.Keywords     = txtKeywords.Text.Trim();
             cp.Description  = txtDescription.Text.Trim();
             if (!string.IsNullOrEmpty(photo_list[0]))
             {
                 cp.TeamPicname = photo_list[0].Trim(',');
             }
             bool flag = Factory.GetExecution().Add <Model.InTeam>(cp);
             if (flag)
             {
                 Common.MessageBox.ShowRedirect(this, "/Carousel/TeamCarousel.aspx");
             }
         }
     }
     catch (Exception ex)
     {
         Common.MessageBox.ShowLayer(this, "添加失败!" + ex.Message, 2);
     }
     finally
     {
         dbm.Close();
         BindData();
     }
 }