Beispiel #1
0
    protected void BtnEdit_Click(object sender, EventArgs e)
    {
        this.dgEquipment.EditItemIndex = int.Parse(this.HdnSelectedIndex.Value);
        ConferenceInfoCollection dt = this.dgEquipment_GetData();

        this.dgEquipment_Bind(dt);
    }
Beispiel #2
0
        public static int UpdateEquipment(ConferenceInfoCollection tc, int meetingroomId)
        {
            string sqlString = " ";

            if (tc.Count > 0)
            {
                for (int i = 0; i < tc.Count; i++)
                {
                    int recordID = tc[i].RecordID;
                    if (QueryApplyEquipmentList(recordID) > 0)
                    {
                        sqlString = ((((((sqlString + " update OA_MeetingRoom_Equipment Set MeetingRoomID = " + tc[i].MeetingRoomID) + ", EquipmentName = '" + tc[i].EquipmentName + "' ") + ", Model = '" + tc[i].EquipmentName + "' ") + ", Number = " + tc[i].Number) + ", Content = '" + tc[i].Content + "' ") + ", IsValid = '" + tc[i].IsValid + "' ") + " where RecordID = " + recordID.ToString();
                    }
                    else
                    {
                        object obj2 = (sqlString + " delete from OA_MeetingRoom_Equipment where RecordID = " + recordID.ToString()) + " insert into OA_MeetingRoom_Equipment(MeetingRoomID,EquipmentName,Model,Number,Content,IsValid) " + " values( ";
                        object obj3 = (string.Concat(new object[] { obj2, " ", tc[i].MeetingRoomID, ", " }) + " '" + tc[i].EquipmentName + "', ") + " '" + tc[i].Model + "', ";
                        sqlString = ((string.Concat(new object[] { obj3, " ", tc[i].Number, ", " }) + " '" + tc[i].Content + "', ") + " '" + tc[i].IsValid + "' ") + " ) ";
                    }
                }
            }
            try
            {
                publicDbOpClass.ExecSqlString(sqlString);
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Beispiel #3
0
    protected void BtnDel_Click(object sender, EventArgs e)
    {
        this.dgEquipment.EditItemIndex = -1;
        ConferenceInfoCollection conferenceInfoCollection = this.dgEquipment_GetData();

        conferenceInfoCollection.RemoveAt(int.Parse(this.HdnSelectedIndex.Value));
        this.dgEquipment_Bind(conferenceInfoCollection);
    }
Beispiel #4
0
    protected int Update()
    {
        ConferenceInfoCollection tc = this.dgEquipment_GetData();

        if (ConferenceManage.UpdateEquipment(tc, this.RecordId) == 1)
        {
            return(1);
        }
        return(0);
    }
Beispiel #5
0
    protected void BtnAdd_Click(object sender, EventArgs e)
    {
        ConferenceInfoCollection conferenceInfoCollection = this.dgEquipment_GetData();

        conferenceInfoCollection.Insert(0, new ConferenceInfo
        {
            MeetingRoomID = this.MeetingroomID,
            IsValid       = "y",
            EquipmentName = string.Empty,
            Model         = string.Empty,
            Number        = 0,
            Content       = string.Empty
        });
        this.dgEquipment.EditItemIndex = 0;
        this.dgEquipment_Bind(conferenceInfoCollection);
    }
Beispiel #6
0
        public static ConferenceInfoCollection GetEquipment(int meetingroomId)
        {
            ConferenceInfoCollection infos = new ConferenceInfoCollection();
            string str = "";

            using (DataTable table = publicDbOpClass.DataTableQuary(str + "select * from OA_MeetingRoom_Equipment where MeetingRoomID=" + meetingroomId.ToString()))
            {
                if (table.Rows.Count <= 0)
                {
                    return(infos);
                }
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    infos.Add(GetEquipmentFromDataRow(table.Rows[i]));
                }
            }
            return(infos);
        }
Beispiel #7
0
    private ConferenceInfoCollection dgEquipment_GetData()
    {
        ConferenceInfoCollection conferenceInfoCollection = (ConferenceInfoCollection)this.Session["DataTable"];

        for (int i = this.dgEquipment.Items.Count - 1; i >= 0; i--)
        {
            DataGridItem dataGridItem = this.dgEquipment.Items[i];
            switch (dataGridItem.ItemType)
            {
            case ListItemType.Item:
            case ListItemType.AlternatingItem:
                if (((Label)dataGridItem.Cells[2].FindControl("lbEquipmentName")).Text.ToString() != "")
                {
                    conferenceInfoCollection[i].MeetingRoomID = this.MeetingroomID;
                    conferenceInfoCollection[i].IsValid       = "y";
                    conferenceInfoCollection[i].EquipmentName = ((Label)dataGridItem.Cells[1].FindControl("lbEquipmentName")).Text;
                    conferenceInfoCollection[i].Model         = ((Label)dataGridItem.Cells[2].FindControl("lbModel")).Text;
                    conferenceInfoCollection[i].Number        = Convert.ToInt32((((Label)dataGridItem.Cells[3].FindControl("lbNumber")).Text == "") ? "0" : ((Label)dataGridItem.Cells[3].FindControl("lbNumber")).Text);
                    conferenceInfoCollection[i].Content       = ((Label)dataGridItem.Cells[4].FindControl("lbContent")).Text;
                }
                break;

            case ListItemType.EditItem:
                if (((TextBox)dataGridItem.Cells[2].FindControl("txtEquipmentName")).Text.ToString() != "")
                {
                    conferenceInfoCollection[i].MeetingRoomID = this.MeetingroomID;
                    conferenceInfoCollection[i].IsValid       = "y";
                    conferenceInfoCollection[i].EquipmentName = ((TextBox)dataGridItem.Cells[1].FindControl("txtEquipmentName")).Text;
                    conferenceInfoCollection[i].Model         = ((TextBox)dataGridItem.Cells[2].FindControl("txtModel")).Text;
                    conferenceInfoCollection[i].Number        = Convert.ToInt32((((TextBox)dataGridItem.Cells[3].FindControl("txtNumber")).Text == "") ? "0" : ((TextBox)dataGridItem.Cells[3].FindControl("txtNumber")).Text);
                    conferenceInfoCollection[i].Content       = ((TextBox)dataGridItem.Cells[4].FindControl("txtContent")).Text;
                }
                break;
            }
        }
        return(conferenceInfoCollection);
    }
Beispiel #8
0
 protected void dgEquipment_Bind(ConferenceInfoCollection dt)
 {
     this.dgEquipment.DataSource = dt;
     this.Session["DataTable"]   = dt;
     this.dgEquipment.DataBind();
 }
Beispiel #9
0
    protected void Bind()
    {
        ConferenceInfoCollection equipment = ConferenceManage.GetEquipment(this.MeetingroomID);

        this.dgEquipment_Bind(equipment);
    }