public UserProfileMaster GetDataForName(UserProfileMaster LOCbject) { DataTable UserProfileMasterDataTable = new DataTable(); UserProfileMaster ReturnLOCbject = new UserProfileMaster(); object response = ""; try { string SqlQuery = "Select * from UserProfileMaster where Name='" + LOCbject.Name + "'"; UserProfileMasterDataTable = objAdaptor.FetchData(SqlQuery); //populate & return data object if (UserProfileMasterDataTable.Rows.Count > 0) { if (UserProfileMasterDataTable.Rows[0]["ID"].ToString() != "") { ReturnLOCbject.ID = int.Parse(UserProfileMasterDataTable.Rows[0]["ID"].ToString()); } } else { response = 0; } } catch { } finally { } return(ReturnLOCbject); }
public ActionResult UpdateUserRole(long userId, string userRoleName, string userEmail) { bool status = false; string errorMessage = string.Empty; try { UserProfileMaster userMaster = (from u in objAsopalavDBEntities.UserProfileMasters where u.Login_Id == userId && u.Primary_Email == userEmail select u).SingleOrDefault(); userMaster.RoleID = (from r in objAsopalavDBEntities.RoleMasters where r.RoleName == userRoleName select r.RoleID).SingleOrDefault(); objAsopalavDBEntities.SaveChanges(); status = true; } catch (Exception) { } return(Json(new { Data = userRoleName, IsSuccess = status, ErrorMessage = errorMessage }, JsonRequestBehavior.AllowGet)); }
private void FillData(int ProfileId) { UserProfileMaster LocObject = new UserProfileMaster(); LocObject.ID = ProfileId; //UserProfileMaster ProfileMasterDataTable = VSWebBL.SecurityBL.UserProfileMasterBL.Ins.GetData(LocObject); //ProfileTextBox.Text = ProfileMasterDataTable.Name; DataTable ProfileDtlDataTable = VSWebBL.SecurityBL.UserProfileMasterBL.Ins.GetUserProfileDetailedData(LocObject); if (ProfileDtlDataTable.Rows.Count > 0) { tblServer.Style.Add("visibility", "visible"); ApplyServersButton.Style.Add("visibility", "visible"); ServerTypeComboBox.Text = ProfileDtlDataTable.Rows[0]["ServerType"].ToString(); FillProfilesGrid(ServerTypeComboBox.SelectedItem.Text); fillServersTreeList(); GridViewDataColumn column2 = ProfilesGridView.Columns["DefaultValue"] as GridViewDataColumn; for (int i = 0; i < ProfileDtlDataTable.Rows.Count; i++) { for (int j = 0; j < ProfilesGridView.VisibleRowCount; j++) { if (ProfilesGridView.GetRowValues(j, ProfilesGridView.KeyFieldName).ToString() == ProfileDtlDataTable.Rows[i]["ProfilesMasterId"].ToString()) { ProfilesGridView.Selection.SelectRow(j); ASPxTextBox txtValue = (ASPxTextBox)ProfilesGridView.FindRowCellTemplateControl(j, column2, "txtDefaultValue"); txtValue.Text = ProfileDtlDataTable.Rows[i]["DefaultValue"].ToString(); } } } } }
/// <summary> /// Call to Insert Data into UserProfileMaster /// </summary> /// <param name="LocObject">UserProfileMaster object</param> /// <returns></returns> public object InsertData(UserProfileMaster LocObject) { try { Object ReturnValue = ValidateUpdate(LocObject); DataTable value = VSWebDAL.SecurityDAL.UserProfileMasterDAL.Ins.GetDataForUserProfileByname(LocObject); if (value.Rows.Count == 0) { if (ReturnValue.ToString() == "") { return(VSWebDAL.SecurityDAL.UserProfileMasterDAL.Ins.InsertData(LocObject)); } else { return(ReturnValue); } } else { return(""); } } catch (Exception ex) { throw ex; } }
public ActionResult Signup(UserProfileMaster userProfileData) { try { if (userProfileData != null && !string.IsNullOrEmpty(userProfileData.UserName) && !string.IsNullOrEmpty(userProfileData.FirstName) && !string.IsNullOrEmpty(userProfileData.LastName) && !string.IsNullOrEmpty(userProfileData.PrimaryEmail) && !string.IsNullOrEmpty(userProfileData.MobileNumber)) { DAL.DbContextSettings.UserProfileMaster castedUserProfileData = new DAL.DbContextSettings.UserProfileMaster(); castedUserProfileData = userProfileData.GetCastedObject <DAL.DbContextSettings.UserProfileMaster>(castedUserProfileData); if (castedUserProfileData != null && !string.IsNullOrEmpty(castedUserProfileData.PrimaryEmail)) { castedUserProfileData.UserProfileId = Guid.NewGuid(); _repoUnitOfWork.SignupRepository.Add(castedUserProfileData); _repoUnitOfWork.Complete(); if (castedUserProfileData.UserProfileId != null) { DAL.DbContextSettings.LoginMaster castedLoginMaster = new DAL.DbContextSettings.LoginMaster(); castedLoginMaster = userProfileData.GetCastedObject <DAL.DbContextSettings.LoginMaster>(castedLoginMaster); castedLoginMaster.LoginMasterId = Guid.NewGuid(); castedLoginMaster.UserName = userProfileData.UserName; string _devOpsApplication = System.Configuration.ConfigurationManager.AppSettings["Key"]; string _devOpsHasTable = System.Configuration.ConfigurationManager.AppSettings["HasTable"]; string encryptedUserName = string.Empty; if (!string.IsNullOrEmpty(_devOpsApplication) && !string.IsNullOrEmpty(_devOpsHasTable)) { encryptedUserName = userProfileData.UserName.GetEncryptedPassword(_devOpsApplication, _devOpsHasTable); if (!string.IsNullOrEmpty(encryptedUserName)) { castedLoginMaster.LoginPassword = encryptedUserName; } } castedLoginMaster.UserProfileId = castedUserProfileData.UserProfileId; _repoUnitOfWork.LoginRepository.Add(castedLoginMaster); int saved = _repoUnitOfWork.Complete(); if (saved > -1) { string guidToken = castedLoginMaster.LoginMasterId.ToString(); if (!string.IsNullOrEmpty(_devOpsApplication) && !string.IsNullOrEmpty(_devOpsHasTable)) { guidToken = guidToken.GetEncryptedPassword(_devOpsApplication, _devOpsHasTable); } ExtensionMethods.SendResetPasswordLink("*****@*****.**", encryptedUserName, true, guidToken); Session["Signup"] = null; Session["SignupSuccessfully"] = "True"; return(RedirectToAction("LoginView")); } } } } else { return(View()); } } catch (Exception ex) { } return(View()); }
// get data based on location public UserProfileMaster GetDataForName(UserProfileMaster LocObject) { try { return(VSWebDAL.SecurityDAL.UserProfileMasterDAL.Ins.GetDataForName(LocObject)); } catch (Exception ex) { throw ex; } }
public DataTable GetUserProfileDetailedData(UserProfileMaster LOCbject) { try { return(VSWebDAL.SecurityDAL.UserProfileMasterDAL.Ins.GetUserProfileDetailedData(LOCbject)); } catch (Exception ex) { throw ex; } }
/// <summary> /// Call DAL Delete Data /// </summary> /// <param name="LocObject"></param> /// <returns></returns> public Object DeleteData(UserProfileMaster LocObject) { try { return(VSWebDAL.SecurityDAL.UserProfileMasterDAL.Ins.DeleteData(LocObject)); } catch (Exception ex) { throw ex; } }
protected void UserProfileView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { UserProfileMaster UserProfileobj = new UserProfileMaster(); UserProfileobj.ID = Convert.ToInt32(e.Keys[0]); VSWebBL.SecurityBL.UserProfileMasterBL.Ins.DeleteData(UserProfileobj); ASPxGridView gridview = (ASPxGridView)sender; gridview.CancelEdit(); e.Cancel = true; fillGrid(); }
/// <summary> /// Validation before submitting data for Server tab /// </summary> /// <param name="LocObject"></param> /// <returns></returns> public Object ValidateUpdate(UserProfileMaster LocObject) { Object ReturnValue = ""; try { if (LocObject.Name == null || LocObject.Name == "") { return("ER#Please enter the Profile name"); } } catch (Exception ex) { throw ex; } finally { } return(""); }
/// <summary> /// Insert data into UserProfileMaster table /// </summary> /// <param name="DSObject">UserProfileMaster object</param> /// <returns></returns> public bool InsertData(UserProfileMaster LOCbject) { bool Insert = false; try { string SqlQuery = "INSERT INTO UserProfileMaster(Name) VALUES('" + LOCbject.Name + "')"; Insert = objAdaptor.ExecuteNonQuery(SqlQuery); } catch { Insert = false; } finally { } return(Insert); }
/// <summary> /// Get all Data from UserProfileMasterDAL /// </summary> public DataTable GetAllData() { DataTable UserProfileMasterDataTable = new DataTable(); UserProfileMaster ReturnLOCbject = new UserProfileMaster(); try { string SqlQuery = "SELECT * FROM [UserProfileMaster]"; UserProfileMasterDataTable = objAdaptor.FetchData(SqlQuery); } catch { } finally { } return(UserProfileMasterDataTable); }
public DataTable GetDataForUserProfileByname(UserProfileMaster LOCbject) { DataTable UserProfileMasterDataTable = new DataTable(); try { string SqlQuery = "Select * from UserProfileMaster where Name='" + LOCbject.Name + "'"; UserProfileMasterDataTable = objAdaptor.FetchData(SqlQuery); //populate & return data object } catch { } finally { } return(UserProfileMasterDataTable); }
/// <summary> /// Update data into UserProfileMaster table /// </summary> /// <param name="LOCbject">UserProfileMaster object</param> /// <returns></returns> public Object UpdateData(UserProfileMaster LOCbject) { Object Update; try { string SqlQuery = "UPDATE UserProfileMaster SET Name='" + LOCbject.Name + "'WHERE ID = " + LOCbject.ID + ""; Update = objAdaptor.ExecuteNonQuery(SqlQuery); } catch { Update = false; } finally { } return(Update); }
private UserProfileMaster CollectDataForUserProfiles(string Mode, int id) { try { UserProfileMaster UserProfilesObject = new UserProfileMaster(); UserProfilesObject.Name = ProfileTextBox.Text;// UserProfilesRow["Name"].ToString(); if (Mode == "Update") { UserProfilesObject.ID = id;// int.Parse(UserProfilesRow["ID"].ToString()); } return(UserProfilesObject); } catch (Exception ex) { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }
/// <summary> /// Get Data from DominoServers based on Key /// </summary> public UserProfileMaster GetData(UserProfileMaster LOCbject) { DataTable UserProfileMasterDataTable = new DataTable(); UserProfileMaster ReturnLOCbject = new UserProfileMaster(); try { string SqlQuery = "Select * from UserProfileMaster where [ID]=" + LOCbject.ID.ToString(); UserProfileMasterDataTable = objAdaptor.FetchData(SqlQuery); //populate & return data object ReturnLOCbject.Name = UserProfileMasterDataTable.Rows[0]["Name"].ToString(); } catch { } finally { } return(ReturnLOCbject); }
public DataTable GetUserProfileDetailedData(UserProfileMaster LOCbject) { DataTable UserProfileMasterDataTable = new DataTable(); // UserProfileDetailed ReturnLOCbject = new UserProfileDetailed(); try { string SqlQuery = " select up.*,pm.ServerTypeId,st.ServerType from UserProfileDetailed up,ProfilesMaster pm,ServerTypes st " + " where pm.id=up.ProfilesMasterID and st.id=pm.servertypeid and UserProfileMasterID=" + LOCbject.ID.ToString(); UserProfileMasterDataTable = objAdaptor.FetchData(SqlQuery); //populate & return data object // ReturnLOCbject. = UserProfileMasterDataTable.Rows[0]["Name"].ToString(); } catch { } finally { } return(UserProfileMasterDataTable); }
//delete Data from UserProfileMaster Table public Object DeleteData(UserProfileMaster LOCbject) { Object Update; try { string SqlQuery = "Delete UserProfileMaster Where ID=" + LOCbject.ID; Update = objAdaptor.ExecuteNonQuery(SqlQuery); SqlQuery = "Delete UserProfileDetailed Where UserProfileMasterID=" + LOCbject.ID; Update = objAdaptor.ExecuteNonQuery(SqlQuery); } catch { Update = false; } finally { } return(Update); }
private void UpdateUserProfileData() { lblMessage.Text = ""; List <Object> SelectItemServerID = ProfilesGridView.GetSelectedFieldValues("ID"); if (SelectItemServerID.Count == 0) { } else { int id = int.Parse(Session["ProfileId"].ToString()); Object ReturnValue = new Object(); UserProfileMaster objUserProfile = CollectDataForUserProfiles(Session["Mode"].ToString(), id); if (Session["Mode"] == "Insert") { ReturnValue = VSWebBL.SecurityBL.UserProfileMasterBL.Ins.InsertData(objUserProfile); if (ReturnValue == "") { //ReturnValue = "Profile Already Exists"; lblMessage.Text = "Profile Already Exists";; } else { Session["Mode"] = "Update"; } } if (Session["Mode"] == "Update") { ReturnValue = VSWebBL.SecurityBL.UserProfileMasterBL.Ins.UpdateData(objUserProfile); } if (ReturnValue == "true") { UserProfileMaster rtnUserProfile = VSWebBL.SecurityBL.UserProfileMasterBL.Ins.GetDataForName(objUserProfile); UpdateProfilesGridData(rtnUserProfile.ID); } } }