protected void lnkSaveDesignation_Click(object sender, EventArgs e) { var designations = new Designations(); foreach (GridViewRow gvRow in GridViewTable.Rows) { designations.Add(new Designation { Id = ((TextBox)gvRow.FindControl("txtCode")).Text, Description = ((TextBox)gvRow.FindControl("txtDescription")).Text, Level = ((TextBox)gvRow.FindControl("txtAccess")).Text, Action = (string.IsNullOrEmpty((((HiddenField)gvRow.FindControl("hdnAction")).Value)) ? Constants.UpdateAction : ((HiddenField)gvRow.FindControl("hdnAction")).Value), SlNo = ((HiddenField)gvRow.FindControl("hdnSno")).Value, CreatedDate = Dates.ToDateTime(((HiddenField)gvRow.FindControl("hidCreatedDate")).Value, DateFormat.Format_05) }); } var firstOrDefault = designations.FirstOrDefault(); if (firstOrDefault != null) { firstOrDefault.DataBaseInfo = UserContext.DataBaseInfo; } if (_controlPanel.SetDesignation(designations)) { CustomMessageControl.MessageBodyText = GlobalCustomResource.DesignationSaved; CustomMessageControl.MessageType = MessageTypes.Success; CustomMessageControl.ShowMessage(); AuditLog.LogEvent(UserContext, SysEventType.INFO, "DESIGNATION SAVED", GlobalCustomResource.DesignationSaved, true); lnkAddNew.Enabled = true; lnkAddNew.Style.Add("cursor", "Pointer"); BindData(BindType.List); } else { CustomMessageControl.MessageBodyText = GlobalCustomResource.DesignationFailed; CustomMessageControl.MessageType = MessageTypes.Error; CustomMessageControl.ShowMessage(); AuditLog.LogEvent(UserContext, SysEventType.INFO, "DESIGNATION UPDATE FAILED", GlobalCustomResource.DesignationFailed, true); } }