コード例 #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();
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void DeleteRow(object sender, CommandEventArgs e)
 {
     if (e.CommandArgument != null)
     {
         string priKeyValue = e.CommandArgument.ToString();
         if (!string.IsNullOrEmpty(priKeyValue))
         {
             ProjectCommunicationLog biz = new ProjectCommunicationLog();
             biz.Delete(int.Parse(priKeyValue));
             // rebind to show new data
             BindCommunicationLog();
         }
     }
 }