/// <summary> /// Update a RoleAuditing. /// </summary> public void Update(Model.RoleAuditing roleAuditing) { // // todo: add other logic here. // accessor.Update(roleAuditing); }
private void repositoryItemHyperLinkEdit1_Click(object sender, EventArgs e) { if (this.bindingSource1.Current != null) { Model.RoleAuditing roleAuditing = this.bindingSource1.Current as Model.RoleAuditing; // string formname = "Settings.ProduceManager.Techonlogy.EidtForm";//wfr.Workflow.Tables.TableCode; string formname = roleOperationManager.GetbyTable(roleAuditing.TableName); if (roleAuditing != null) { Form f = null; foreach (Form form in this.MdiParent.MdiChildren) { if (form.GetType().FullName.EndsWith(formname)) { f = form; break; } } if (f == null) { System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); f = (Form)assembly.CreateInstance(string.Format("{0}.{1}", assembly.GetName().Name, formname), false, System.Reflection.BindingFlags.CreateInstance, null, new object[] { roleAuditing.InvoiceId }, null, null); } f.MdiParent = this.MdiParent; f.Show(); f.BringToFront(); } } }
/// <summary> /// Insert a RoleAuditing. /// </summary> public void Insert(Model.RoleAuditing roleAuditing) { // // todo:add other logic here // //try //{ // BL.V.BeginTransaction(); accessor.Insert(roleAuditing); // BL.V.CommitTransaction(); //} //catch //{ // BL.V.RollbackTransaction(); // throw; //} }
private void addaudit(string KeyIdName, string tableName, string tableKeyId, string tableDesc) { if (roleAuditingManager.IsNeedAuditByTableName(tableName)) { // Model.RoleAuditing roleAuditing = this.roleAuditingManager.SelectByInvoiceIdAndTable(invoice.InvoiceId, tableName); //if ( isUpdate == 0) //代表 添加 if (this.action == "insert") { Model.RoleAuditing roleAuditing = new Book.Model.RoleAuditing(); roleAuditing.RoleAuditingId = Guid.NewGuid().ToString(); roleAuditing.AuditRank = 0; roleAuditing.NextAuditRole = new BL.RoleManager().select_byAuditRandTableName(1, tableName); if (roleAuditing.NextAuditRole != null) { roleAuditing.NextAuditRoleId = roleAuditing.NextAuditRole.RoleId; } roleAuditing.AuditState = (int)global::Helper.InvoiceAudit.WaitAudit; roleAuditing.Employee0Id = BL.V.ActiveOperator.EmployeeId; roleAuditing.InsertTime = DateTime.Now; roleAuditing.InvoiceId = tableKeyId; roleAuditing.InvoiceName = new BL.OperationManager().GetOperationNamebyTabel(tableName);; roleAuditing.TableName = tableName; this.roleAuditingManager.Insert(roleAuditing); } if (this.action == "update") { if (AuditState() == 4) { Model.RoleAuditing roleAuditing = this.roleAuditingManager.SelectByInvoiceIdAndTable(tableKeyId, tableName); roleAuditing.AuditRank = 0; roleAuditing.NextAuditRole = new BL.RoleManager().select_byAuditRandTableName(1, tableName); if (roleAuditing.NextAuditRole != null) { roleAuditing.NextAuditRoleId = roleAuditing.NextAuditRole.RoleId; } roleAuditing.AuditState = (int)global::Helper.InvoiceAudit.WaitAudit; roleAuditing.Employee0Id = BL.V.ActiveOperator.EmployeeId; this.roleAuditingManager.Update(roleAuditing); } } string sql = "update " + tableName + " set AuditState= " + (int)global::Helper.InvoiceAudit.WaitAudit + " where " + KeyIdName + "='" + tableKeyId + "'"; new BL.InvoiceXJManager().UpdateSql(sql); } }
public void Update(Model.Invoice invoice) { _ValidateForUpdate(invoice); try { V.BeginTransaction(); if (invoice.AuditState.Value == 4) { string tableName = this.GetType().Name.Substring(0, this.GetType().Name.IndexOf("Manager")); Model.RoleAuditing roleAuditing = this.roleAuditingManager.SelectByInvoiceIdAndTable(invoice.InvoiceId, tableName); roleAuditing.AuditRank = 0; roleAuditing.NextAuditRole = new BL.RoleManager().select_byAuditRandTableName(1, tableName); if (roleAuditing.NextAuditRole != null) { roleAuditing.NextAuditRoleId = roleAuditing.NextAuditRole.RoleId; } roleAuditing.AuditState = (int)global::Helper.InvoiceAudit.WaitAudit; roleAuditing.Employee0Id = V.ActiveOperator.EmployeeId; this.roleAuditingManager.Update(roleAuditing); } else { invoice.AuditState = (int)global::Helper.InvoiceAudit.NoUsing; } _Update(invoice); V.CommitTransaction(); } catch (Exception ex) { V.RollbackTransaction(); throw ex; } }
private void barButtonItemAudit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int flag = 0; try { string tableName = Invoice.GetType().Name; if (Invoice.AuditState != (int)global::Helper.InvoiceAudit.Audited) { flag = 1; } BL.V.BeginTransaction(); Model.RoleAuditing roleAuditing = this.roleAuditingManager.SelectByInvoiceIdAndTable(this.Invoice.InvoiceId, tableName); if (this.barButtonItemAudit.Caption == "審核" || this.barButtonItemAudit.Caption == "审核" || this.barButtonItemAudit.Caption == "複核" || this.barButtonItemAudit.Caption == "复核") { roleAuditing.AuditDate = DateTime.Now; roleAuditing.AuditRank = roleAuditing.AuditRank + 1; //是否最后审核 if (!this.roleAuditingManager.IsLastAudit(roleAuditing.AuditRank.Value + 1, this.Invoice.InvoiceId, tableName)) { roleAuditing.AuditState = (int)global::Helper.InvoiceAudit.Audited;//审核结束 roleAuditing.NextAuditRole = null; roleAuditing.NextAuditRoleId = null; roleAuditing.Role1 = new BL.RoleManager().select_byAuditRandTableName(roleAuditing.AuditRank.Value, tableName); if (roleAuditing.Role1 != null) { roleAuditing.Role1Id = roleAuditing.Role1.RoleId; } } else { roleAuditing.AuditState = (int)global::Helper.InvoiceAudit.OnAuditing; roleAuditing.Role1 = new BL.RoleManager().select_byAuditRandTableName(roleAuditing.AuditRank.Value, tableName); if (roleAuditing.Role1 != null) { roleAuditing.Role1Id = roleAuditing.Role1.RoleId; } roleAuditing.NextAuditRole = new BL.RoleManager().select_byAuditRandTableName(roleAuditing.AuditRank.Value + 1, tableName); if (roleAuditing.NextAuditRole != null) { roleAuditing.NextAuditRoleId = roleAuditing.NextAuditRole.RoleId; } } roleAuditing.Employee1Id = BL.V.ActiveOperator.EmployeeId; roleAuditing.UpdateTime = DateTime.Now; this.roleAuditingManager.Update(roleAuditing); string sql = "update " + tableName + " set AuditState= " + roleAuditing.AuditState + ", AuditEmpId='" + BL.V.ActiveOperator.EmployeeId + "' where " + Model.Invoice.PROPERTY_INVOICEID + "='" + this.Invoice.InvoiceId + "'"; new BL.InvoiceXJManager().UpdateSql(sql); // this.barButtonItemAudit.Caption = "棄審"; } else if (this.barButtonItemAudit.Caption == "棄審" || this.barButtonItemAudit.Caption == "弃审") {//弃核 roleAuditing.AuditState = (int)global::Helper.InvoiceAudit.GiveUpAudited; roleAuditing.AuditRank = 0; roleAuditing.NextAuditRole = new BL.RoleManager().select_byAuditRandTableName(1, tableName); if (roleAuditing.NextAuditRole != null) { roleAuditing.NextAuditRoleId = roleAuditing.NextAuditRole.RoleId; } this.roleAuditingManager.Update(roleAuditing); string sql = "update " + tableName + " set AuditState= " + (int)global::Helper.InvoiceAudit.GiveUpAudited + ", AuditEmpId='" + BL.V.ActiveOperator.EmployeeId + "' where " + Model.Invoice.PROPERTY_INVOICEID + "='" + this.Invoice.InvoiceId + "'"; new BL.InvoiceXJManager().UpdateSql(sql); // this.barButtonItemAudit.Caption = "審核"; } this.Refresh(); BL.V.CommitTransaction(); } catch (Exception ex) { if (flag == 1) { this.barButtonItemAudit.Caption = "審核"; } else { this.barButtonItemAudit.Caption = "棄審"; } BL.V.RollbackTransaction(); throw ex; } }
public bool HasRowsBefore(Model.RoleAuditing e) { return(accessor.HasRowsBefore(e)); }
public void Insert(Model.RoleAuditing e) { this.Insert <Model.RoleAuditing>(e); }
private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int flagAut = 0; string KeyIdName = null; string tableName = null; string tableKeyId = null; string tableDesc = null; if (!string.IsNullOrEmpty(tableCode())) { flagAut = 1; KeyIdName = AuditKeyId(); tableName = this.tableCode().Substring(0, this.tableCode().IndexOf(',')); tableKeyId = this.tableCode().Substring(this.tableCode().IndexOf(',') + 1); tableDesc = new BL.OperationManager().GetOperationNamebyTabel(tableName); } switch ((string)e.Item.Tag) { case "save": ClickSave(flagAut, KeyIdName, tableName, tableKeyId, tableDesc); break; case "undo": this.MoveLast(); this.action = "view"; this.Refresh(); break; case "new": try { this.AddNew(); this.action = "insert"; this.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } break; case "update": if (MessageBox.Show("確定要修改?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { this.action = "update"; this.Refresh(); } break; case "prev": try { this.MovePrev(); this.Refresh(); } catch (InvalidOperationException ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } break; case "next": try { this.MoveNext(); this.Refresh(); } catch (InvalidOperationException ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } break; case "first": try { this.MoveFirst(); this.Refresh(); } catch (InvalidOperationException ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } break; case "last": try { this.MoveLast(); this.Refresh(); } catch (InvalidOperationException ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } break; case "delete": try { int a = AuditState(); this.Delete(); if (flagAut == 1 && a != 0) { roleAuditingManager.DeleteByInvoiceIdAndTable(tableKeyId, tableName); } this.Refresh(); } catch (InvalidOperationException ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Helper.ViolateConstraintException ex) { MessageBox.Show(Properties.Resources.DeleteError + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch { MessageBox.Show(Properties.Resources.DeleteError, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } break; case "Audit": if (flagAut == 1) { int flag = 0; try { if (AuditState() != (int)global::Helper.InvoiceAudit.Audited) { flag = 1; } BL.V.BeginTransaction(); Model.RoleAuditing roleAuditing = this.roleAuditingManager.SelectByInvoiceIdAndTable(tableKeyId, tableName); if (this.barButtonItemAudit.Caption == "審核" || this.barButtonItemAudit.Caption == "审核" || this.barButtonItemAudit.Caption == "複核" || this.barButtonItemAudit.Caption == "复核") { roleAuditing.AuditDate = DateTime.Now; roleAuditing.AuditRank = roleAuditing.AuditRank + 1; //是否最后审核 if (!this.roleAuditingManager.IsLastAudit(roleAuditing.AuditRank.Value + 1, tableKeyId, tableName)) { roleAuditing.AuditState = (int)global::Helper.InvoiceAudit.Audited;//审核结束 roleAuditing.NextAuditRole = null; roleAuditing.NextAuditRoleId = null; roleAuditing.Role1 = new BL.RoleManager().select_byAuditRandTableName(roleAuditing.AuditRank.Value, tableName); if (roleAuditing.Role1 != null) { roleAuditing.Role1Id = roleAuditing.Role1.RoleId; } } else { roleAuditing.AuditState = (int)global::Helper.InvoiceAudit.OnAuditing; roleAuditing.Role1 = new BL.RoleManager().select_byAuditRandTableName(roleAuditing.AuditRank.Value, tableName); if (roleAuditing.Role1 != null) { roleAuditing.Role1Id = roleAuditing.Role1.RoleId; } roleAuditing.NextAuditRole = new BL.RoleManager().select_byAuditRandTableName(roleAuditing.AuditRank.Value + 1, tableName); if (roleAuditing.NextAuditRole != null) { roleAuditing.NextAuditRoleId = roleAuditing.NextAuditRole.RoleId; } } roleAuditing.Employee1Id = BL.V.ActiveOperator.EmployeeId; roleAuditing.UpdateTime = DateTime.Now; this.roleAuditingManager.Update(roleAuditing); string sql = "update " + tableName + " set AuditState= " + roleAuditing.AuditState + ", AuditEmpId='" + BL.V.ActiveOperator.EmployeeId + "' where " + KeyIdName + "='" + tableKeyId + "'"; new BL.InvoiceXJManager().UpdateSql(sql); // this.barButtonItemAudit.Caption = "棄審"; } else if (this.barButtonItemAudit.Caption == "棄審" || this.barButtonItemAudit.Caption == "弃审") { //弃核 roleAuditing.AuditState = (int)global::Helper.InvoiceAudit.GiveUpAudited; roleAuditing.AuditRank = 0; roleAuditing.NextAuditRole = new BL.RoleManager().select_byAuditRandTableName(1, tableName); if (roleAuditing.NextAuditRole != null) { roleAuditing.NextAuditRoleId = roleAuditing.NextAuditRole.RoleId; } this.roleAuditingManager.Update(roleAuditing); string sql = "update " + tableName + " set AuditState= " + (int)global::Helper.InvoiceAudit.GiveUpAudited + ", AuditEmpId='" + BL.V.ActiveOperator.EmployeeId + "' where " + KeyIdName + "='" + tableKeyId + "'"; new BL.InvoiceXJManager().UpdateSql(sql); // this.barButtonItemAudit.Caption = "審核"; } this.Refresh(); BL.V.CommitTransaction(); } catch (Exception ex) { if (flag == 1) { this.barButtonItemAudit.Caption = "審核"; } else { this.barButtonItemAudit.Caption = "棄審"; } BL.V.RollbackTransaction(); throw ex; } } break; //if (!string.IsNullOrEmpty(this.tableCode())) //{ // Model.wfrecord wfr = wfrecordManager.GetByTableCodeAndKeyId(this.tableCode().Substring(0, this.tableCode().IndexOf(',')), this.tableCode().Substring(this.tableCode().IndexOf(',') + 1, this.tableCode().LastIndexOf(',') - this.tableCode().IndexOf(',') - 1)); // if (wfr != null) // { // if (this.AuditState() != (int)global::Helper.InvoiceAudit.Audited) // {//审核 // Model.process noprocess = processManager.GetProcessbyid(wfr.nowprocessid); // if (noprocess != null) // { // wfr.processId = wfr.nowprocessid; // wfr.nowprocessid = noprocess.Processnex; // Model.process proc = processManager.GetProcessbyid(wfr.nowprocessid); // wfr.allovertime = DateTime.Today; // if (proc.processType == "结束") // { // wfr.allstate = (int)global::Helper.InvoiceAudit.Audited; // } // else // { // wfr.allstate = (int)global::Helper.InvoiceAudit.OnAuditing; // } // wfrecordManager.Update(wfr); // string sql = "update " + this.tableCode().Substring(0, this.tableCode().IndexOf(',')) + " set AuditState= " + wfr.allstate + ", AuditEmpId='" + BL.V.ActiveOperator.EmployeeId + "' where " + this.AuditKeyId() + "='" + this.tableCode().Substring(this.tableCode().IndexOf(',') + 1, this.tableCode().LastIndexOf(',') - this.tableCode().IndexOf(',') - 1) + "'"; // new BL.InvoiceXJManager().UpdateSql(sql); // } // this.barButtonItemAudit.Caption = "棄審"; // } // else // { // //弃核 // foreach (Model.process p in processManager.SelectProcessbywf(wfr.WorkflowId)) // { // if (p.processType == "开始") // { // wfr.processId = p.processId; // wfr.nowprocessid = p.Processnex; // break; // } // } // wfr.allovertime = DateTime.Now; // wfr.allstate = (int)global::Helper.InvoiceAudit.GiveUpAudited; // wfrecordManager.Update(wfr); // string sql = "update " + this.tableCode().Substring(0, this.tableCode().IndexOf(',')) + " set AuditState= " + wfr.allstate + ", AuditEmpId='" + BL.V.ActiveOperator.EmployeeId + "' where " + this.AuditKeyId() + "='" + this.tableCode().Substring(this.tableCode().IndexOf(',') + 1, this.tableCode().LastIndexOf(',') - this.tableCode().IndexOf(',') - 1) + "'"; // new BL.InvoiceXJManager().UpdateSql(sql); // this.barButtonItemAudit.Caption = "審核"; // } // } //} //更新表单 //this.Refresh(); //BL.V.CommitTransaction(); //if (wfinsertManager.Checkwfbytablescode(tableCode())) //{ // wfinsertManager.insertwfrecord("TechonlogyHeader", "工艺 " + this.techonlogyHeader.TechonlogyHeadername, this.techonlogyHeader.TechonlogyHeaderId); //} //else //{ //} // } // catch (Exception ex) // { // this.barButtonItemAudit.Caption = "審核"; // BL.V.RollbackTransaction(); // throw ex; // } // break; case "Attachment": if (!string.IsNullOrEmpty(tableKeyId)) { BaseAttachmentView bav = new BaseAttachmentView(tableKeyId, this.GetType().FullName); bav.ShowDialog(this); } break; } }
public Model.RoleAuditing GetNext(Model.RoleAuditing e) { return(accessor.GetNext(e)); }
private void ClickSave(int flagAut, string KeyIdName, string tableName, string tableKeyId) { try { bool checkwf = false; //if (this.action == "insert") //{ // Workflowinsert wfinsert = new Workflowinsert(); // if (!string.IsNullOrEmpty(this.tableCode())) // { // checkwf = wfinsert.Checkwfbytablescode(this.tableCode().Substring(0, this.tableCode().IndexOf(','))); // if (checkwf) // saveAuditState = (int)global::Helper.InvoiceAudit.WaitAudit; // } //} saveAuditState = (int)global::Helper.InvoiceAudit.NoUsing; this.Save(); //MessageBox.Show("fdafda"); if (flagAut == 1 && roleAuditingManager.IsNeedAuditByTableName(tableName)) { // Model.RoleAuditing roleAuditing = this.roleAuditingManager.SelectByInvoiceIdAndTable(invoice.InvoiceId, tableName); //if ( isUpdate == 0) //代表 添加 if (this.action == "insert") { Model.RoleAuditing roleAuditing = new Book.Model.RoleAuditing(); roleAuditing.RoleAuditingId = Guid.NewGuid().ToString(); roleAuditing.AuditRank = 0; roleAuditing.NextAuditRole = new BL.RoleManager().select_byAuditRandTableName(1, tableName); if (roleAuditing.NextAuditRole != null) { roleAuditing.NextAuditRoleId = roleAuditing.NextAuditRole.RoleId; } roleAuditing.AuditState = (int)global::Helper.InvoiceAudit.WaitAudit; roleAuditing.Employee0Id = BL.V.ActiveOperator.EmployeeId; roleAuditing.InsertTime = DateTime.Now; roleAuditing.InvoiceId = tableKeyId; roleAuditing.InvoiceName = new BL.OperationManager().GetOperationNamebyTabel(tableName);; roleAuditing.TableName = tableName; this.roleAuditingManager.Insert(roleAuditing); } if (this.action == "update") { if (AuditState() == 4) { Model.RoleAuditing roleAuditing = this.roleAuditingManager.SelectByInvoiceIdAndTable(tableKeyId, tableName); roleAuditing.AuditRank = 0; roleAuditing.NextAuditRole = new BL.RoleManager().select_byAuditRandTableName(1, tableName); if (roleAuditing.NextAuditRole != null) { roleAuditing.NextAuditRoleId = roleAuditing.NextAuditRole.RoleId; } roleAuditing.AuditState = (int)global::Helper.InvoiceAudit.WaitAudit; roleAuditing.Employee0Id = BL.V.ActiveOperator.EmployeeId; this.roleAuditingManager.Update(roleAuditing); } } string sql = "update " + tableName + " set AuditState= " + (int)global::Helper.InvoiceAudit.WaitAudit + " where " + KeyIdName + "='" + tableKeyId + "'"; new BL.AcademicBackGroundManager().UpdateSqlMap(sql); } //catch (Exception ex) //{ // BL.V.RollbackTransaction(); // throw ex; //} this.action = "view"; this.Refresh(); } catch (Helper.MessageValueException ex) { if (!string.IsNullOrEmpty(ex.Message) && !ex.Message.Equals("SaveCancel", StringComparison.InvariantCultureIgnoreCase)) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } return; } catch (Helper.RequireValueException ex) { if (this.requireValueExceptions.ContainsKey(ex.Message)) { AA aa = this.requireValueExceptions[ex.Message]; MessageBox.Show(aa.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); aa.Control.Focus(); return; } throw; } catch (Helper.InvalidValueException ex) { if (this.invalidValueExceptions.ContainsKey(ex.Message)) { AA aa = this.invalidValueExceptions[ex.Message]; MessageBox.Show(aa.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); aa.Control.Focus(); return; } throw; } catch (Helper.ViolateConstraintException ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } catch (Helper.VersionOverTimeException) { MessageBox.Show(Properties.Resources.ObjectHasChange, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.action = "view"; this.Refresh(); return; } catch (Exception ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } MessageBox.Show(Properties.Resources.SuccessfullySaved, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; }
public bool HasRowsAfter(Model.RoleAuditing e) { return(accessor.HasRowsAfter(e)); }
public Model.RoleAuditing GetPrev(Model.RoleAuditing e) { return(accessor.GetPrev(e)); }
public void Update(Model.RoleAuditing e) { this.Update <Model.RoleAuditing>(e); }
public Model.RoleAuditing GetPrev(Model.RoleAuditing e) { return(sqlmapper.QueryForObject <Model.RoleAuditing>("RoleAuditing.get_prev", e)); }
public Model.RoleAuditing GetNext(Model.RoleAuditing e) { return(sqlmapper.QueryForObject <Model.RoleAuditing>("RoleAuditing.get_next", e)); }
public bool HasRowsAfter(Model.RoleAuditing e) { return(sqlmapper.QueryForObject <bool>("RoleAuditing.has_rows_after", e)); }
public bool HasRowsBefore(Model.RoleAuditing e) { return(sqlmapper.QueryForObject <bool>("RoleAuditing.has_rows_before", e)); }