/// <summary> /// 创建新的操作员 /// </summary> /// <param name="uc01"></param> /// <param name="rolesarry"></param> /// <returns></returns> public static int CreateOperator(Uc01 uc01, string[] rolesarry) { //用户编号 OracleParameter op_uc001 = new OracleParameter("ic_uc001", OracleDbType.Varchar2, 10); op_uc001.Direction = ParameterDirection.Input; op_uc001.Value = uc01.uc001; //用户代码 OracleParameter op_uc002 = new OracleParameter("ic_uc002", OracleDbType.Varchar2, 50); op_uc002.Direction = ParameterDirection.Input; op_uc002.Value = uc01.uc002; //用户姓名 OracleParameter op_uc003 = new OracleParameter("ic_uc003", OracleDbType.Varchar2, 50); op_uc003.Direction = ParameterDirection.Input; op_uc003.Value = uc01.uc003; //用户密码 OracleParameter op_uc004 = new OracleParameter("ic_uc004", OracleDbType.Varchar2, 50); op_uc004.Direction = ParameterDirection.Input; op_uc004.Value = uc01.uc004; //用户角色数组 OracleParameter op_roles_arry = new OracleParameter("ic_roles", OracleDbType.Varchar2, 500); op_roles_arry.Direction = ParameterDirection.Input; op_roles_arry.Value = string.Join("|", rolesarry); return(SqlAssist.ExecuteProcedure("pkg_business.prc_CreateOperator", new OracleParameter[] { op_uc001, op_uc002, op_uc003, op_uc004, op_roles_arry })); }
private void b_ok_Click(object sender, EventArgs e) { string s_userCode, s_pwd; s_userCode = textEdit_user.Text; s_pwd = textEdit_pwd.Text; if (string.IsNullOrEmpty(s_userCode)) { MessageBox.Show("请输入用户代码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); textEdit_user.Focus(); return; } if (string.IsNullOrEmpty(s_pwd)) { MessageBox.Show("请输入密码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); textEdit_pwd.Focus(); return; } ///////////////////// 检索 密码 /////////////////////////////// Uc01_dao uc01_dao = new Uc01_dao(); Uc01 uc01 = uc01_dao.GetSingle(s => s.uc002 == s_userCode && s.status == "1"); if (uc01 == null) { textEdit_user.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight; textEdit_user.ErrorText = "用户不存在!"; return; } else if (Tools.EncryptWithMD5(s_pwd) != uc01.uc004) { textEdit_pwd.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight; textEdit_pwd.ErrorText = "密码错误!"; return; } else { Envior.cur_userId = uc01.uc001; Envior.cur_userName = uc01.uc003; //Envior.cur_userBosi = uc01.uc007; //博思账号 //Envior.cur_pwdBosi = uc01.uc008; //博思密码 Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings["lastusername"].Value = s_userCode; config.Save(ConfigurationSaveMode.Modified); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// DialogResult = DialogResult.OK; this.Close(); } }
/// <summary> /// 创建新用户 /// </summary> /// <returns></returns> private int CreateOperator(Uc01 uc01, string[] rolesarry) { //用户编号 OracleParameter op_uc001 = new OracleParameter("ic_uc001", OracleDbType.Varchar2, 10); op_uc001.Direction = ParameterDirection.Input; op_uc001.Value = uc01.uc001; //用户代码 OracleParameter op_uc002 = new OracleParameter("ic_uc002", OracleDbType.Varchar2, 50); op_uc002.Direction = ParameterDirection.Input; op_uc002.Value = uc01.uc002; //用户姓名 OracleParameter op_uc003 = new OracleParameter("ic_uc003", OracleDbType.Varchar2, 50); op_uc003.Direction = ParameterDirection.Input; op_uc003.Value = uc01.uc003; //用户密码 OracleParameter op_uc004 = new OracleParameter("ic_uc004", OracleDbType.Varchar2, 50); op_uc004.Direction = ParameterDirection.Input; op_uc004.Value = uc01.uc004; //是否允许开票 OracleParameter op_uc005 = new OracleParameter("ic_uc005", OracleDbType.Varchar2, 3); op_uc005.Direction = ParameterDirection.Input; op_uc005.Value = uc01.uc005; //映射开票人 OracleParameter op_uc009 = new OracleParameter("ic_uc009", OracleDbType.Varchar2, 50); op_uc009.Direction = ParameterDirection.Input; op_uc009.Value = uc01.uc009; //复核人 OracleParameter op_uc010 = new OracleParameter("ic_uc010", OracleDbType.Varchar2, 50); op_uc010.Direction = ParameterDirection.Input; op_uc010.Value = uc01.uc010; //用户角色数组 OracleParameter op_roles_arry = new OracleParameter("ic_roles", OracleDbType.Varchar2, 500); op_roles_arry.Direction = ParameterDirection.Input; op_roles_arry.Value = string.Join("|", rolesarry); return(SqlAssist.ExecuteProcedure("pkg_business.prc_CreateOperator", new OracleParameter[] { op_uc001, op_uc002, op_uc003, op_uc004, op_uc005, op_uc009, op_uc010, op_roles_arry })); }
private void Frm_operator_Load(object sender, EventArgs e) { //1.设置角色列表数据源 clbx_roles.DataSource = dt_roles; clbx_roles.DisplayMember = "RO003"; clbx_roles.ValueMember = "RO001"; ro01Adapter.Fill(dt_roles); //2.检索信息 string s_uc001 = string.Empty; action = this.swapdata["action"].ToString(); if (action == "add") { this.Text = "新建"; uc01 = new Uc01(); } else if (this.swapdata["action"].ToString() == "edit") { this.Text = "编辑"; s_uc001 = this.swapdata["uc001"].ToString(); uc01 = uc01_dao.GetSingle(s => s.uc001 == s_uc001); txtedit_uc002.Text = uc01.uc002; txtedit_uc003.Text = uc01.uc003; txtedit_pwd.ReadOnly = true; txtedit_pwd2.ReadOnly = true; Ur_Mapper_dao ur_Mapper_dao = new Ur_Mapper_dao(); List <Ur_Mapper> mapper = ur_Mapper_dao.GetList(s => s.uc001 == s_uc001); if (mapper.Count > 0) { for (int i = 0; i < clbx_roles.ItemCount; i++) { string ro001 = clbx_roles.GetItemValue(i).ToString(); if (mapper.FindIndex(x => x.ro001.Equals(ro001)) >= 0) { clbx_roles.SetItemChecked(i, true); } } } } }
private void Frm_Operator_Load(object sender, EventArgs e) { clbx_roles.DataSource = ro01_ds.Ro01; clbx_roles.DisplayMember = "RO003"; clbx_roles.ValueMember = "RO001"; ro01_ds.ro01Adapter.Fill(ro01_ds.Ro01); if (this.swapdata["action"].ToString() == "add") { this.Text = "新建用户"; uc01 = new Uc01(); } else if (this.swapdata["action"].ToString() == "edit") { this.Text = "编辑用户"; s_uc001 = this.swapdata["uc001"].ToString(); uc01 = uc01_dao.GetSingle(s => s.uc001 == s_uc001); txtedit_uc002.Text = uc01.uc002; txtedit_uc003.Text = uc01.uc003; checkEdit1.EditValue = uc01.uc005; txtedit_uc009.Text = uc01.uc009; txtedit_uc010.Text = uc01.uc010; txtedit_pwd.ReadOnly = true; txtedit_pwd2.ReadOnly = true; Ur_Mapper_dao ur_Mapper_dao = new Ur_Mapper_dao(); List <Ur_Mapper> mapper = ur_Mapper_dao.GetList(s => s.uc001 == s_uc001); if (mapper.Count > 0) { for (int i = 0; i < clbx_roles.ItemCount; i++) { string ro001 = clbx_roles.GetItemValue(i).ToString(); if (mapper.FindIndex(x => x.ro001.Equals(ro001)) >= 0) { clbx_roles.SetItemChecked(i, true); } } } } }