private void cmbUserList_SelectedIndexChanged(object sender, EventArgs e) { cbxAccessToArchive.Checked = false; cbxAccessToInsuranceInfo.Checked = false; cbxAccessPrintSeachResult.Checked = false; CmbUserItem useritem = (CmbUserItem)cmbUserList.Items[cmbUserList.SelectedIndex]; int userid = useritem.Id; if (userid <= 0) { //MessageBox.Show(""); } else { m_userAccessData = m_UseraccessBS.load(userid); if (m_userAccessData.Tables.Count > 0 && m_userAccessData.Tables[0].Rows.Count > 0) { string access = m_userAccessData.Tables[0].Rows[0][UsersAccessData.accessToArchive_FIELD].ToString(); cbxAccessToArchive.Checked = bool.Parse(access == null || access.Trim() == "" ? "false" : access); access = m_userAccessData.Tables[0].Rows[0][UsersAccessData.accessToInsuranceInfo_FIELD].ToString(); cbxAccessToInsuranceInfo.Checked = bool.Parse(access == null || access.Trim() == "" ? "false" : access); access = m_userAccessData.Tables[0].Rows[0][UsersAccessData.printSearchResult_FIELD].ToString(); cbxAccessPrintSeachResult.Checked = bool.Parse(access == null || access.Trim() == "" ? "false" : access); } } }
public void confirmButtonavailability() { bool b = true; UsersAccessBS uabs = new UsersAccessBS(); int userid = int.Parse(UsersBS.loginedUser.Tables[0].Rows[0][UsersData.id_FIELD].ToString()); int userType = int.Parse(UsersBS.loginedUser.Tables[0].Rows[0][UsersData.userType_FIELD].ToString()); if (userType == 1) { UsersAccessData uaData = uabs.load(userid); if (uaData == null || uaData.Tables.Count <= 0 || uaData.Tables[0].Rows.Count <= 0) { b = false; } else { b = bool.Parse(uaData.Tables[0].Rows[0][UsersAccessData.accessToInsuranceInfo_FIELD].ToString()); } } btnUpdate.Enabled = b; btnDelete.Enabled = b; btnNew.Enabled = b; btnRefresh.Enabled = b; }
public UsersAccessData load() { UsersAccessData ds = new UsersAccessData(); string query = "select * from " + UsersAccessData.usersAccess_TABLE; dp.select(query, ds, UsersAccessData.usersAccess_TABLE); //dp.loadToDataSet(UsersAccessData.users_TABLE, ds); return(ds); }
public UsersAccessData load(int userid) { UsersAccessData ds = new UsersAccessData(); string query = "select * from " + UsersAccessData.usersAccess_TABLE + " where " + UsersAccessData.userid_FIELD + "=" + userid; dp.select(query, ds, UsersAccessData.usersAccess_TABLE); //dp.loadToDataSet(UsersAccessData.users_TABLE, ds); return(ds); }
private void btnSave_Click(object sender, EventArgs e) { //user id if (cmbUserList.SelectedIndex < 0) { MessageBox.Show("لطفا یک کابر انتخاب نمایید"); return; } CmbUserItem item = (CmbUserItem)cmbUserList.Items[cmbUserList.SelectedIndex]; int userid = item.Id; if (m_userAccessData == null) { m_userAccessData = new Insurance_Common.UsersAccessData(); } DataRow dr = null; if (m_userAccessData.Tables[0].Rows.Count <= 0) { dr = m_userAccessData.Tables[UsersAccessData.usersAccess_TABLE].NewRow(); } else { dr = m_userAccessData.Tables[UsersAccessData.usersAccess_TABLE].Rows[0]; } dr[UsersAccessData.accessToArchive_FIELD] = cbxAccessToArchive.Checked; dr[UsersAccessData.accessToInsuranceInfo_FIELD] = cbxAccessToInsuranceInfo.Checked; dr[UsersAccessData.printSearchResult_FIELD] = cbxAccessPrintSeachResult.Checked; dr[UsersAccessData.userid_FIELD] = userid; if (m_userAccessData.Tables[0].Rows.Count <= 0) { m_userAccessData.Tables[UsersAccessData.usersAccess_TABLE].Rows.Add(dr); m_UseraccessBS.add(m_userAccessData); } else { m_UseraccessBS.update(m_userAccessData); } MessageBox.Show("ذخیره شد"); }
private void permissions() { string userType = UsersBS.loginedUser.Tables[UsersData.users_TABLE].Rows[0][UsersData.userType_FIELD] + ""; if (userType == "0") { return; } button2.Visible = false; UsersAccessBS bs = new UsersAccessBS(); UsersAccessData uaData = bs.load(_userId); if (uaData == null || uaData.Tables.Count <= 0 || uaData.Tables[0].Rows.Count <= 0) { return; } string access = uaData.Tables[0].Rows[0][UsersAccessData.printSearchResult_FIELD].ToString() + ""; bool b = bool.Parse(access == null || access.Trim().Equals("") ? "false" : access); button2.Visible = b; }
public void confirmButtonavailability() { if (UsersBS.loginedUser == null) { return; } button1.Enabled = true; UsersAccessBS uabs = new UsersAccessBS(); int userid = int.Parse(UsersBS.loginedUser.Tables[0].Rows[0][UsersData.id_FIELD].ToString()); int userType = int.Parse(UsersBS.loginedUser.Tables[0].Rows[0][UsersData.userType_FIELD].ToString()); if (userType == 1) { UsersAccessData uaData = uabs.load(userid); if (uaData == null || uaData.Tables.Count <= 0 || uaData.Tables[0].Rows.Count <= 0) { button1.Enabled = false; } else { button1.Enabled = bool.Parse(uaData.Tables[0].Rows[0][UsersAccessData.accessToArchive_FIELD].ToString()); } } }
public int update(UsersAccessData dataSet) { return(_usersAccessDal.update(dataSet)); }
public int add(UsersAccessData dataSet) { return(_usersAccessDal.add(dataSet)); }
public int update(UsersAccessData dataSet) { return(dp.update(dataSet, UsersAccessData.usersAccess_TABLE)); }
public int add(UsersAccessData dataSet) { return(dp.add(dataSet, UsersAccessData.usersAccess_TABLE)); }