private void Validate(Model.Operators operators) { if (string.IsNullOrEmpty(operators.OperatorName)) { throw new Helper.RequireValueException(Model.Operators.PROPERTY_OPERATORNAME); } }
private Model.Role SelectOperatorKeyTag(Model.Operators mOperators) { IList <Model.Role> roleList = this.roleManager.Select(mOperators.OperatorsId); if (roleList == null || roleList.Count == 0) { return(null); } Model.Role mRole = new Book.Model.Role(); mRole.IsCOCount = false; mRole.IsCOPrice = false; mRole.IsEmployeeBasicInfo = false; mRole.IsProductCost = false; mRole.IsSalaryViewCalc = false; mRole.IsStockCount = false; mRole.IsStockPrice = false; mRole.IsXOPrice = false; mRole.IsXOQuantity = false; foreach (Model.Role item in roleList) { if (item.IsCOCount.HasValue && item.IsCOCount.Value) { mRole.IsCOCount = true; } if (item.IsCOPrice.HasValue && item.IsCOPrice.Value) { mRole.IsCOPrice = true; } if (item.IsEmployeeBasicInfo.HasValue && item.IsEmployeeBasicInfo.Value) { mRole.IsEmployeeBasicInfo = true; } if (item.IsProductCost.HasValue && item.IsProductCost.Value) { mRole.IsProductCost = true; } if (item.IsSalaryViewCalc.HasValue && item.IsSalaryViewCalc.Value) { mRole.IsSalaryViewCalc = true; } if (item.IsStockCount.HasValue && item.IsStockCount.Value) { mRole.IsStockCount = true; } if (item.IsStockPrice.HasValue && item.IsStockPrice.Value) { mRole.IsStockPrice = true; } if (item.IsXOPrice.HasValue && item.IsXOPrice.Value) { mRole.IsXOPrice = true; } if (item.IsXOQuantity.HasValue && item.IsXOQuantity.Value) { mRole.IsXOQuantity = true; } } return(mRole); }
public bool ExistsExcept(Model.Operators e) { Hashtable paras = new Hashtable(); paras.Add("newId", e.Id); paras.Add("oldId", Get(e.OperatorsId).Id); return(sqlmapper.QueryForObject <bool>("Operators.existsexcept", paras)); }
//构造函数 public RoleToOperators(Model.Operators op) : this() { this._operators = op; this.textEdit1.Text = op.Id; this.textEdit2.Text = op.OperatorName; this.bindingSource1.DataSource = operationRoleManager.Select(op); }
//control双击事件 private void gridControl1_DoubleClick(object sender, EventArgs e) { Model.Operators _operator = this.employeeBindingSource.Current as Model.Operators; RoleToOperators f = new RoleToOperators(_operator); if (f.ShowDialog(this) != DialogResult.OK) { return; } }
/// <summary> /// Delete Operators by primary key. /// </summary> public void Delete(Model.Operators operators) { BL.OperationRoleManager operationRoleManager = new Book.BL.OperationRoleManager(); // // todo:add other logic here // operationRoleManager.Delete(operators); accessor.Delete(operators.OperatorsId); }
protected override void Delete() { this._operators.Password = null; this.operatorsManager.Update(this._operators); this._operators = this.operatorsManager.GetNext(this._operators); if (this._operators == null) { this._operators = this.operatorsManager.GetLast(); } }
/// <summary> /// Update a Operators. /// </summary> public void Update(Model.Operators operators) { BL.OperationRoleManager operationRoleManager = new Book.BL.OperationRoleManager(); // // todo: add other logic here. // operators.UpdateTime = DateTime.Now; accessor.Update(operators); //operationRoleManager.Delete(operators); }
protected override void MovePrev() { Model.Operators employee = this.operatorsManager.GetPrev(this._operators); if (employee == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._operators = employee; }
/// <summary> /// Insert a Operators. /// </summary> public void Insert(Model.Operators operators) { //Model.RoleOperation roleOperation; //BL.RoleOperationManager roleOperationManager = new Book.BL.RoleOperationManager(); // // todo:add other logic here // //添加至操作员表 Validate(operators); operators.InsertTime = DateTime.Now; operators.OperatorsId = Guid.NewGuid().ToString(); accessor.Insert(operators); //添加至权限表 }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { EditForm f = null; DialogResult result = DialogResult.Cancel; Model.Operators _operator = this.employeeBindingSource.Current as Model.Operators; switch (e.Item.Tag.ToString()) { case "insert": f = new EditForm(); result = f.ShowDialog(this); break; case "update": if (_operator != null) { f = new EditForm(_operator); result = f.ShowDialog(this); } break; case "delete": if (_operator != null) { if (MessageBox.Show(Properties.Resources.ConfirmToDelete, "text", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) != DialogResult.OK) { return; } operatorsManager.Delete(_operator); result = DialogResult.OK; } break; default: break; } if (result == DialogResult.OK) { this.employeeBindingSource.DataSource = this.operatorsManager.SelectOperators(); } this.RefreshData(); }
public ProcessEdit(string processid, string action) { InitializeComponent(); this.action = action; this.editprocess = processM.GetProcessbyid(processid); Formload(); this.textBox_name.Text = editprocess.processname; if (editprocess.Processpre != null) { this.comboBox_procespre.Text = (processM.GetProcessbyid(editprocess.Processpre)).processname; } this.comboBox_rule.Text = editprocess.andrule; this.textBox_description.Text = editprocess.descript; this.comboBox_condition.Text = editprocess.condition; // this.comboBox_procespre.Properties.Items.Remove(editprocess.processname); BL.accepterattribManager accepm = new Book.BL.accepterattribManager(); Model.accepterattrib a = null; foreach (Model.accepterattrib at in accepm.Select()) { if (at.processId == processid) { a = at; } } if (a != null) { string acceid = a.RoleId; foreach (Model.Operators op in (new BL.OperatorsManager()).Select()) { if (op.OperatorsId == acceid) { this.currentoperators = op; } } } }
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.ListSourceRowIndex < 0) { return; } IList <Model.wfrecord> details = this.bindingSource1.DataSource as IList <Model.wfrecord>; if (details == null || details.Count < 1) { return; } Model.Operators opertors = this.operatorsManager.Get(details[e.ListSourceRowIndex].applyuserid); if (opertors == null) { return; } if (e.Column.Name == "g1ColApplyuser") { e.DisplayText = opertors.Employee.EmployeeName; } }
//} private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.ListSourceRowIndex < 0) { return; } IList <Model.wfrecord> details = this.bindingSource2.DataSource as IList <Model.wfrecord>; if (details == null || details.Count < 1) { return; } //Model.CustomerProducts detail = details[e.ListSourceRowIndex].PrimaryKey; Model.Operators opertors = this.operatorsManager.Get(details[e.ListSourceRowIndex].applyuserid); if (opertors == null) { return; } if (e.Column.Name == this.gridColumnapplyuser.Name) { e.DisplayText = opertors.OperatorName; } }
private void simpleButtonLogin_Click(object sender, EventArgs e) { //数据库连接判断 if (this.comboBoxEditConnections.SelectedItem == null) { MessageBox.Show(Properties.Resources.RequireChooseConnection); return; } //正在检测连接... // this.labelControl1.Text = Properties.Resources.CheckIngConnection; Cursor.Current = Cursors.WaitCursor; Application.DoEvents(); Common.Connection connection = this.comboBoxEditConnections.SelectedItem as Common.Connection; if (!connection.Awailable) { this.labelControl1.Text = Properties.Resources.ConnectionCannotUse; Cursor.Current = Cursors.Default; return; } //Cursor.Current = Cursors.Default; //用户名 密码 string operatorName = this.comboBoxEditOperator.Text.Trim(); string password = this.textEditPassWord.Text.Trim(); Model.Operators _operator = this.operatorsManager.GetByOperatorName(operatorName); if (_operator == null) { MessageBox.Show(Properties.Resources.NoThisUser, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (_operator.Password != password) { MessageBox.Show(Properties.Resources.PassWordError, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } this._operator = _operator; //this._currentModule = this.comboBoxModule.SelectedItem as Module; this._currentModule = new Module("Stock", Properties.Resources.DepotMana, "Book.UI.MainForm"); this.DialogResult = DialogResult.OK; //string dataname = SelectedConnection.Name; //string username = _operator.OperatorName; //Module.mSaveSetting(Module.BASE_NAME, dataname, Module.BASE_INFO); //Module.mSaveSetting(Module.USER_NAME, username, Module.USER_INFO); String configFile = Application.ExecutablePath + ".config"; XmlDocument document = new XmlDocument(); document.Load(configFile); XmlNodeList nodes = document.SelectNodes("/configuration/userSettings/Book.UI.Properties.Settings/setting"); foreach (XmlNode node in nodes) { switch (node.Attributes["name"].Value) { case "connection": node.FirstChild.InnerText = SelectedConnection.Name; break; case "username": node.FirstChild.InnerText = _operator.OperatorName; break; } document.Save(configFile); } }
public IList <Model.OperationRole> Select(Model.Operators operatoes) { return(accessor.Select(operatoes)); }
public void Delete(Model.Operators operators) { accessor.Delete(operators); }
public EditForm(Model.Operators operators) : this() { this._operators = operators; this.action = "update"; }
public EditForm(string employeeid) { this._operators = this.operatorsManager.Get(employeeid); this.action = "update"; }
public Model.Operators GetNext(Model.Operators e) { return(sqlmapper.QueryForObject <Model.Operators>("Operators.get_next", e)); }
public IList <Model.OperationRole> Select(Model.Operators operators) { return(sqlmapper.QueryForList <Model.OperationRole>("OperationRole.selectByOperationId", operators.OperatorsId)); }
public void Update(Model.Operators e) { this.Update <Model.Operators>(e); }
// 加载登录用户 private void Loadoperato() { Model.Operators currentoper = BL.V.ActiveOperator; labelControl4.Text = currentoper.OperatorName; }
public bool HasRowsBefore(Model.Operators e) { return(sqlmapper.QueryForObject <bool>("Operators.has_rows_before", e)); }
public Model.Operators GetPrev(Model.Operators e) { return(sqlmapper.QueryForObject <Model.Operators>("Operators.get_prev", e)); }
public IList <Book.Model.RoleAuditing> GetByDate(DateTime startDate, DateTime endDate, Model.Department department, Model.Employee emp0, Model.Operators oper, bool isNoAudit, bool isHasAudit) { SqlParameter[] parames = { new SqlParameter("@startdate", DbType.DateTime), new SqlParameter("@enddate", DbType.DateTime), new SqlParameter("@OperatorsId", SqlDbType.VarChar, 50), new SqlParameter("@employee0id", SqlDbType.VarChar, 50) }; parames[0].Value = startDate; parames[1].Value = endDate; parames[2].Value = oper.OperatorsId; if (emp0 == null) { parames[3].Value = DBNull.Value; } else { parames[3].Value = emp0.EmployeeId; } StringBuilder sql = new StringBuilder(); sql.Append("SELECT r.*,(select e.EmployeeName from Employee e where e.EmployeeId = r.Employee0Id ) as Employee0Name,(select e.EmployeeName from Employee e where e.EmployeeId = r.Employee1Id ) as Employee1Name from RoleAuditing r where inserttime between @startdate and @enddate"); if (emp0 != null) { sql.Append(" and employee0id=@employee0id"); } if (oper != null) { sql.Append(" and (NextAuditRoleId IN(select RoleId from OperationRole where OperatorsId = @OperatorsId and IsHold=1) or NextAuditRoleId is null)"); } if (!isNoAudit || !isHasAudit) { if (isNoAudit) { sql.Append(" and auditstate<>3 "); } if (isHasAudit) { sql.Append(" and auditstate=3 "); } } sql.Append(" order by inserttime desc "); return(this.DataReaderBind <Model.RoleAuditing>(sql.ToString(), parames, CommandType.Text)); }
public void Delete(Model.Operators operators) { sqlmapper.Delete("OperationRole.deleteByOperatorsId", operators.OperatorsId); }
public void Insert(Model.Operators e) { this.Insert <Model.Operators>(e); }
/// <summary> /// 待我审批 /// </summary> /// <param name="operators"></param> /// <returns></returns> public IList <Model.wfrecord> GetMyexaming(Model.Operators operators, DateTime startdate, DateTime enddate) { return(accessor.GetMyexaming(operators, startdate, enddate)); }
public bool HasRowsAfter(Model.Operators e) { return(sqlmapper.QueryForObject <bool>("Operators.has_rows_after", e)); }