private void txtEnter_Click(object sender, EventArgs e) { string check = checkData(); if (check != null) { MessageBox.Show(check); return; } UsersBS isb = new UsersBS(); UsersEntity entity = new UsersEntity(); string userName = txtUserName.Text; string password = txtPassword.Text; entity = isb.checkUser(userName, password, _checkJustManager); int userCount = entity.Tables[entity.FilledTableName].Rows.Count; if (userCount > 0) { UsersBS.loginedUser = entity; UsersBS.LogginedUserProperties = new UserpropertiesBL().get(int.Parse(entity.get(UsersEntity.FIELD_ID).ToString())); _loggined = true; this.Hide(); } else { MessageBox.Show("نام کاربر یا کلمه عبور معتبر نیست! چنین کاربری یافت نشد!"); } }
private void txtEnter_Click(object sender, EventArgs e) { string check = checkData(); if (check != null) { MessageBox.Show(check); return; } UsersBS isb = new UsersBS(); UsersData userData = new UsersData(); string userName = txtUserName.Text; string password = txtPassword.Text; userData = isb.checkUser(userName, password, _checkJustManager); int userCount = userData.Tables[UsersData.users_TABLE].Rows.Count; if (userCount > 0) { UsersBS.loginedUser = userData; _loggined = true; this.Hide(); } else { MessageBox.Show("نام کاربر یا کلمه عبور معتبر نیست"); } }
public UserForm() { InitializeComponent(); _usersBs = new UsersBS(); _gridTools = new GridTools(); fillCombo(); }
public UserList() { _gridTools = new GridTools(); InitializeComponent(); _usersBS = new UsersBS(); }
private void btnUpdate_Click(object sender, EventArgs e) { string check = checkData(); if (check != null) { MessageBox.Show(check); return; } if (dataGridView1.RowCount <= 0) { dataMode = NEW_MODE; } UsersBS isb = new UsersBS(); UsersData inData = new UsersData(); DataRow dr = inData.Tables[UsersData.users_TABLE].NewRow(); dr[UsersData.name_FIELD] = txtName.Text; dr[UsersData.family_FIELD] = txtFamily.Text; dr[UsersData.userName_FIELD] = txtUserName.Text; dr[UsersData.password_FIELD] = txtPassword.Text; dr[UsersData.userType_FIELD] = cmbUserType.SelectedIndex; if (!dataMode.Equals(NEW_MODE)) { dr[UsersData.id_FIELD] = _gridTools.getCurrentRowValue(UsersData.id_FIELD); } object id = _gridTools.getCurrentRowValue(UsersData.id_FIELD); inData.Tables[UsersData.users_TABLE].Rows.Add(dr); int count; if (dataMode.Equals(NEW_MODE)) { count = isb.add(inData); } else if (dataMode.Equals(EDIT_MODE)) { count = isb.update(inData); } dataMode = EDIT_MODE; btnRefresh_Click(null, null); fillGrid(); }
private ArrayList getReffers(DateTime fromDate, DateTime toDate) { ArrayList list = new ArrayList(); UsersEntity usersEntity = new UsersBS().get(""); for (int i = 0; i < usersEntity.RowCount(); i++) { object[] arr = new object[3]; arr[0] = usersEntity.ToString(i); arr[1] = getRefferFromCount(int.Parse(usersEntity.get(i, UsersEntity.FIELD_ID).ToString()), fromDate, toDate); arr[2] = getRefferToCount(int.Parse(usersEntity.get(i, UsersEntity.FIELD_ID).ToString()), fromDate, toDate); list.Add(arr); } return(list); }
private void fillUserList() { UsersData dataSet = new UsersBS().load(); if (dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0) { for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++) { ComboBoxItem item = new ComboBoxItem(); string name = dataSet.Tables[0].Rows[i][UsersData.name_FIELD].ToString(); string family = dataSet.Tables[0].Rows[i][UsersData.family_FIELD].ToString(); int id = int.Parse(dataSet.Tables[0].Rows[i][UsersData.indexField].ToString()); item.Value = id; item.Name = name + " " + family; lstUserList.Items.Add(item); //lstUserList.DataSource = dataSet.Tables[UsersData.users_TABLE]; //lstUserList.DisplayMember = UsersData.family_FIELD; //lstUserList.ValueMember = UsersData.id_FIELD; } } }
public void init() { if (LetterBL.LETTER_TYPE_SEND.Equals(_letterType)) { txtRecievedLetterDate.Enabled = false; txtRecLetterDateTo.Visible = false; txtRecievedLetterNumber.Visible = false; lblRecievedLetterDate.Visible = false; lblRecievedLetterNumber.Visible = false; pnlRecLetterDate.Visible = false; cmbCompareInputLetterDate.Visible = false; this.Text = "نامه صادره"; lblInputRegisterNumber.Text = "شماره ثبت ورودی : "; } else { this.Text = "نامه وارده"; lblInputRegisterNumber.Text = "شماره ثبت خروجی : "; } //BasicInfoUtil.fillComboBox(cmbInsuranceType, "InsuranceType", -1); BasicInfoUtil.fillCheckBoxList(cbListInsuranceType, "InsuranceType", -1); BasicInfoUtil.fillCheckBoxList(cmbManagemtAction, "managementAction", -1); BasicInfoUtil.fillCheckBoxList(cbLetterStateId, "LetterState", -1); UsersBS.fillCheckedListWithUsers(cbReferenceUserId, -1); UsersBS.fillCheckedListWithUsers(cbRefferFrom, -1); cmbArchive.SelectedIndex = 0; cmbFinalConfirm.SelectedIndex = 0; cmbManagerAction.SelectedIndex = 0; cmbCompareLetterDate.SelectedIndex = 0; cmbCompareInputLetterDate.SelectedIndex = 0; cmbCompareInsuranceDate.SelectedIndex = 0; cmbCompareLetterDate_SelectedIndexChanged(cmbCompareLetterDate, null); cmbCompareInputLetterDate_SelectedIndexChanged(cmbCompareInputLetterDate, null); cmbCompareInsuranceDate_SelectedIndexChanged(cmbCompareInsuranceDate, null); }
private void initSearch() { _searchFields = new string[9]; _searchPanels = new Panel[9]; BasicInfoUtil.fillComboBox(cmbInsuranceType, "InsuranceType", -1); BasicInfoUtil.fillComboBox(cmbLetterStateId, "LetterState", -1); UsersBS.fillComboWithUsers(cmbReferenceUserId, -1); UsersBS.fillComboWithUsers(cmbRefferFrom, -1); _searchFields[0] = LetterEntity.FIELD_LETTER_NUMBER; _searchFields[1] = LetterEntity.FIELD_LETTER_DATE; _searchFields[2] = LetterEntity.FIELD_LETTER_SUBJECT; _searchFields[3] = LetterEntity.FIELD_INSURANCE_TYPE_ID + "_DESC"; _searchFields[4] = LetterEntity.FIELD_INSURANCE_DATE; _searchFields[5] = LetterEntity.FIELD_LETTER_STATE_ID + "_DESC"; _searchFields[6] = LetterEntity.VIEW_FIELD_REFERENCED_USER_ID + "_DESC"; _searchFields[7] = LetterEntity.FIELD_COMPANY_ID + "_DESC"; _searchFields[8] = LetterEntity.FIELD_REFER_FROM_USER_ID + "_DESC"; _searchPanels[00] = pnlLetterNumber; _searchPanels[01] = pnlLetterDate; _searchPanels[02] = pnlSubject; _searchPanels[03] = pnlInsurance; _searchPanels[04] = pnlInsuranceDate; _searchPanels[05] = pnlLetterState; _searchPanels[06] = pnlReferenceUser; _searchPanels[07] = pnlCompanyName; _searchPanels[08] = pnlRefferFrom; selectSearchPanel(0); cmbCompareInsuranceDate.SelectedIndex = 0; cmbCompareLetterDate.SelectedIndex = 0; cmbCompareInsuranceDate_SelectedIndexChanged(cmbCompareInsuranceDate, null); cmbCompareLetterDate_SelectedIndexChanged(cmbCompareLetterDate, null); }
private void initSearch() { _searchFields = new string[12]; _searchPanels = new Panel[12]; BasicInfoUtil.fillComboBox(cmbBankId, "Bank", -1); UsersBS.fillComboWithUsers(cmbRefferFrom, -1); UsersBS.fillComboWithUsers(cmbRefferToUser, -1); _searchFields[0] = ChequeEntity.FIELD_CHEQUE_NUMBER; _searchFields[1] = ChequeEntity.FIELD_MATURITY_DATE; _searchFields[2] = ChequeEntity.FIELD_ENTRY_DATE; _searchFields[3] = ChequeEntity.FIELD_PRICE; _searchFields[4] = ChequeEntity.VIEW_FIELD_BI_BANK_DESCRIPTION; _searchFields[5] = ChequeEntity.FIELD_ACCOUNT_HOLDER_NAME; _searchFields[6] = ChequeEntity.FIELD_ACCOUNT_NUMBER; _searchFields[7] = ChequeEntity.FIELD_DESCRIPTION; _searchFields[8] = ChequeEntity.VIEW_FIELD_PAYTYPE_DESC; _searchFields[9] = ChequeEntity.VIEW_FIELD_COMPANYNAME; _searchFields[10] = ChequeEntity.FIELD_REFER_FROM_USER_ID + "_DESC"; _searchFields[11] = ChequeEntity.VIEW_FIELD_USERNAME; _searchPanels[00] = pnlChequeNumber; _searchPanels[01] = pnlMaturityDate; _searchPanels[02] = pnlEntryDate; _searchPanels[03] = pnlPrice; _searchPanels[04] = pnlBank; _searchPanels[05] = pnlAccountHolderName; _searchPanels[06] = pnlAccountNumber; _searchPanels[07] = pnlDescription; _searchPanels[08] = pnlPayType; _searchPanels[09] = pnlCompanyName; _searchPanels[10] = pnlRefferFrom; _searchPanels[11] = pnlRefferToUser; selectSearchPanel(0); }
private void load() { int userype = int.Parse(UsersBS.loginedUser.Tables[UsersData.users_TABLE].Rows[0][UsersData.userType_FIELD] + ""); if (userype == UsersBS.USER) { MessageBox.Show("فقط مدیر سیستم می تواند این فرم را مشاهده کند"); this.Close(); } UsersBS usersbs = new UsersBS(); UsersData usersData = usersbs.loadNonManagers(); for (int i = 0; i < usersData.Tables[0].Rows.Count; i++) { int id = int.Parse(usersData.Tables[0].Rows[i][UsersData.id_FIELD].ToString()); string name = usersData.Tables[0].Rows[i][UsersData.name_FIELD].ToString().Trim() + " " + usersData.Tables[0].Rows[i][UsersData.family_FIELD].ToString().Trim(); string username = usersData.Tables[0].Rows[i][UsersData.userName_FIELD].ToString().Trim(); name += "(" + username + ")"; cmbUserList.Items.Add(new CmbUserItem(id, name)); } }
public UsersTreeForm() { _userTreeBL = new UserTreeBL(); _usersBS = new UsersBS(); InitializeComponent(); }
public void init() { BasicInfoUtil.fillCheckBoxList(cbReferAction, "ReferenceCycleAction", -1); UsersBS.fillCheckedListWithUsers(cbRefferFrom, -1); }
public void initForm() { cmbPayType.Items.Clear(); ComboBoxItem item = new ComboBoxItem("چک", "0"); cmbPayType.Items.Add(item); item = new ComboBoxItem("نقد", "1"); cmbPayType.Items.Add(item); int bankid = 0; int companyId = 0; DateConverter converter = new DateConverter(); if (_id > 0) { ChequeEntity entity = _chequeBL.get(_id); if (entity.get(ChequeEntity.FIELD_PAY_TYPE).ToString().Length > 0) { if (((bool)entity.get(ChequeEntity.FIELD_PAY_TYPE)) == true) { cmbPayType.SelectedIndex = 1; } else { cmbPayType.SelectedIndex = 0; } } else { cmbPayType.SelectedIndex = -1; lblCbArchive.Visible = false; cbArchive.Visible = false; } if (entity.get(ChequeEntity.FIELD_USER_TREE_ID).ToString().Length > 0) { _userTreeId = int.Parse(entity.get(ChequeEntity.FIELD_USER_TREE_ID).ToString()); } txtChequeNumber.Text = entity.get(ChequeEntity.FIELD_CHEQUE_NUMBER).ToString(); txtMaturityDate.Text = converter.valueToString(entity.get(ChequeEntity.FIELD_MATURITY_DATE)); txtEntryDate.Text = converter.valueToString(entity.get(ChequeEntity.FIELD_ENTRY_DATE)); txtRefferDate.Text = converter.valueToString(entity.get(ChequeEntity.FIELD_REFFER_DATE)); txtPrice.Text = entity.get(ChequeEntity.FIELD_PRICE).ToString(); txtAccountNumber.Text = entity.get(ChequeEntity.FIELD_ACCOUNT_NUMBER).ToString(); txtInsuranceNumber.Text = entity.get(ChequeEntity.FIELD_INSURANCE_NUMBER).ToString(); txtAccountHolderName.Text = entity.get(ChequeEntity.FIELD_ACCOUNT_HOLDER_NAME).ToString(); //txtDescription.Text = entity.get(ChequeEntity.FIELD_DESCRIPTION).ToString(); txtRegistrantUser.Text = UsersBS.loginedUser.ToString(); if (entity.get(ChequeEntity.FIELD_BANK_ID).ToString().Length > 0) { bankid = int.Parse(entity.get(ChequeEntity.FIELD_BANK_ID).ToString()); } txtCompany.Tag = 0; if (entity.get(ChequeEntity.FIELD_COMPANY_ID).ToString().Length > 0) { txtCompany.Tag = (int)entity.get(ChequeEntity.FIELD_COMPANY_ID); txtCompany.Text = CompanyBL.getCompanyName((int)txtCompany.Tag); } cbArchive.Checked = (Boolean)("".Equals(entity.get(ChequeEntity.FIELD_ARCHIVE).ToString()) ? false : entity.get(ChequeEntity.FIELD_ARCHIVE)); if (entity.get(ChequeEntity.FIELD_INSURANCE_COMPANY).ToString().Length > 0) { companyId = int.Parse(entity.get(ChequeEntity.FIELD_INSURANCE_COMPANY).ToString()); } UsersBS usersBs = new UsersBS(); string s = ""; int id = -1; if (entity.get(ChequeEntity.FIELD_REGISTRANT_USER).ToString().Length > 0) { UsersEntity ue = usersBs.get(int.Parse(entity.get(ChequeEntity.FIELD_REGISTRANT_USER).ToString())); if (ue.Tables[ue.FilledTableName].Rows.Count <= 0) { s = UsersBS.loginedUser.ToString(); id = int.Parse(UsersBS.loginedUser.get(UsersEntity.FIELD_ID).ToString()); } else { s = ue.ToString(); id = int.Parse(ue.get(UsersEntity.FIELD_ID).ToString()); } } else { s = UsersBS.loginedUser.ToString(); id = int.Parse(UsersBS.loginedUser.get(UsersEntity.FIELD_ID).ToString()); } txtRegistrantUser.Text = s; txtRegistrantUser.Tag = id; if (entity.get(ChequeEntity.FIELD_REGISTER_DATE) != null && entity.get(ChequeEntity.FIELD_REGISTER_DATE).ToString().Length > 0) { txtRegisterDate.Text = converter.valueToString(entity.get(ChequeEntity.FIELD_REGISTER_DATE)); } else { txtRegisterDate.Text = converter.valueToString(DateTime.Now); } cmbReferenceUserId.Visible = false; lblReferenceUserId.Visible = false; } else { //lblChqueReply.Visible = false; tblReply.Visible = false; txtRegistrantUser.Tag = UsersBS.loginedUser.get(UsersEntity.FIELD_ID); txtRegistrantUser.Text = UsersBS.loginedUser.ToString(); txtRegisterDate.Text = converter.valueToString(DateTime.Now); cmbReferenceUserId.Visible = true; lblReferenceUserId.Visible = true; fillUserRefferenceCombo(-1); txtCompany.Tag = 0; } BasicInfoUtil.fillComboBox(cmbInsuranceCompany, "InsuranceCompany", companyId); BasicInfoUtil.fillComboBox(cmbBankId, "Bank", bankid); initList(); if (readOnly == true) { btnSave.Enabled = false; btnReferToMasterUser.Enabled = false; } setPermision(); if (_id < 0) { linkAttachment.Visible = false; } }