• ECMASCript 之二 PeoplePicker,DatetimeControl,InPutFormText 控件的使用(更新获取时候) ECMAScript 更新 删除 DropDownLis绑定


    using System;
    using System.Text;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Collections;
    using Microsoft.SharePoint;
    
    
    namespace updateInfo
    {
        public partial class oEdit : System.Web.UI.UserControl
        {
            private string _pageUrl = "/Pages/Tst.aspx";
            [WebBrowsable(true)]
            [WebDisplayName("")]
            [Personalizable(PersonalizationScope.Shared)]
            [SPWebCategoryName("")]
            public string PageUrl
            {
                get { return _pageUrl; }
                set { _pageUrl = value; }
            }
            private string _activitytypename = "";
            [WebBrowsable(true)]
            [WebDisplayName("")]
            [Personalizable(PersonalizationScope.Shared)]
            [SPWebCategoryName(")]
            public string Name
            {
                get { return _name; }
                set { _name = value; }
            }
            private string _activityPicLib = '''';
            //[WebBrowsable(true)]
            //[WebDisplayName("")]
            //[Personalizable(PersonalizationScope.Shared)]
            //[SPWebCategoryName("")]
            public string PicLib
            {
                get { return _PicLib; }
                set { _PicLib = value; }
            }
            BAO bao = null;
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    hid_maxnum.Value = "1";
                    ul_content.InnerHtml = "";
                    ddl_TypeBind();
                    SetData();
                }
            }
            private void SetData()
            {
                if (Request.QueryString["ID"] != null)
                {
                     bao = new BAO(string.Empty);
                    int ID = CustomerConvert.ConvertNullToInt(Request.QueryString["ID"]);
                    Entity entity = new Entity("", 1);
                    entity = bao.GetEntityByID(ID);
                    if (entity != null)
                    {
                        ddl_type.SelectedValue = entity.Type;
                        txt_details.Text = entity.Content;
                         string account ="";
                        if (entity.PublishPeople.Contains(";#"))
                        {
                            account = entity.PublishPeople.Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries)[1];
                        }
                        this.txt_Name.CommaSeparatedAccounts = account;
                        txt_Part.Text = entity.PublishPeople;
                        chk_isdrapt.Checked=entity.Draft;
                        if (entity.ITime != null)
                        {
                            dtc_activityendtime.SelectedDate = Convert.ToDateTime(entity.IssuedTime);
                        }
                        chk_isvote.Checked=entity.IsVote;
                        txt_Part.Text = entity.PublishPart;
                        if (entity.PublishTime != null)
                        {
                            dtc_publishtime.SelectedDate = Convert.ToDateTime(entity.PublishTime);
                        }
                        else
                        {
                            dtc_publishtime.SelectedDate = DateTime.Now;
                        }
                        txt_title.Text = entity.Title;
                        chk_istop.Checked = entity.ToTop;
                        if (entity.ToTopUntilTime != null)
                        {
                            dtc_topendtime.SelectedDate = Convert.ToDateTime(entity.ToTopUntilTime);
                        }
                        List<string> list = new List<string>();
                        list = bao.GetPicsInfo(ID);
                        if (list != null)
                        {
                            if (list.Count > 0)
                            {
                                for (int i = 0; i < list.Count; i++)
                                {
                                    if (list[i] != "")
                                    {
                                        string num = (i + 1).ToString();
                                        string pic_ID = list[i].Split(',')[0];
                                        string pic_Url = list[i].Split(',')[1];
                                        string pic_describe = list[i].Split(',')[2];
                                        hid_picIDs.Value = hid_picIDs.Value + pic_ID.ToString() + ",";
                                        ul_content.InnerHtml += "<li id='li_" + num + "'><img src='" + pic_Url + "'  /><input  idPic' ='386px;' type='text' value='" + pic_describe + "' />  <input  sle='386px; display:none;' type='text' value='" + pic_ID + "' /><input type='button' value='上传' onclick='uploadPicture(" + num + ")' style=' 72px' /><a href='javascript:void(0)' onclick='AddPicRow(" + num + ")'>添加</a> <a href='javascript:void(0)' onclick='DelPicRow(" + num + ")'>删除</a></li>";
                                    }
                                }
                                hid_maxnum.Value = list.Count.ToString();
                            }
                            else
                            {
                                ul_content.InnerHtml = "  <li id=\"li_1\"><img src=\"/_.jpg:386px;\" type=\"text\" value=''  /><input  style=\"386px; display:none;\" type=\"text\" value" /> <input type=\"button\" value=\"上传\" onclick=\"uploadPicture(1)\" style=\" 72px\" /> <a href='javascript:void(0)' onclick=\"AddPicRow(1)\">添加</a> <a href='javascript:void(0)' onclick=\"DelPicRow(1)\" >删除</a></li>";
                            }
                           
                        }
                        else
                        {
                            ul_content.InnerHtml = "  <li id=\"li_1\"><img src=\"/\"  />  <input  style=\"386px;\" type=\"text\"  value='' /><input  style=\"386px; display:none;\" typ=\"\" /> <input type=\"button\" value=\"上传\" onclick=\"uploadPicture(1)\" style=\" 72px\" /> <a href='javascript:void(0)' onclick=\"AddPicRow(1)\">添加</a> <a href='javascript:void(0)' onclick=\"DelPicRow(1)\" >删除</a></li>";
                        }
                    }
                }
            }
            protected void btn_OK_Click(object sender, EventArgs e)
            {
                bao = new BAO(string.Empty);
                ntity entity = new Entity("", 1);
                entity.ID = CustomerConvert.ConvertNullToInt(Request.QueryString["ID"]);
                entity.Type = ddl_type.SelectedValue;
                entity.Content = txt_details.Text;
                entity.CreateTime = DateTime.Now;
                entity.PublishPeople = GetPeopleEditorValue();//发布人
                entity.Draft = chk_isdrapt.Checked;
                entity.IssuedTime = dtc_activityendtime.SelectedDate;
                entity.IsVote = chk_isvote.Checked;
                entity.PublishPart = txt_Part.Text;
                entity.PublishTime = dtc_publishtime.SelectedDate;
                entity.Title = txt_title.Text;
                entity.ToTop = chk_istop.Checked;
                entity.ToTopUntilTime = dtc_topendtime.SelectedDate;
                int num = bao.updateInfo(entity);
                if (num > 0)
                {
                    int ID = CustomerConvert.ConvertNullToInt(Request.QueryString["ID"]);
                    string[] arr = HiddenField1.Value.Split(',');
                    for (int i = 0; i < arr.Length; i++)
                    {
                        if (arr[i] != "")
                        {
                            bao.UpdatePicsSetIDs(CustomerConvert.ConvertNullToInt(arr[i]), );
                        }
                    }
                    if (entity.Draft == true || Convert.ToDateTime(entity.PublishTime) > DateTime.Now)
                    {
                        Commion.Shssage(this.Page, "", PageUrl);
                    }
                    else
                    {
                        Commonon.wMeage(this.Page, "", PageUrl);
                    }
                }
                else
                {
                    Common.sage(this.Page, "发布数据失败");
                }
            }
            private string GetPeopleEditorValue()
            {
                string strResult = string.Empty;
                ArrayList list = txt_Name.ResolvedEntities;
                foreach (Microsoft.SharePoint.WebControls.PickerEntity p in list)
                {
                    if (p.EntityData["SPUserID"].ToString() != "")
                    {
                        string userId = p.EntityData["SPUserID"].ToString();
                        string DisplayName = p.DisplayText.ToString();
                        strResult += userId + ";#" + DisplayName;
                        strResult += ",";
                    }
                }
                return strResult;
            }
            private void ddl_TypeBind()
            {
                ddl_type.Items.Clear();
                bao = new BAO(string.Empty);
                List<string> list = new List<string>();
                list = bao.GeTypeList(TypeName);
                foreach (string type in list)
                {
                    ddl_type.Items.Add(new ListItem(type, type));
                }
            }
            protected void btn_Cancel_Click(object sender, EventArgs e)
            {
                if (Request.QueryString["Source"] != null)
                {
                    Response.Redirect(Request.QueryString["Source"]);
                }
                else
                {
                    Response.Redirect(PageUrl);
                }
            }
            protected string GetPublisher()
            {
                string publisher = "";
                if (GetPeopleEditorValue() != "")
                {
                    string[] arr = GetPeopleEditorValue().Split(',');
                    for (int i = 0; i < arr.Length; i++)
                    {
                        if (arr[i] != "")
                        {
                            string[] sArr = arr[i].Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries);
                            publisher += sArr[1] + "  ";
                        }
                    }
                }
                return publisher;
            }
            protected string GetPublishDate()
            {
                if (dtc_publishtime.SelectedDate != null)
                {
                    return dtc_publishtime.SelectedDate.ToShortDateString();
                }
                else
                {
                    return "";
                }
            }
            protected string GetContent()
            {
                return txt_details.Text.ToString();
            }
        }
    }
    
  • 相关阅读:
    Wedge 100-32X 100GbE Data Center Switch
    openstack参考资料
    进程调度
    进程管理 之 基本概念
    Linux设备驱动程序 之 中断和锁
    Linux设备驱动程序 之 工作队列
    Linux设备驱动程序 之 tasklet
    Linux设备驱动程序 之 软中断
    Linux设备驱动程序 之 中断下半部
    Linux设备驱动 之 中断处理程序
  • 原文地址:https://www.cnblogs.com/TNSSTAR/p/2853029.html
Copyright © 2020-2023  润新知