public void RevokePermission(operation mOperation, objectRbac mObject, role mRole) { role TempRole = Mapping(mRole); if (TempRole == null) { throw new Exception("Role Does not exist in system."); } objectRbac tempObject = Mapping(mObject); operation tempOperation = Mapping(mOperation); if (tempOperation == null || tempObject == null) { return; } //Grant permission string hsql = "from permission per where per.ObjectRBAC = :ObjectRBAC AND per.Operation = :Operation "; List <permission> _lst = PermissionSrv.GetbyHQuery(hsql, new SQLParam("ObjectRBAC", tempObject), new SQLParam("ObjectRBAC", tempOperation)); permission TempPermission = (_lst == null || _lst.Count == 0) ? null : _lst[0]; if (TempPermission != null) { if (TempRole.Permissions.Contains(TempPermission)) { TempRole.Permissions.Remove(TempPermission); RoleSrv.CommitChanges(); } } }
/// <summary> /// Combines two or more precompiled document selection ranks /// </summary> /// <param name="inputNames">comma separated list of DS rank file names, leave empty if search pattern is used</param> /// <param name="searchPattern">file search pattern to select source files, leave * if no file search should be performed</param> /// <param name="compression">vector dimensions compression operation, i.e. how scores should be combined into single dimension</param> /// <param name="outputName">Name of the output.</param> /// <param name="doRankingFusion">if set to <c>true</c> [do ranking fusion].</param> /// <remarks> /// What it will do? /// </remarks> /// <seealso cref="aceOperationSetExecutorBase" /> public void aceOperation_makeCombineDSRanks( [Description("Space separated list of DS rank file names, leave empty if search pattern is used")] String inputNames = " ", [Description("vector dimensions compression operation, i.e. how scores should be combined into single dimension")] operation compression = operation.avg, [Description("Name of output Document Selection Rank file. Leave * to assign name as combination of input files")] String outputName = "*", [Description("If true, it will perform ranking fusion instead of simple score fusion")] Boolean doRankingFusion = true, [Description("file search pattern to select source files, leave * if no file search should be performed")] String searchPattern = "*" ) { SetupDocumentSelection setup = docSelection.data.CloneViaXML(); ProceduralFolderFor <ProcedureCreateScoreSet, SetupDocumentSelection, OperationContext, ExperimentModelExecutionContext> procedures = new ProceduralFolderFor <ProcedureCreateScoreSet, SetupDocumentSelection, OperationContext, ExperimentModelExecutionContext>(mainContext.folds, setup, mainContext.notes, parent); outputName = DocumentSelectResult.CheckAndMakeFilename(outputName); foreach (var p in procedures) { p.Open(); DocumentSelectResult resultOut = new DocumentSelectResult(); var fl = mainContext.resourceProvider.GetResourceFiles(inputNames, p.fold); List <DocumentSelectResult> results = DocumentRankingExtensions.LoadDSRankings(fl, p.notes); resultOut = results.Fusion(compression, doRankingFusion, true, p.notes); String pt = mainContext.resourceProvider.SetResourceFilePath(outputName, p.fold); resultOut.saveObjectToXML(pt); p.Close(); } }
protected void BtnAdddata_Click(object sender, EventArgs e) { string fileName = Uploadpri.PostedFile.FileName; string fileName2 = Uploadpri.PostedFile.FileName.Substring(fileName.LastIndexOf("\\") + 1); string type1 = fileName2.Substring(fileName2.LastIndexOf(".") + 1); string typeToLower = type1.ToLower(); if (typeToLower == "bmp" || typeToLower == "gif" || typeToLower == "jpg" || typeToLower == "") { operation op1 = new operation(); DateTime time = new DateTime(); string uploadName = Uploadpri.Value.Trim(); string pictureName = ""; if (uploadName != "") { int idx = uploadName.LastIndexOf("."); string suffix = uploadName.Substring(idx); pictureName = System.DateTime.Now.Ticks.ToString() + suffix; } string msg = op1.Add(lblID.Text, textName.Text, textPhone.Text, textMobile.Text, textAddress.Text, TextQQ.Text, textEmail.Text, pictureName, time.ToString(), txtgeneral.Text, DDLsrot.SelectedValue.ToString()); if (msg == "") { //lblmsg.Text = "好友资料添加成功!"; //lblmsg.Style["color"] = "red"; Response.Write("<script language=javascript>alert('好友资料添加成功!')</script>"); } else { //lblmsg.Text = "好友添加失败!"; //lblmsg.Style["color"] = "red"; Response.Write("<script language=javascript>alert('好友添加失败或好友名重复!')</script>"); } if (uploadName != "") { string path = Server.MapPath(".\\Pictures\\"); Uploadpri.PostedFile.SaveAs(path + pictureName); } } else { Response.Write("<script language=javascirpt type='text/javascript'>"); Response.Write("window.alert('请上传正确文件格式!')"); Response.Write("</script>"); } //Response.Redirect("GridViewUsage.aspx"); textAddress.Text = ""; textEmail.Text = ""; textMobile.Text = ""; textName.Text = ""; textPhone.Text = ""; TextQQ.Text = ""; txtgeneral.Text = ""; this.textName.Focus(); //dataBind(); }
public void update(int id) { operation p = ut.OfferRepository.GetById(id); ut.OfferRepository.Update(p); ut.commit(); }
public double evaluate() { operation currentOp = this[0].O; operation nextOp; double result = this[0].V.Evaluate(); foreach (valueOp vo in this.Skip(1)) { nextOp = vo.O; switch (currentOp) { case operation.ADD: result += vo.V.Evaluate(); break; case operation.SUBTRACT: result -= vo.V.Evaluate(); break; case operation.MULTIPLY: result *= vo.V.Evaluate(); break; case operation.DIVIDE: result /= vo.V.Evaluate(); break; } currentOp = nextOp; } return(result); }
public void deleteOfferById(int id) { operation p = ut.OfferRepository.GetById(id); ut.OfferRepository.Delete(p); ut.commit(); }
private object Cleanup(FolderSetting Folder, List <FileInfo> list, operation operation) { object ob = new object(); try { switch (operation) { case operation.Archive: Archive(Folder, list); break; case operation.Compress: Compress(Folder, list); break; case operation.Delete: Delete(Folder, list); break; } } catch (Exception ex) { Utilities.ReportException(ex, _log); } return(ob); }
public operation evaluate(Stack stack) { operation[] operations = new operation[] { operation.leftArc, operation.rightArc, operation.shift }; int pos = new Random().Next(0, operations.Length); return(operations[pos]); }
private void btn_divide_Click(object sender, EventArgs e) { operation = operation.divide; firstnumber = Convert.ToDouble(Result.Text); Result.Text = ""; Sum.Text += "/"; }
private void btn_multiply_Click(object sender, EventArgs e) { operation = operation.multiply; firstnumber = Convert.ToDouble(Result.Text); Result.Text = ""; Sum.Text += "*"; }
private void SetZ(float value) { z = value; if (x > maxX) { maxX = x; } if (x < minX) { minX = x; } if (y > maxY) { maxY = y; } if (y < minY) { minY = y; } x *= 0.05f; y *= 0.05f; z *= 0.05f; vertices.Add(new Point3d(x, z, y)); nextSet = SetX; }
private void btn_subtract_Click(object sender, EventArgs e) { operation = operation.subtract; firstnumber = Convert.ToDouble(Result.Text); Result.Text = ""; Sum.Text += "-"; }
// GET: Hotel/Edit/5 public ActionResult Edit(int id) { operation h = a.getOfferById(id); a.deleteOfferById(id); return(View(h)); }
private void button1_Click(object sender, EventArgs e) { int result; int num1 = 0; int num2 = 0; try { num1 = int.Parse(txtNum1.Text); num2 = int.Parse(txtNum2.Text); } catch { MessageBox.Show("Digite um número inteiro!", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Hand); txtNum1.Clear(); txtNum2.Clear(); } operation Dlg1 = new operation(TesteDelegate.soma); result = Dlg1(num1, num2); txtSoma.Text = result.ToString(); Dlg1 = new operation(TesteDelegate.multiplicacao); result = Dlg1(num1, num2); txtMulti.Text = result.ToString(); }
/// <summary> /// Calculates the specified oper. /// </summary> /// <param name="ad">The ad.</param> /// <param name="oper">The oper.</param> /// <param name="bd">The bd.</param> /// <returns></returns> public static Decimal calculate(this Decimal ad, operation oper, Decimal bd = 1) { Double a = Convert.ToDouble(ad); Double b = Convert.ToDouble(bd); return(Convert.ToDecimal(calculate(a, oper, b))); }
public void InsertDriver(string userID, string Name, string gender, DateTime bd, string drivinglicence, DateTime expiryDate) { using (DODataContext db_ = new DODataContext()) { operation op = new operation(); CarDriver driver = new CarDriver() { ID = op.NewID(), BirthDate = bd, drivingLicenceNumber = drivinglicence, expiryDate = expiryDate, Gender = gender, StaffName = Name, UserID = userID, Working = false }; db_.CarDrivers.InsertOnSubmit(driver); db_.SubmitChanges(); } //Console.WriteLine("Drive the Scooter : " + product.ToString() + "km"); }
protected void disableButtonsForTrigonometric(operation trigonometric) { delete.Enabled = false; add.Enabled = false; sub.Enabled = false; div.Enabled = false; plus.Enabled = false; int op = (int)trigonometric; switch (op) { case 5: cos.Enabled = false; tan.Enabled = false; break; case 6: sin.Enabled = false; tan.Enabled = false; break; case 7: cos.Enabled = false; sin.Enabled = false; break; } }
private void btn_plus_Click(object sender, EventArgs e) { operation = operation.plus; firstnumber = Convert.ToDouble(Result.Text); Result.Text = ""; Sum.Text += "+"; }
private void menuItemTT_Click(object sender, RoutedEventArgs e) { lastOperation = operation.TrainAndTest; double percent = 0; PercentDialog pd = new PercentDialog(); if (pd.ShowDialog() == true) { percent = pd.Answer; } if (percent == 0) { return; } TTDataSetsList = new List <DataSetTT>(); LoadTTDataSetList(percent); List <TrainAndTest> TTList = UseTrainAndTest(); bestTT = GetBestQualityTT(TTList); string messageToPrint = PrintQualityInfo(TTList, bestTT); messageToPrint += bestTT.ruleSet.PrintRules(); tbTest.Text = messageToPrint; tbSizeOfSet.Text = "Wielkość zbioru uczącego: " + bestTT.dataSet.entireSet.Count(); tbSizeOfBestTreningSet.Text = "Wielkość najlepszego zbioru treningowego: " + bestTT.dataSet.trainingSet.Count(); tbSizeOfBestValidateSet.Text = ""; tbSizeOfBestTestSet.Text = "Wielkość najlepszego zbioru testowego: " + bestTT.dataSet.testSet.Count(); tbSizeOfBestruleSet.Text = "Ilość reguł: " + bestTT.ruleSet.GetRuleSet().Count(); }
private void doEqual(float curentValue) { doOperation(PastOperation, curentValue); PastOperation = operation.Null; display.Text = digitGroupingEqal(Totalizator.ToString()); }
public string Evaluate(string op, double x, double y) { operation f = null; if (op.Equals("sum")) { f = (p1, p2) => p1 + p2; } else if (op.Equals("dif")) { f = (p1, p2) => p1 - p2; } else if (op.Equals("prd")) { f = (p1, p2) => p1 * p2; } else if (op.Equals("div")) { f = (p1, p2) => p1 / p2; } if (f == null) { return("No such operation"); } else { double result = f(x, y); return(result.ToString()); } }
/// <summary> /// Executes an operation on the stack /// </summary> /// <param name="operation"></param> /// <returns></returns> public Relation executeOperations(operation operation) { int s = this.data.Count; Relation relation = null; if (s - 2 > 0) { //hif.Out(String.Format("last pair [{0}, {1}] ", this.data[s - 2], this.data[s - 1])); switch (operation) { case operation.leftArc: relation = new Relation(this.data[s - 1], this.data[s - 2], Relation.relation.head); this.data.Remove(this.data[s - 2]); break; case operation.rightArc: relation = new Relation(this.data[s - 2], this.data[s - 1], Relation.relation.head); this.data.Remove(this.data[s - 1]); break; default: break; } } return(relation); }
public override IMeasureBasic calculate(IMeasure second, operation op) { switch (op) { case operation.none: primValue = null; break; case operation.assign: case operation.plus: primValue = second.getValue <T>(); break; case operation.minus: T vl = second.getValue <T>(); if (primValue == vl) { primValue = null; } break; default: break; } return(this); }
private void menuItemCross_Click(object sender, RoutedEventArgs e) { lastOperation = operation.CrossValidate; int numberOfSets = 0; NumberOfSetsDialog pd = new NumberOfSetsDialog(); if (pd.ShowDialog() == true) { numberOfSets = pd.Answer; } if (numberOfSets == 0) { return; } CrossDataSetsList = new List <DataSetCross>(); LoadCrossDataSetList(numberOfSets); List <k_foldCrossValidation> kList = UseKFoldCrossValidation(); bestCross = GetBestQualityCross(kList); string messageToPrint = PrintQualityInfo(kList, bestCross); messageToPrint += bestCross.ruleSet.PrintRules(); tbTest.Text = messageToPrint; tbSizeOfSet.Text = "Wielkość zbioru uczącego: " + bestCross.dataSet.entireSet.Count(); tbSizeOfBestTreningSet.Text = ""; tbSizeOfBestValidateSet.Text = ""; tbSizeOfBestTestSet.Text = ""; tbSizeOfBestruleSet.Text = "Ilość reguł: " + bestCross.ruleSet.GetRuleSet().Count(); }
public void GrantPermission(string mObject, string mOperation, string[] mRoles) { if (_App == null) { return; } string HQL = "from role r where r.AppID = :AppID AND r.name in ({0})"; string ParaStr = ":" + string.Join(",:", mRoles); HQL = string.Format(HQL, ParaStr); SQLParam[] paramList = new SQLParam[mRoles.Length + 1]; paramList[0] = new SQLParam("AppID", _App.AppID); for (int i = 0; i < mRoles.Length; i++) { paramList[i + 1] = new SQLParam(mRoles[i], mRoles[i]); } List <role> RoleLst = RoleSrv.GetbyHQuery(HQL, paramList); if (RoleLst == null || RoleLst.Count == 0) { return; } //Grant permission permission TempPermission = PermissionSrv.GetPermission(mObject, mOperation, _App.AppID); if (TempPermission == null) { objectRbac tempObject = ObjectSrv.GetByName(mObject, _App.AppID); operation tempOperation = OperationSrv.GetByName(mOperation, _App.AppID); if (tempObject == null || tempOperation == null) { return; } TempPermission = new permission(); TempPermission.AppID = _App.AppID; TempPermission.name = tempObject.name + ":" + tempOperation.name; TempPermission.ObjectRBAC = tempObject; TempPermission.Operation = tempOperation; TempPermission.Roles = new List <role>(); foreach (role r in RoleLst) { TempPermission.Roles.Add(r); } PermissionSrv.CreateNew(TempPermission); PermissionSrv.CommitChanges(); } else { foreach (role r in RoleLst) { if (!TempPermission.Roles.Contains(r)) { TempPermission.Roles.Add(r); } } PermissionSrv.CommitChanges(); } }
static void Main(string[] args) { Console.WriteLine("Delegate Demo"); operation obj = new operation(Addition); Console.WriteLine("Addition is = {0}", obj(23, 27)); MulticastDelegate.ImplementDelegate(); Console.ReadKey(); }
public frmVigencia(VIGENCIA vigencia, operation operacion) { InitializeComponent(); serviciosVIGENCIA = (ServiciosVIGENCIA)Configurador.ConfigurarServicio(typeof(ServiciosVIGENCIA)); this.vigencia = vigencia; this.operacion = operacion; cargarDatos(); }
public frmCategoria(operation operacion, TARIFACATEGORIA categoria) { InitializeComponent(); serviciosTARIFACATEGORIA = (ServiciosTARIFACATEGORIA)Configurador.ConfigurarServicio(typeof(ServiciosTARIFACATEGORIA)); this.operacion = operacion; this.categoria = categoria; inicializarValores(); }
public static int[] Map(this int[] numbers, operation Operate) { for (int i = 0; i < numbers.Count(); i++) { numbers[i] = Operate(numbers[i]); } return(numbers); }
// POST api/values public void PostOP([FromBody] operation op) { if (op.vendorName != null && op.invoiceNB != 0 && op.scanDate != null && op.siteNB != 0) { context.op.Add(entity: op); context.SaveChanges(); } }
private void button14_Click(object sender, EventArgs e) { if (CurrentOperation == operation.clearOperation) { CurrentOperation = operation.substraction; buffer = textBox1.Text; textBox1.Text = ""; textBox1.Focus(); } else { CurrentOperation = operation.substraction; } }
void dispatch(byte a, byte b, operation op) { ushort bval = 0; route(b, ref bval, get); route(a, ref bval, op); }
public Transaction(double amount, operation type) { this.amount = amount; this.tranType = type; this._transactionDate = DateProvider.getInstance().now(); }
ushort route(byte aaaaaa, operation op, Lazy<ushort> blazy = null) { // IMPORTANT: op will be set to noop only for the primary op // in an instruction, the flag will have already been cleared // in time for the bget() phase. if (machine.skip) { op = noop; machine.skip = false; } if ((aaaaaa & 0x20) != 0) { ushort literal = (ushort)(aaaaaa & 0x1f); return op(ref literal, blazy); } else { byte loctype = (byte)((aaaaaa >> 3) & 0x03); byte reg = (byte)(aaaaaa & 0x07); switch (loctype) { case 0x00: return op(ref machine.regs[reg], blazy); case 0x01: return op(ref machine.ram[machine.regs[reg]], blazy); case 0x02: return op(ref machine.ram[machine.regs[reg] + machine.ram[machine.pc++]], blazy); case 0x03: switch (reg) { case 0x00: return op(ref machine.ram[machine.sp++], blazy); case 0x01: return op(ref machine.ram[machine.sp], blazy); case 0x02: return op(ref machine.ram[--machine.sp], blazy); case 0x03: return op(ref machine.sp, blazy); case 0x04: return op(ref machine.pc, blazy); case 0x05: return op(ref machine.o, blazy); case 0x06: return op(ref machine.ram[machine.ram[machine.pc++]], blazy); case 0x07: return op(ref machine.ram[machine.pc++], blazy); default: throw new InvalidOperationException(); } default: throw new InvalidOperationException(); } } }
event.setFieldValue(OrcRecordUpdater.OPERATION, new IntWritable(operation));
void route(byte aaaaaa, ref ushort bval, operation op) { if ((aaaaaa & 0x20) != 0) { ushort literal = (ushort)(aaaaaa & 0x1f); op(ref literal, ref bval); } else { byte loctype = (byte)((aaaaaa >> 3) & 0x03); byte reg = (byte)(aaaaaa & 0x07); switch (loctype) { case 0x00: op(ref machine.regs[reg], ref bval); break; case 0x01: op(ref machine.ram[machine.regs[reg]], ref bval); break; case 0x02: op(ref machine.ram[machine.regs[reg] + machine.ram[machine.pc++]], ref bval); break; case 0x03: switch (reg) { case 0x00: op(ref machine.ram[machine.sp++], ref bval); break; case 0x01: op(ref machine.ram[machine.sp], ref bval); break; case 0x02: op(ref machine.ram[--machine.sp], ref bval); break; case 0x03: op(ref machine.sp, ref bval); break; case 0x04: op(ref machine.pc, ref bval); break; case 0x05: op(ref machine.o, ref bval); break; case 0x06: op(ref machine.ram[machine.ram[machine.pc++]], ref bval); break; case 0x07: op(ref machine.ram[machine.pc++], ref bval); break; } break; } } // byte type = (byte)((aaaaaa >> 3) & 0x3); // byte loc = (byte)(aaaaaa & 0x7); // if (type == 0) // { // switch(loc){} // } }
public Calc() { InitializeComponent(); CurrentOperation = operation.clearOperation; }
private void button15_Click(object sender, EventArgs e) { listView1.Items.Add("hdfh"); try { if (textBox1.Text == "") { textBox1.Text = buffer; } else { if (CurrentOperation == operation.addiction) { double tmpBuffer = double.Parse(textBox1.Text); textBox1.Text = (double.Parse(buffer) + tmpBuffer).ToString(); CurrentOperation = operation.clearOperation; } if (CurrentOperation == operation.substraction) { double tmpBuffer = double.Parse(textBox1.Text); textBox1.Text = (double.Parse(buffer) - tmpBuffer).ToString(); CurrentOperation = operation.clearOperation; } if (CurrentOperation == operation.multiplication) { double tmpBuffer = double.Parse(textBox1.Text); textBox1.Text = (double.Parse(buffer) * tmpBuffer).ToString(); CurrentOperation = operation.clearOperation; } if (CurrentOperation == operation.division) { double tmpBuffer = double.Parse(textBox1.Text); textBox1.Text = (double.Parse(buffer) / tmpBuffer).ToString(); CurrentOperation = operation.clearOperation; } } } catch (Exception) { MessageBox.Show("Try input incorrect data"); } }
void dispatch(byte aaaaaa, byte bbbbbb, operation op) { var blazy = new Lazy<ushort>(() => route(bbbbbb, get)); route(aaaaaa, op, blazy); // Make sure that we called blazy.Value (for its side effects). System.Diagnostics.Debug.Assert(blazy.IsValueCreated); }
// TODO: double click (add variable "count" with if statement?) private void button5_Click(object sender, EventArgs e) { textBox1.Clear(); buffer = ""; // preferable double ckick CurrentOperation = operation.clearOperation; }