Prasad Bhagat

Prasad Bhagat

  • NA
  • 516
  • 226.2k

how to ristrict a user having more than 10 records in grid

Nov 25 2014 6:38 AM
Dear all
 
just find my problem 
 
 
 
 in the above screen i want ristrict a recruiter having more than 10 requirements for that i have code
give bellow
 
 
int selCount = 0;
GatewayEntities gt = new GatewayEntities();
int reqId = Convert.ToInt32(Request.QueryString[0]);
CheckBox chk = new CheckBox();
Label lblId = new Label();
foreach (GridViewRow row in gvRef.Rows)
{
chk = (CheckBox)row.FindControl("chk");
lblId = (Label)row.FindControl("lblId");
// tbl_param_requirement_assigning obj = new tbl_param_requirement_assigning();
if (chk.Checked == true)
{
//assign method

selCount = selCount + 1;
tbl_param_requirement_assigning obj = new tbl_param_requirement_assigning();
obj.requirement_id = Convert.ToInt32(Request.QueryString[0]);
obj.assigned_to = Convert.ToInt32(lblId.Text);
obj.assigned_date = utl.InDateTime();
obj.assigned_by = objUser.GetUserIdByName(Page.User.Identity.Name);
obj.IsActive = true;
int temp = objReq.GetAssignTaskOrNot(obj.requirement_id, obj.assigned_to);
if (temp == 0)
gt.tbl_param_requirement_assigning.Add(obj);
}

else
{
tbl_param_requirement_assigning obj = new tbl_param_requirement_assigning();
int? loginUserId = objUser.GetUserIdByName(Page.User.Identity.Name);
obj.requirement_id = Convert.ToInt32(Request.QueryString[0]);
obj.assigned_to = Convert.ToInt32(lblId.Text);
objReq.DeAssignedTask(obj.requirement_id, obj.assigned_to, loginUserId);
obj = null;
}

//lblconfirmmsg.Text = "Successfully De-Assigned";
gt.SaveChanges();
lblmessage.Text = "Successfully Assigned";
mpe.Show();
//mpe.Show();

}
var temp1 = gt.tbl_param_requirement_master.Where(ef => ef.id == reqId).SingleOrDefault();
if (temp1.opening_status == 1)
temp1.opening_status = 2;
//if (selCount >= 10)
//{
// lblmessage.Text = "This recruiter Reched mninmum requriements";
// mpe.Show();
//}
if (selCount == 0)
{
temp1.status = 1;
lblmessage.Text = "Select Any One Recruiter";
mpe.Show();
}
gt.SaveChanges();
LoadRequiredment(Convert.ToInt32(Request.QueryString[0]));
// lblmessage.Text = "Opening Assigned Successfully";
// mpe.Show();
 
 
so aneyone help me please
 

Answers (1)