public Respuesta_StoredProcGenerico_Mod Exec_StoredProcGenerico(SP nombreSP, List <SqlParameter> parametros) { var oResult = new Respuesta_StoredProcGenerico_Mod(); try { using (Conexion = new SqlConnection(cadenaConexion)) { Conexion.Open(); using (var oComando = new SqlCommand(nombreSP.ToString(), Conexion)) { oComando.CommandType = System.Data.CommandType.StoredProcedure; oComando.Parameters.Clear(); oComando.Parameters.AddRange(parametros.ToArray()); using (var oLector = oComando.ExecuteReader()) { if (oLector.HasRows) { oResult.oDataTable.Load(oLector); } } var res = oComando.Parameters["@Codigo"].Value.ToString(); oResult.OperacionId = (OperacionEnum)Enum.Parse(typeof(OperacionEnum), oComando.Parameters["@Codigo"].Value.ToString()); oResult.OperacionDes = oComando.Parameters["@Descripcion"].Value.ToString(); oComando.Parameters.Clear(); } } } catch (Exception ex) { throw new Exception("Datos.Utileria_Dat.Exec_StoredProcGenerico() |Error:" + ex.ToString()); } return(oResult); }
public ConfigReadme() { vm = SP.GetService <ViewModelsService>().ConfigReadme; DataContext = vm; InitializeComponent(); }
private void GenerateNewLabels(List <DataRow> r) { var l = r.GroupBy(p => p[SQLGroup].ToString()); r.ForEach(x => { int _qty = SQLQty != "" ? Convert.ToInt32(x[SQLQty]):1; var _SP = new SP(Values.gDatos, "pAddEtiquetasDetalle"); _SP.AddParameterValue("codigo", txtCode.Text.ToUpper()); var _split = SQLSelect.Split('|'); string _dataString = ""; _split.ToList().ForEach(s => _dataString += x[s] + "|"); _dataString = _dataString.Substring(0, _dataString.Length - 1); _SP.AddParameterValue("parametros", SQLParameterString.Replace("'", "#")); _SP.AddParameterValue("datos", _dataString); _SP.AddParameterValue("qty", _qty); _SP.AddParameterValue("Grupo", SQLGroup != "" ? x[SQLGroup] : ""); _SP.Execute(); if (_SP.LastMsg.Substring(0, 2) != "OK") { CTWin.MsgError("Error: " + _SP.LastMsg); return; } Application.DoEvents(); }); }
private void SP_DataReceived(object sender, SerialDataReceivedEventArgs e) { byte[] revData = new byte[1024]; int revDataLen = 0; string ConvertChar2String; Thread.Sleep(10); revDataLen = SP.Read(revData, 0, SP.BytesToRead); ConvertChar2String = Encoding.UTF8.GetString(revData, 0, revDataLen); //MessageBox.Show(DateTime.Now.ToLocalTime().ToString()); //StreamWriter strmsave = new StreamWriter(FileName, false, System.Text.Encoding.UTF8); StreamWriter strmsave = File.AppendText(FileName); strmsave.Write(DateTime.Now.ToString() + "," + ConvertChar2String + "\r\n"); strmsave.Close(); textBox_Rev.Text = DateTime.Now.ToString() + "," + ConvertChar2String + "\r\n"; }
public void UpdateProcessAvoided(string process, string item, string inventory, double stat) { if (SP.FindProcess(ProjectName, TProcessType.ptMaterial, process, out PCmaterial)) { int maxI = PCmaterial.get_LineCount(TProcessPart.ppAvoidedProducts); for (int i = 0; i < maxI; i++) { string ObjName = PCmaterial.get_Line(TProcessPart.ppAvoidedProducts, i).ObjectName; if (ObjName == item) { PCmaterial.Edit(); PCmaterial.get_Line(TProcessPart.ppAvoidedProducts, i).Amount = inventory; string dist = PCmaterial.get_Line(TProcessPart.ppAvoidedProducts, i).Distribution.ToString(); if (dist != "dsNormal") { PCmaterial.get_Line(TProcessPart.ppAvoidedProducts, i).Distribution = TDistribution.dsNormal; PCmaterial.get_Line(TProcessPart.ppAvoidedProducts, i).StandardDeviation = stat; } else { PCmaterial.get_Line(TProcessPart.ppAvoidedProducts, i).StandardDeviation = stat; } PCmaterial.Update(); } } } }
public static bomba CriarBomba(SP.Entities.Interfaces.IBomba bomba) { return new bomba() { }; }
public ConfigCSharpCode() { InitializeComponent(); configService = SP.GetService <ConfigService>(); HighlightSyntax(); }
private void AdjustSecondaries(string initials, int direction) { switch (initials) { case "ST": AdjustAttribute("HP", direction); break; case "DX": SP.UpdateValue(); MV.UpdateValue(); break; case "IQ": AdjustAttribute("WL", direction); AdjustAttribute("PR", direction); break; case "HT": AdjustAttribute("FP", direction); SP.UpdateValue(); MV.UpdateValue(); break; } }
private void bIntr_Click(object sender, RoutedEventArgs e) { WindowIntr my = new WindowIntr(); bool? b = my.ShowDialog(); if (b == true) { //Window closed by OK //You can access the address entered by string s = my.tbAdd.Text; CCC = CCC + 18; inte = false; //Push pc onto stack SP.DCX(); m[SP.DEC16].DEC8 = PC.HB.DEC8; SP.DCX(); m[SP.DEC16].DEC8 = PC.LB.DEC8; //Branch PC.DEC16 = (ushort)Int32.Parse(my.tbAdd.Text, NumberStyles.HexNumber); UpdateInterrupt(); UpdateAll(); tbLI.Text = "INTR"; tbLIMenu.Text = "INTR"; } else { //Window closed by canceling } }
public static SP.Entities.itemvenda Translate(SP.Contract.Data.ItemVenda from) { var to = new SP.Entities.itemvenda(); to.preco = from.preco; return to; }
void transfere(object sender, EventArgs e) { string dado = SP.ReadLine(); string[] dados = dado.Split(','); textBox1.Text += dados[0]; textBox1.Text += "A \r\n"; textBox1.Select(textBox1.Text.Length, 0); textBox1.ScrollToCaret(); P = double.Parse(dados[1]); textBox2.Text += (P * Q / 100.0); textBox2.Text += "W\r\n"; textBox2.Select(textBox2.Text.Length, 0); textBox2.ScrollToCaret(); if (comboTensao.SelectedItem != null) { Q = int.Parse(comboTensao.SelectedItem.ToString()); } else { //Value is null } } //chart1.Series[0].Points.AddXY(t++, (Convert.ToDouble(dados[0]))/1000); chart1.Series[0].Points.Add(Convert.ToDouble(dados[0]) / 100); chart2.Series[0].Points.Add(Convert.ToDouble(dados[1]) / 100 * Q); //chart2.Series[1].Points.AddXY(t++, (Convert.ToDouble(dados[1])) / 100); // int x = chart1.Series[0].Points.Count; }
private void pHUDetDel() { if (VSHUDet.CurrentRow != null) { using (var _sp = new SP(Values.gDatos, "pHUDetDel")) { _sp.AddParameterValue("@HU", VSHUDet["HU", VSHUDet.CurrentRow.Index].Value); _sp.AddParameterValue("@Receival", VSHUDet["RECEIVAL CODE", VSHUDet.CurrentRow.Index].Value); _sp.AddParameterValue("@Line", VSHUDet["RECEIVAL LINE", VSHUDet.CurrentRow.Index].Value); _sp.AddParameterValue("@cod3", Values.COD3); try { _sp.Execute(); } catch (Exception ex) { CTWin.MsgError(ex.Message); return; } if (_sp.LastMsg.Substring(0, 2) != "OK") { CTWin.MsgError(_sp.LastMsg); return; } VS_Show(); VSHUDet_Show(); } } }
public LinkedList <Tuple <int, String, String> > getManagersPermissionsInStore(int storeId) { if (StoreManagement.getInstance().getStore(storeId) == null) { return(null); } LinkedList <Tuple <int, String, String> > ans = new LinkedList <Tuple <int, String, String> >(); StorePremissions SP; try { SP = this.privilegesOfaStore[storeId]; } catch (Exception e) { return(ans); } Dictionary <string, Premissions> privileges = SP.getAllPrivileges(); foreach (KeyValuePair <string, Premissions> entry in privileges) { foreach (KeyValuePair <string, Boolean> entry2 in entry.Value.getPrivileges()) { if (entry2.Value) { ans.AddFirst(new Tuple <int, String, String>(storeId, entry.Key, entry2.Key)); } } } return(ans); }
private void btnACheck_Click(object sender, EventArgs e) { if (MessageBox.Show("This will check and if possible store all the received parts. Are you sure?", "SIMPLISTICA", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { using (var _sp = new SP(Values.gDatos, "pProcessSimpleReceival")) { _sp.AddParameterValue("@Recepcion", txtEntrada.Value.ToString()); try { _sp.Execute(); } catch (Exception ex) { CTWin.MsgError(ex.Message); return; } if (_sp.LastMsg.Substring(0, 2) != "OK") { CTWin.MsgError(_sp.LastMsg); return; } //lstFlags["RECEIVED"] = true; } CTLM.StatusMsg("Process completed."); } }
private void generateCM(int pReceival, int pLine) { //sp preparation using (var _sp = new SP(Values.gDatos, "PGenerar_Paletags_linea")) { using (var _rs = new DynamicRS(string.Format("Select 0 from CMS_PALETAGS where Entrada='{0}' and Linea='{1}'", pReceival, pLine), Values.gDatos)) { _rs.Open(); //if no paletags for the line if (_rs.RecordCount == 0) { CTLM.StatusMsg(string.Format("Generating paletags for line {0}", pLine)); _sp.AddParameterValue("@Entrada", pReceival); _sp.AddParameterValue("@Linea", pLine); try { //generate them _sp.Execute(); } catch (Exception ex) { throw new Exception(ex.Message); } if (_sp.LastMsg.Substring(0, 2) != "OK") { throw new Exception(_sp.LastMsg); } } //now we print them } } }
void PressButton(int i) { if (SP.PlayButton(i, AdjustButtonStatusWPF, UpdateImageSourceWPF, DisplayVictoryMessageWPF)) { NewGame(AiPlayer.AiDifficulties.Easy, GameModesProcessor.Setting); } }
public ActionResult SuaSP(SP sp, HttpPostedFileBase fileUpload) { if (ModelState.IsValid) { if (fileUpload != null) { var fileName = Path.GetFileName(fileUpload.FileName); var path = Path.Combine(Server.MapPath("~/Images/"), fileName); sp.HinhSP = fileName; } var obj = db.SPs.SingleOrDefault(p => p.MaSP == sp.MaSP); obj.TenSP = sp.TenSP; obj.GiaBan = sp.GiaBan; obj.MoTa = sp.MoTa; obj.NgayCapNhat = sp.NgayCapNhat; obj.HinhSP = sp.HinhSP; obj.SLTon = sp.SLTon; obj.MATH = sp.MATH; db.SubmitChanges(); return(RedirectToAction("SanPham")); } ViewBag.MATH = new SelectList(db.THUONGHIEUs.ToList().OrderBy(n => n.TENTH), "MATH", "TENTH"); return(View(sp)); }
void Update() { if ((++fCount) % 4 == 0) { playerPos = player.GetComponent <Rigidbody>().transform.position.x; foreach (SpawnPionts SP in SPs) { trigger = SP.getTrigger(); if (!SP.getTriggered() && playerPos > trigger && playerPos < trigger + 2) { SP.setTriggered(true); SP.SpawnEnemy(); } } if (playerPos > 110 && !won) { score = fCount; won = true; VictoryText.SetActive(true); } if (won && score + 300 < fCount) { SceneManager.LoadScene(0); } } }
private void buttonOpenPort_Click(object sender, EventArgs e) { Graphics g = groupBox1.CreateGraphics(); if (SP.IsOpen == false) //没有打开串口 { try { SP.Open(); //MessageBox.Show("串口打开成功"); g.FillEllipse(Brushes.Red, groupBox1.Size.Width - 50, groupBox1.Size.Height - 30, 20, 20); buttonOpenPort.Text = "关闭串口"; toolStripStatusLabelPortStatus.Text = string.Format("Status:{0} Opend,{1},{2},{3},{4}", SP.PortName, SP.BaudRate.ToString(), SP.DataBits.ToString(), SP.Parity, SP.StopBits); comboBoxBaudRate.Enabled = comboBoxPortName.Enabled = comboBoxDataBits.Enabled = comboBoxParity.Enabled = comboBoxPortName.Enabled = comboBoxStopBits.Enabled = false; } catch (Exception e1) { MessageBox.Show(e1.Message, "错误提示!"); } } else { SP.Close(); g.FillEllipse(Brushes.Black, groupBox1.Size.Width - 50, groupBox1.Size.Height - 30, 20, 20); buttonOpenPort.Text = "打开串口"; toolStripStatusLabelPortStatus.Text = "Status:COM Port Closed "; comboBoxBaudRate.Enabled = comboBoxPortName.Enabled = comboBoxDataBits.Enabled = comboBoxParity.Enabled = comboBoxPortName.Enabled = comboBoxStopBits.Enabled = true; } }
private static void serial() { var pl = SP.multiple(d.command); var lp = pl[pl.Length - 1]; var st = DateTime.Now; foreach (var p in pl) { p.run(); if (p.ec != 0) { lp = p; break; } } var en = DateTime.Now; var rl = new SL(); rl.Capacity = pl.Length + 3; rl.Add($"time: {descTime(en-st)}"); foreach (var p in pl) { rl.Add($"process{p.order} id: {(p.pid<0?"N/A":p.pid.ToString())}"); } rl.Add($"exit code: {lp.ec}"); rl.Add(""); res = String.Join(eol, rl); ec = lp.ec; }
public DataTable ThongKeXuatKho(DateTime begin, DateTime end) { DataTable result = new CrystalReports.THINKPRODataset.ThongKeXKDataTable().Clone(); foreach (DataRow SP in data.Tables["SANPHAM"].Rows) { DataRow XK = result.NewRow(); XK["MASP"] = SP["ID_SP"]; XK["TENSP"] = SP["TENSP"]; XK["SOLUONGXUAT"] = 0; XK["GIABAN"] = SP.Field <int>("GIATIEN"); foreach (DataRow CTHD in _CHITIETHD.Rows) { if (XK["MASP"].ToString() == CTHD["ID_SP"].ToString()) { DataRow HD = _HOADON.AsEnumerable().SingleOrDefault(t => t.Field <string>("ID_HD") == CTHD.Field <string>("ID_HD")); if (HD != null) { if (DateTime.Compare(begin, HD.Field <DateTime>("NGAYLAPHD")) <= 0 && DateTime.Compare(HD.Field <DateTime>("NGAYLAPHD"), end) <= 0) { XK["SOLUONGXUAT"] = XK.Field <int>("SOLUONGXUAT") + CTHD.Field <int>("SOLUONG"); } } } } if (XK.Field <int>("SOLUONGXUAT") > 0) { result.Rows.Add(XK); } } return(result); }
private void BtnThem_Click(object sender, EventArgs e) { if (txtMa.Text != "" && txtTen.Text != "" && txtDG.Text != "" && txtSLT.Text != "") { try { SP sp = new SP(txtMa.Text, txtTen.Text, (float)Convert.ToDouble(txtDG.Text), Convert.ToInt32(txtSLT.Text), dpNN.Value.ToString("yyyy-MM-dd"), cmbDM.SelectedValue.ToString(), cmbNCC.SelectedValue.ToString()); if (BUS_SANPHAM.GetMaSP(txtMa.Text)) { BUS_SANPHAM.InsertSP(sp); QuanLySanPham_Load(sender, e); } else { MessageBox.Show("Trùng mã rồi kìa!", "Cảnh báo"); } } catch (FormatException) { MessageBox.Show("Bạn nhập sai kiểu dữ liệu"); } catch (SqlException) { MessageBox.Show("Lỗi kết nối!"); } } else { MessageBox.Show("Không được bỏ trống ", "Thông báo"); } }
////////// SPs ////////// private void pHUCabAdd(string HUType) { using (var _sp = new SP(Values.gDatos, "pHUCabAdd")) { _sp.AddParameterValue("@Dealer", VS["DEALER", VS.CurrentRow.Index].Value); _sp.AddParameterValue("@Route", VS["ROUTE", VS.CurrentRow.Index].Value); _sp.AddParameterValue("@Type", HUType); _sp.AddParameterValue("@cod3", Values.COD3); try { _sp.Execute(); } catch (Exception ex) { CTWin.MsgError(ex.Message); return; } if (_sp.LastMsg.Substring(0, 2) != "OK") { CTWin.MsgError(_sp.LastMsg); return; } VSHUCab_Show(_sp.LastMsg.Substring(3)); } }
//[ValidateInput(false)] public ActionResult ThemMoiSP(SP sanpham, HttpPostedFileBase fileUpLoad) { ViewBag.MATH = new SelectList(db.THUONGHIEUs.ToList().OrderBy(n => n.TENTH), "MATH", "TENTH"); if (fileUpLoad == null) { ViewBag.Thongbao = "Vui lòng chọn ảnh"; return(View()); } else { if (ModelState.IsValid) { var fileName = Path.GetFileName(fileUpLoad.FileName); var path = Path.Combine(Server.MapPath("~/Images/"), fileName); if (System.IO.File.Exists(path)) { ViewBag.Message = "Hình ảnh đã tồn tại"; } else { fileUpLoad.SaveAs(path); } sanpham.HinhSP = fileName; db.SPs.InsertOnSubmit(sanpham); db.SubmitChanges(); } else { ViewBag.Info = "Thông tin chưa hợp lệ"; } } return(RedirectToAction("SanPham", "Home")); }
private void TempServer_OnReceive(Helios.Net.NetworkData incomingData, IConnection connection) { ThreadHelper.TryLock(this.lockobj, () => { Request msg = default(Request); Response response = default(Response); msg = SP.Deserialize <Request>(incomingData.Buffer); Func <Request, Response> clientRequestAction = null; bool hasRequestAction = this._lisenter.ReceiveEvents.TryGetValue(msg.MessageType, out clientRequestAction); if (hasRequestAction) { response = clientRequestAction.Invoke(msg); } var sendBuffer = SP.Serialize(response); // serialize response message and send it to client connection.Send(new Helios.Net.NetworkData { Buffer = sendBuffer, Length = sendBuffer.Length, RemoteHost = connection.RemoteHost }); }, (error) => { throw error; }); }
public override Response SendRequest(Request request) { if (!ConnectIsOpen()) { _response = this.OnClientFailtoConnect(request); EnsureConnectionIsOpen(); SendRequest(request); } else { are.Reset(); byte[] buffer = SP.Serialize(request); _response = default(Response); Connection.BeginReceive((data, i) => { _response = SP.Deserialize <Response>(data.Buffer); are.Set(); }); Connection.Send(new NetworkData { Buffer = buffer, Length = buffer.Length, RemoteHost = RemoteHost }); are.WaitOne(); } return(_response); }
// commented as the migration finished //private async void btnMigrateToExchange_Click(object sender, EventArgs e) //{ // var _listFlags = lstFlags.Text.Split('|'); // if (_listFlags.Contains("EXCHANGE")) // { // MsgError("This account is already in Exchange."); // return; // } // if (_listFlags.Contains("MIGRATING")) // { // using (var client = new SshClient("proxy.val.local", Values.DefaultUserForServers, Values.DefaultPasswordForServers)) // { // client.Connect(); // var sshCommand = string.Format("pgrep -f imapsync.*{0}", txtUserCode.Text); // var result = client.RunCommand(sshCommand); // if (result.Result != "") // { // MsgError("Migration has not yet finished for this user."); // return; // } // if (MessageBox.Show("The process has finished, do you want to see the log file?", "", MessageBoxButtons.YesNo) == DialogResult.Yes) // { // using (var scpClient = new ScpClient("proxy.val.local", Values.DefaultUserForServers, Values.DefaultPasswordForServers)) // { // try // { // scpClient.Connect(); // scpClient.Download(string.Format("/root/{0}.log", txtUserCode.Text), new DirectoryInfo(Path.GetTempPath())); // System.Diagnostics.Process.Start("notepad.exe", string.Format("{0}{1}.log", Path.GetTempPath(), txtUserCode.Text)); // } catch (Exception ex) // { // if (MessageBox.Show(string.Format("log file error: {0}, do you want to continue?", ex.Message), "", MessageBoxButtons.YesNo) == DialogResult.No) // return; // } // } // if (MessageBox.Show("Do you want to finish the migration process?", "", MessageBoxButtons.YesNo) == DialogResult.Yes) // { // await changeUserFlag("EXCHANGE"); // MsgError(string.Format("Don't forget to setup forward from horde to {0}@systems.espackeuro.com.",txtUserCode.Text)); // return; // } // } // else return; // if (MessageBox.Show("Do you want to relaunch the sync process?", "", MessageBoxButtons.YesNo) == DialogResult.No) // return; // } // } // await changeUserFlag("MIGRATING"); // AD.EC.ServerName = "EXCHANGE01"; // AD.EC.UserName = @"SYSTEMS\administrador"; // AD.EC.Password = "******"; // var command = new PowerShellCommand(); // command.EC = AD.EC; // var c = string.Format(@"if (![bool](Get-Mailbox -Identity '{0}' -ErrorAction SilentlyContinue)) {{Enable-Mailbox -Identity '{0}';}}", txtUserCode.Text); // command.Command = c; // var res = await command.InvokeAsyncExchange(); // var Results = command.SResults; // // now the sync // using (var client = new SshClient("proxy.val.local", Values.DefaultUserForServers, Values.DefaultPasswordForServers)) // { // client.Connect(); // var sshCommand = string.Format("pgrep -f imapsync.*{0}", txtUserCode.Text); // var result = client.RunCommand(sshCommand); // if (result.Result != "") // { // MsgError("There is a running sync process for this user, aborting."); // return; // } // //var sshCommand = string.Format(@"sshpass -p {3} ssh -o StrictHostKeyChecking=no {2}@proxy.val.local ""nohup imapsync --host1 mail.espackeuro.com --port1 993 --ssl1 --user1 {0}@espackeuro.com --password1 {1} --host2 exchange01.systems.espackeuro.com --port2 143 --user2 {0} --password2 {1} --exchange2 --exclude '(?i)\b(Junk|Spam|Trash|Deleted\ Items)\b' --errorsmax 1000 & """, txtUserCode.Text, txtPWD.Text, Values.DefaultUserForServers, Values.DefaultPasswordForServers); // sshCommand = string.Format(@"imapsync --host1 mail.espackeuro.com --port1 993 --ssl1 --user1 {0}@espackeuro.com --password1 {1} --host2 exchange01.systems.espackeuro.com --port2 143 --user2 {0} --password2 {1} --exchange2 --exclude '(?i)\b(Junk|Spam|Trash|Deleted\ Items)\b' --errorsmax 1000 --addheader > {0}.log 2>&1 & ", txtUserCode.Text, txtPWD.Text); // result = client.RunCommand(sshCommand); // //var result = client.RunCommand(string.Format("/root/imapsync.sh {0} {1}", txtUserCode.Text, txtPWD.Text)); // client.Disconnect(); // lblStatus.Text = "MIGRATION CURRENTLY RUNNING."; // } //} private async Task <bool> changeUserFlag(string flag) { using (SP sp = new SP(gDatos, "pUppUserFlags")) { List <string> _flags = lstFlags.Text.Split('|').ToList <string>(); if (!_flags.Contains(flag)) { _flags.Add(flag); var _stringFlags = string.Join("|", _flags); sp.AddParameterValue("flags", _stringFlags); sp.AddParameterValue("UserCode", txtUserCode.Text); try { await sp.ExecuteAsync(); } catch (Exception ex) { MsgError(ex.Message); return(false); } if (sp.LastMsg != "OK") { MsgError(sp.LastMsg); return(false); } lstFlags.Value = _stringFlags; } return(true); } }
//_________________________________________________________________________ public bool SendComm(byte[] btaBuf, int iOffset, int iCount) { try { if (SP.IsOpen) { if (Own.ChBModeRequest.Checked) { SP.ReceivedBytesThreshold = GetReceivedBytesThreshold(btaBuf, 0); SP.DtrEnable = true; } else { SP.ReceivedBytesThreshold = 10; //SP.DtrEnable = true; } SP.Write(btaBuf, iOffset, iCount); } } catch (Exception exc) { OutMess("[COM] Ошибка при отправке: " + exc.Message + ". " + exc.StackTrace, Environment.NewLine); return(false); } OutMess("[" + SP.PortName + "] Ком. " + iCountRequest + "\t[" + Global.ByteArToStr(btaBuf, iOffset, iCount) + "]", iCountRequest == 0 ? Environment.NewLine : ""); return(true); }
private void List_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { var builder = new Android.Support.V7.App.AlertDialog.Builder(Activity); var position = e.Position; //var _unitNumber = list.Adapter.GetItem(position).ToString().Split('|')[1]; var _repairCode = list.Adapter.GetItem(position).ToString().Split('|')[0]; builder.SetTitle("Warning"); builder.SetIcon(Android.Resource.Drawable.IcDialogAlert); builder.SetMessage("Do you want to remove repair " + _repairCode + " from current load?"); builder.SetNegativeButton("No", delegate { }); builder.SetPositiveButton("Yes", delegate { var _SP = new SP(Values.gDatos, "pDelRepairs2Load"); _SP.AddParameterValue("RepairCode", _repairCode); _SP.AddParameterValue("LoadNumber", Loads.LoadNumber); _SP.Execute(); if (_SP.LastMsg != "OK") { throw (new Exception(_SP.LastMsg)); } Activity.RunOnUiThread(() => Toast.MakeText(Activity, "Repair " + _repairCode + " removed.", ToastLength.Long).Show()); ((ListLoadsRepairsAdapter)list.Adapter).NotifyDataSetChanged(); //list.InvalidateViews(); }); builder.Create().Show(); }
public override async Task <bool> process() { var _xconn = xmlMsgIn.Data.Element("connection"); //get the connection data var _parameters = xmlMsgIn.Data.Element("parameterCollection").Elements("parameter"); //get the parameters list string _dataBase = _xconn.Element("DataBase").Value.ToString(); //get the database string _procedureName = xmlMsgIn.Data.Element("procedureName").Value.ToString(); // get the procedure name var _server = new cServer(_xconn.Element("server")); //create the server object from the connection data try { using (var _conn = new cAccesoDatosNet(_server, _dataBase)) //create the normal connection using (var _sp = new SP(_conn, _procedureName)) // create the normal SP { _parameters.ToList().ForEach(p => { _sp.AddParameterValue(p.Element("parameterName").Value.ToString(), p.Element("parameterValue").Value.ToString()); }); //adds the parameters and the values to the sp from the parameter list await _sp.ExecuteAsync(); //execute the sp if (_sp.LastMsg.Substring(0, 2) != "OK") { throw new Exception(_sp.LastMsg); //error message } XElement _msgOut = new XElement("result"); //create the msgout xml data _msgOut.Add(_sp.XOutParameters.Root); //adds the out parameters to the data xmlMsgOut = new XDocument(_msgOut); // returns } } catch (Exception ex) { xmlMsgOut = new XDocument(new XElement("result", "ERROR: " + ex.Message)); } MsgOut = xmlMsgOut.ToString(); return(true); }
public override async Task <bool> process() { string _serial = xmlMsgIn.Data.Value; using (SP _sessionProc = new SP(InitialConnection.gDatos, "pStartSockSession")) { _sessionProc.AddParameterValue("Serial", _serial); try { await _sessionProc.ExecuteAsync(); if (_sessionProc.LastMsg != "OK") { throw new Exception(_sessionProc.LastMsg); } xmlMsgOut = new XDocument(); xmlMsgOut.Add(new XElement("result")); xmlMsgOut.Root.Add(_sessionProc.XOutParameters.Root); } catch (Exception ex) { xmlMsgOut = XDocument.Parse((new XElement("result", "ERROR: " + ex.Message)).ToString()); //returns error } } MsgOut = xmlMsgOut.ToString(); return(true); }
public ConfigMetadata() { vm = SP.GetService <ViewModelsService>().ConfigMetadata; DataContext = vm; InitializeComponent(); }
public static SP.Entities.tanque Translate(SP.Contract.Data.Tanque from) { SP.Entities.tanque to = new SP.Entities.tanque(); to.Tanque_ID = from.Tanque_ID; to.capacidade = from.capacidade; to.descricao = from.descricao; return to; }
public AttachmentListItem(string text, string filename, int itemID, SP.SPListDefinition parentList, string attachmentID, int versionNumber) : base(text) { ItemID = itemID; ParentList = parentList; AttachmentID = attachmentID; VersionNumber = versionNumber; Filename = filename; }
public Tanque Inserir(SP.Contract.Data.Tanque _tanque) { using (var ctx = new SOSPostoDataContext()) { var tanque = Translator.Translate(_tanque); ctx.tanque.AddObject(tanque); ctx.SaveChanges(); return Translator.Translate(tanque); } }
public static SP.Contract.Data.Produto Translate(SP.Entities.produto from) { var to = new SP.Contract.Data.Produto(); to.codigo_produto = from.Produto_ID; to.un = from.un; to.unSecundaria = from.unSecundaria; to.valor = from.valor; to.nome = from.nome; to.tipo = from.tipo; return to; }
public static SP.Contract.Data.Venda Translate(SP.Entities.venda from) { var to = new SP.Contract.Data.Venda(); to.codigo_venda = from.Venda_ID; to.dataEmissao = from.dataEmissao; to.dataSaida = from.dataSaida; to.serie = from.serie; to.totalDesconto = from.totalDesconto; to.codigo_cliente = from.Cliente_ID; to.codigo_funcionario = from.Usuário_ID; return to; }
public void Start(SP.ISPDatabase sharepointDatabase, SP.SPListDefinition list, UI.IProgressNotifier notifier) { notifier.Reset("Initializing..."); _Formatter.Initialize(); SP.SPFieldDefinitionCollection oFieldList = list.Fields; notifier.SetProgress("Retrieving records from Sharepoint database...", 0); System.Data.IDataReader oReader = sharepointDatabase.GetListItemsAsReader(list, true, false); oReader.Read(); int nTotalRecords = oReader.GetInt32(0); int nProcessedRecords = 0; notifier.SetProgress(string.Format("{0} records retrieved. Now exporting...", nTotalRecords.ToString()), 10); oReader.NextResult(); while (oReader.Read()) { int nListItemID = Convert.ToInt32(oReader["ID"]); _Formatter.BeginExportRow(nListItemID.ToString()); foreach (SP.SPFieldDefinition oField in oFieldList) { _Formatter.ExportField(oField.InternalName, sharepointDatabase.GetFieldText(oField, oReader)); } if (_Formatter.SupportAttachments && oReader.GetBoolean(oReader.GetOrdinal("HasAttachments"))) { DataTable oAttachmentList = sharepointDatabase.GetListItemAttachmentsList(list, nListItemID, true); int nCounter = 1; foreach (DataRow oAttachment in oAttachmentList.Rows) { _Formatter.ExportAttachment(nCounter, oAttachment["Folder"].ToString(), oAttachment["Filename"].ToString(), (byte[]) oAttachment["Content"]); nCounter++; } } _Formatter.EndExportRow(); nProcessedRecords++; if (nProcessedRecords % 100 == 0) notifier.SetProgress(null, (short) (10 + (nProcessedRecords * 90 / nTotalRecords))); } _Formatter.Terminate(); notifier.SetComplete(null); }
public SP(SP rule) : base(rule.spelling, rule.rules) { }
public DataTable GetAttachmentHistoryList(SP.SPListDefinition list, string documentID) { StringBuilder sbSQL = new StringBuilder(); sbSQL.Append("SELECT d.LeafName, v.Version AS VersionNumber, v.TimeCreated "); sbSQL.Append("FROM DocVersions v "); sbSQL.Append("INNER JOIN Docs d ON (d.id = v.id) "); sbSQL.AppendFormat("WHERE d.id = '{0}' ", documentID); sbSQL.Append("ORDER BY v.Version DESC "); return (_DB.ExecuteDataSet(sbSQL.ToString(), "History").Tables["History"]); }
public DataTable GetListItemAttachmentsList(SP.SPListDefinition list, int itemID, bool includeContent) { StringBuilder sbSQL = new StringBuilder(); if (list.ListType == SharepointListType.DocumenLibrary) { sbSQL.Append("SELECT content.Id AS DocID, content.DirName AS Folder, content.LeafName AS [Filename], CheckoutDate %CONTENT_FIELD%"); sbSQL.Append("FROM Docs content "); sbSQL.AppendFormat("WHERE content.ListId = '{0}' ", list.ID); sbSQL.AppendFormat("AND content.DocLibRowId = '{0}' ", itemID.ToString()); } else { sbSQL.Append("SELECT content.Id AS DocID, content.DirName AS Folder, content.LeafName AS [Filename], CAST(NULL AS DATETIME) AS CheckoutDate %CONTENT_FIELD%"); sbSQL.Append("FROM Docs location "); sbSQL.Append("INNER JOIN Docs content ON (content.ListId = location.ListId AND content.DirName = location.DirName + '/' + location.LeafName) "); sbSQL.AppendFormat("WHERE location.ListId = '{0}' ", list.ID); sbSQL.AppendFormat("AND location.LeafName = '{0}' ", itemID.ToString()); } if (includeContent) sbSQL.Replace("%CONTENT_FIELD%", ", content.Content "); else sbSQL.Replace("%CONTENT_FIELD%", string.Empty); return (_DB.ExecuteDataSet(sbSQL.ToString(), "Files").Tables["Files"]); }
public DataTable GetAttachmentHistoryList(SP.SPListDefinition list, string documentID) { StringBuilder sbSQL = new StringBuilder(); //2008-02-21: Fix to better handle a file when checked-out. // DocStreams.Level usually equals 1 for the last checked-in version. // DocStreams.Level equals 255 for the "pending" checked-out version (saved but not checked-in). // // When a document is pending (checked-out) there is 2 records in the Docs table // with the same Id. We can differentiate them by the version number (Version field) or by the // IsCurrentVersion flag. sbSQL.Append("SELECT d.LeafName, v.Version AS VersionNumber, v.TimeCreated "); sbSQL.Append("FROM DocVersions v "); sbSQL.Append("INNER JOIN Docs d ON (d.id = v.id AND d.IsCurrentVersion = 1) "); sbSQL.AppendFormat("WHERE d.id = '{0}' ", documentID); sbSQL.Append("ORDER BY v.Version DESC "); return (_DB.ExecuteDataSet(sbSQL.ToString(), "History").Tables["History"]); }
public DataTable GetListItemAttachmentsList(SP.SPListDefinition list, int itemID, bool includeContent) { StringBuilder sbSQL = new StringBuilder(); if (list.ListType == SharepointListType.DocumenLibrary) { //2008-02-21: Fix to better handle a file when checked-out. // DocStreams.Level usually equals 1 for the last checked-in version. // DocStreams.Level equals 255 for the "pending" checked-out version (saved but not checked-in). // // When a document is pending (checked-out) there is 2 records in the Docs table // with the same Id. We can differentiate them by the version number (Version field) or by the // IsCurrentVersion flag. sbSQL.Append("SELECT docs.Id AS DocID, docs.DirName AS Folder, docs.LeafName AS [Filename], CheckoutDate %CONTENT_FIELD%"); sbSQL.Append("FROM Docs docs "); sbSQL.Append("INNER JOIN DocStreams content ON (content.Id = docs.Id AND content.Level < 255) "); sbSQL.AppendFormat("WHERE docs.ListId = '{0}' ", list.ID); sbSQL.AppendFormat("AND docs.DocLibRowId = '{0}' ", itemID.ToString()); sbSQL.AppendFormat("AND docs.HasStream = CONVERT(bit, 1) "); sbSQL.AppendFormat("AND docs.IsCurrentVersion = CONVERT(bit, 1) "); } else { sbSQL.Append("SELECT docs.Id AS DocID, docs.DirName AS Folder, docs.LeafName AS [Filename], CAST(NULL AS DATETIME) AS CheckoutDate %CONTENT_FIELD%"); sbSQL.Append("FROM Docs parentItem "); sbSQL.Append("INNER JOIN DocStreams content ON (content.ParentId = parentItem.Id) "); sbSQL.Append("INNER JOIN Docs docs ON (docs.Id = content.Id) "); sbSQL.AppendFormat("WHERE parentItem.ListId = '{0}' ", list.ID); sbSQL.AppendFormat("AND parentItem.LeafName = '{0}' ", itemID.ToString()); } if (includeContent) sbSQL.Replace("%CONTENT_FIELD%", ", content.Content "); else sbSQL.Replace("%CONTENT_FIELD%", string.Empty); return (_DB.ExecuteDataSet(sbSQL.ToString(), "Files").Tables["Files"]); }
private static SP[] getSubset(SP[] set_, string quoteSource_) { return set_.Where(x => String.Compare(quoteSource_, x.QS, StringComparison.OrdinalIgnoreCase) == 0).ToArray(); }
public ListNode(SP.SPListDefinition list) : base(list.Title, list.ID) { SharepointList = list; int nImageIndex = 1; if (SharepointList.ListType == SP.SharepointListType.DocumenLibrary) nImageIndex = 2; this.ImageIndex = nImageIndex; this.SelectedImageIndex = nImageIndex; }
public AttachmentListItem(string text, string filename, int itemID, SP.SPListDefinition parentList, string attachmentID) : this(text, filename, itemID, parentList, attachmentID, LASTEST_COMMITED_VERSION) { }
/// <summary> /// This method loads a listitem attachments. /// /// In case of a document library, the nature of the list (contains files by itself), /// this list will always contain a single attachment file. /// </summary> /// <param name="spList"></param> /// <param name="spItemID"></param> private void LoadPreviewAttachmentList(SP.SPListDefinition spList, int spItemID) { _PreviewAttachmentList.Nodes.Clear(); if (spList == null || spItemID == 0) return; // extract the attachments linked to the currently selected list item. DataTable oFilesTable = _ExecContext.SPDatabase.GetListItemAttachmentsList(spList, spItemID, false); if (oFilesTable != null) { // add an item in the treeview for each attachment. foreach (DataRow oFileRow in oFilesTable.Rows) { string sFilename = oFileRow["Filename"].ToString(); string sText = sFilename; string sAttachmentID = oFileRow["DocID"].ToString(); if (!oFileRow.IsNull("CheckoutDate")) sText = string.Format("{0} ===> a pending version is available (expand to see)", sFilename); AttachmentListItem oAttachmentNode = new AttachmentListItem(sText, sFilename, spItemID, spList, sAttachmentID); _PreviewAttachmentList.Nodes.Add(oAttachmentNode); //if the file is currently checked out, we display the information //next to the filename. if (!oFileRow.IsNull("CheckoutDate")) { sText = string.Format("pending version checked-out on: {0:yyyy/MM/dd hh:mm}", oFileRow["CheckoutDate"]); AttachmentListItem oHistoryNode = new AttachmentListItem(sText, sFilename, spItemID, spList, sAttachmentID, AttachmentListItem.CHECKED_OUT_VERSION); oAttachmentNode.Nodes.Add(oHistoryNode); } // extract the previous versions of the attachment (if any). DataTable oHistory = _ExecContext.SPDatabase.GetAttachmentHistoryList(spList, sAttachmentID); foreach (DataRow oHistoryRow in oHistory.Rows) { sText = string.Format("v.{0} ({1:yyyy-MM-dd HH:mm:ss})", oHistoryRow["VersionNumber"], oHistoryRow["TimeCreated"]); string sHistoryFilename = string.Format("{0}-v{1}{2}", System.IO.Path.GetFileNameWithoutExtension(sFilename), oHistoryRow["VersionNumber"], System.IO.Path.GetExtension(sFilename)); AttachmentListItem oHistoryNode = new AttachmentListItem(sText, sHistoryFilename, spItemID, spList, sAttachmentID, Convert.ToInt32(oHistoryRow["VersionNumber"])); oAttachmentNode.Nodes.Add(oHistoryNode); } } } }
public PreviewListItem(string text, int itemID, SP.SPListDefinition parentList) :base(text) { ItemID = itemID; ParentList = parentList; }
private SP decode_SP() { push("SP"); bool decoded = true; int s0 = index; var e0 = new List<Rule>(); Rule rule; decoded = false; if (!decoded) { { var e1 = new List<Rule>(); int s1 = index; decoded = true; if (decoded) { bool f1 = true; int c1 = 0; for (int i1 = 0; i1 < 1 && f1; i1++) { rule = decode_NumericValue("%x20", "[\\x20]", 1); if ((f1 = rule != null)) { e1.Add(rule); c1++; } } decoded = c1 == 1; } if (decoded) e0.AddRange(e1); else index = s1; } } rule = null; if (decoded) rule = new SP(text.Substring(s0, index - s0), e0); else index = s0; pop("SP", decoded, index - s0); return (SP)rule; }