コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveClick(object sender, EventArgs e)
        {
            // if editing last dirty row, show more
            bool rebindToEdit = dirtyRows.Contains(ReadOnlyLogRptr.Items.Count - 1);

            // update/insert "dirty" records
            foreach (int dirtyRowIndex in dirtyRows)
            {
                RepeaterItem item = ReadOnlyLogRptr.Items[dirtyRowIndex];
                // get pri key
                CaisisHidden            priKeyField = item.FindControl("CommunicationLogIdField") as CaisisHidden;
                ProjectCommunicationLog biz         = new ProjectCommunicationLog();
                // update
                if (!string.IsNullOrEmpty(priKeyField.Value))
                {
                    int priKey = int.Parse(priKeyField.Value);
                    biz.Get(priKey);
                }
                // fill Biz with field values
                CICHelper.SetBOValues(item.Controls, biz, projectId);
                // update/insert
                biz.Save();
            }
            dirtyRows.Clear();

            SetEditState(rebindToEdit);
            // rebind to reflect changes
            BindCommunicationLog();
        }