public int AssignmentAllocation(Entity.Sales.AssignmentAllocation Model) { AssignmentAllocationDbModel DbModel = new AssignmentAllocationDbModel(); Model.CopyPropertiesTo(DbModel); return(AssignmentDataAccess.AssignmentAllocation(DbModel)); }
protected void rbtnIsLead_CheckedChanged(object sender, EventArgs e) { try { //Clear the existing selected row foreach (GridViewRow oldrow in gvAssignedEmployee.Rows) { ((RadioButton)oldrow.FindControl("rbtnIsLead")).Checked = false; } //Set the new selected row RadioButton rb = (RadioButton)sender; GridViewRow row = (GridViewRow)rb.NamingContainer; if (((CheckBox)row.FindControl("chkAssigned")).Checked) { ((RadioButton)row.FindControl("rbtnIsLead")).Checked = true; Entity.Sales.AssignmentAllocation Model = new Entity.Sales.AssignmentAllocation(); Business.Sales.Assignment Obj = new Business.Sales.Assignment(); Model.ActivityId = OpportunityId; Model.ActivityTypeId = Convert.ToInt32(ActityType.Opportunity); Model.IsActive = false; Model.EmployeeId = Convert.ToInt32(gvAssignedEmployee.DataKeys[row.RowIndex].Values[0].ToString()); Model.IsLead = true; Model.AssignedBy = null; Model.RevokedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name); int a = Obj.AssignmentAllocation(Model); } else { ((RadioButton)row.FindControl("rbtnIsLead")).Checked = false; Message.IsSuccess = false; Message.Text = "Please select an employee to assign"; Message.Show = true; } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }
protected void chkAssigned_CheckedChanged(object sender, EventArgs e) { try { Entity.Sales.AssignmentAllocation Model = new Entity.Sales.AssignmentAllocation(); Business.Sales.Assignment Obj = new Business.Sales.Assignment(); CheckBox checkBox = (CheckBox)sender; GridViewRow gridViewRow = (GridViewRow)checkBox.NamingContainer; if (checkBox.Checked) { Model.ActivityId = OpportunityId; Model.ActivityTypeId = Convert.ToInt32(ActityType.Opportunity); Model.IsActive = true; Model.EmployeeId = Convert.ToInt32(gvAssignedEmployee.DataKeys[gridViewRow.RowIndex].Values[0].ToString()); Model.IsLead = null; Model.AssignedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name); Model.RevokedBy = null; } else { Model.ActivityId = OpportunityId; Model.ActivityTypeId = Convert.ToInt32(ActityType.Opportunity); Model.IsActive = false; Model.EmployeeId = Convert.ToInt32(gvAssignedEmployee.DataKeys[gridViewRow.RowIndex].Values[0].ToString()); Model.IsLead = null; Model.AssignedBy = null; Model.RevokedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name); } int a = Obj.AssignmentAllocation(Model); } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }