private void UserUpdate(string Id) { string data = ""; if (rdoCityLocation.SelectedItem.Value == "SC") { ubal.CityName = Convert.ToString(ViewState["city1"]); } else if (rdoCityLocation.SelectedItem.Value == "DC") { if (cmbCity.SelectedValue != null) { ubal.CityName = Convert.ToString(cmbCity.SelectedItem.Text); } else { ubal.CityName = Convert.ToString(ViewState["city1"]); } } ///////////////////////////////////////////// if (ddlRole.SelectedValue == "34" || ddlRole.SelectedValue == "35" || ddlRole.SelectedValue == "36") { if (ddlmenselection.SelectedValue == "1") { ubal.RoleName1 = Convert.ToString(ddlRole.SelectedItem.Text) + "-Public"; ubal.RoleId1 = Convert.ToInt32(ddlRole.SelectedValue); //string roleid = Convert.ToString(ubal.RoleId1); //unusable code //ubal.RoleId1 = Convert.ToInt32(roleid); } else if (ddlmenselection.SelectedValue == "2") { ubal.RoleName1 = Convert.ToString(ddlRole.SelectedItem.Text) + "-Govt"; ubal.RoleId1 = Convert.ToInt32(ddlRole.SelectedValue); //string roleid = Convert.ToString(ubal.RoleId1); //unusable code //ubal.RoleId1 = Convert.ToInt32(roleid); } } else { ubal.RoleName1 = Convert.ToString(ddlRole.SelectedItem.Text); ubal.RoleId1 = Convert.ToInt32(ddlRole.SelectedValue); } //ubal.RoleName1 = Convert.ToString(ddlRole.SelectedItem.Text); ///////////////////////////////////////// ubal.MONO = Convert.ToString(Session["Mobile"]); ubal.Date = Convert.ToString(cc.ChangeDate(txtDOB.Text)); string rolename = Convert.ToString(ViewState["RoleName"]); string rolename1 = ddlRole.SelectedItem.Text; if (rolename1 == rolename) { ubal.RoleId1 = Convert.ToInt16(ViewState["rid"]); } else { ubal.RoleId1 = Convert.ToInt32(ddlRole.SelectedValue); } ubal.Id = Convert.ToString(ViewState["uid1"]); ubal.MID = Convert.ToInt32(ViewState["tbleid"]); status = ubal.updateUser(ubal); if (status > 0) { if (ddlRole.SelectedValue == "29") { ubal.RoleName1 = Convert.ToString(ddlRole.SelectedItem.Text); ubal.MONO = Convert.ToString(Session["Mobile"]); ubal.Date = Convert.ToString(cc.ChangeDate(txtDOB.Text)); ubal.RoleId1 = Convert.ToInt32(ddlRole.SelectedValue); for (int i = 0; i < chkCommitee.Items.Count; i++) { if (chkCommitee.Items[i].Selected == true) { data = data + "," + chkCommitee.Items[i].Value; } } if (data.Length > 1) { data = data.Substring(1); } ubal.Id = Convert.ToString(ViewState["User"]); ubal.Committeeid = data; status = ubal.BLLGetUserId(ubal); if (status > 0) { status = ubal.BLLUpdateUserCommittee(ubal); } else { status = ubal.BLLinsertUserCommittee(ubal); } } else if (ddlRole.SelectedValue == "28") { data = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31"; ubal.Id = Convert.ToString(ViewState["User"]); ubal.Committeeid = data; status = ubal.BLLGetUserId(ubal); if (status > 0) { status = ubal.BLLUpdateUserCommittee(ubal); } else { status = ubal.BLLinsertUserCommittee(ubal); } } else { // changes by poonam - 7 aug-2013 for update AdminSubMarketingSubUser this table string sql1 = "select usrUserid from usermaster where usrMobileNo='" + Convert.ToString(Session["MobileNumber"]) + "'"; string id = cc.ExecuteScalar(sql1); if (id != "") { string sql = "Update AdminSubMarketingSubUser set userid='" + id + "' ,roleid='" + ddlRole.SelectedValue + "',rolename='" + ddlRole.SelectedItem.Text + "',reference_id1='" + id + "' where [friendid]='" + Convert.ToString(ViewState["User"]) + "' "; int a = cc.ExecuteNonQuery(sql); if (a == 1) { string Sql = "Update UserMaster set IsMarketingPerson='Y' where UsrUserId='" + Convert.ToString(ViewState["User"]) + "'"; cc.ExecuteNonQuery(Sql); ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('This Marketing Person Updated Successfully')", true); Response.Redirect("../MarketingAdmin/UserList.aspx"); //HttpContext.Current.ApplicationInstance.CompleteRequest(); } } } } }