public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: return ParameterPrefix == null? value: ParameterPrefix + value; case ConvertType.SprocParameterToName: var name = (string)value; if (name.Length > 0) { if (name[0] == ':') return name.Substring(1); if (ParameterPrefix != null && name.ToUpper(CultureInfo.InvariantCulture).StartsWith(ParameterPrefix)) { return name.Substring(ParameterPrefix.Length); } } break; case ConvertType.ExceptionToErrorNumber: if (value is OracleException) return ((OracleException)value).Code; break; } return SqlProvider.Convert(value, convertType); }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryField: case ConvertType.NameToQueryTable: if (QuoteIdentifiers) { string name = value.ToString(); if (name.Length > 0 && name[0] == '"') return value; return '"' + name + '"'; } break; case ConvertType.NameToQueryParameter: case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: return "@" + value; case ConvertType.SprocParameterToName: if (value != null) { string str = value.ToString(); return str.Length > 0 && str[0] == '@' ? str.Substring(1) : str; } break; } return value; }
public override object Convert(object value, ConvertType convertType) { string name = (string)value; switch (convertType) { case ConvertType.NameToQueryParameter: case ConvertType.NameToParameter: return "@" + name; case ConvertType.NameToQueryField: case ConvertType.NameToQueryTable: if (name.Length > 0 && name[0] == '[') return value; if (name.IndexOf('.') > 0) value = string.Join("].[", name.Split('.')); return "[" + value + "]"; case ConvertType.ParameterToName: return name.Length > 0 && name[0] == '@'? name.Substring(1): name; case ConvertType.ExceptionToErrorNumber: if (value is SQLiteException) return ((SQLiteException)value).ErrorCode; break; } return value; }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: { var name = "@" + value; if (name.Length > 27) name = name.Substring(0, 27); return name; } case ConvertType.NameToQueryField: case ConvertType.NameToQueryFieldAlias: case ConvertType.NameToQueryTableAlias: { var name = value.ToString(); if (name.Length > 28 || name.Length > 0 && name[0] == '[') return value; } return "[" + value + "]"; case ConvertType.NameToDatabase: case ConvertType.NameToOwner: case ConvertType.NameToQueryTable: if (value != null) { var name = value.ToString(); if (name.Length > 28 || name.Length > 0 && (name[0] == '[' || name[0] == '#')) return value; if (name.IndexOf('.') > 0) value = string.Join("].[", name.Split('.')); return "[" + value + "]"; } break; case ConvertType.SprocParameterToName: if (value != null) { var str = value.ToString(); return str.Length > 0 && str[0] == '@'? str.Substring(1): str; } break; } return value; }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: return "@" + value; case ConvertType.NameToQueryField: case ConvertType.NameToQueryFieldAlias: case ConvertType.NameToQueryTableAlias: { var name = value.ToString(); if (name.Length > 0 && name[0] == '[') return value; } return "[" + value + "]"; case ConvertType.NameToDatabase: case ConvertType.NameToOwner: case ConvertType.NameToQueryTable: { var name = value.ToString(); if (name.Length > 0 && name[0] == '[') return value; if (name.IndexOf('.') > 0) value = string.Join("].[", name.Split('.')); } return "[" + value + "]"; case ConvertType.SprocParameterToName: if (value != null) { var str = value.ToString(); return str.Length > 0 && str[0] == '@'? str.Substring(1): str; } break; case ConvertType.ExceptionToErrorNumber: if (value is OleDbException) { var ex = (OleDbException)value; if (ex.Errors.Count > 0) return ex.Errors[0].NativeError; } break; } return value; }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: return ":" + value; } return value; }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: case ConvertType.NameToParameter: return "@" + value; case ConvertType.NameToQueryField: { string name = value.ToString(); if (name.Length > 0 && name[0] == '[') return value; } return "[" + value + "]"; case ConvertType.NameToQueryTable: { string name = value.ToString(); if (name.Length > 0 && name[0] == '[') return value; if (name.IndexOf('.') > 0) value = string.Join("].[", name.Split('.')); } return "[" + value + "]"; case ConvertType.ParameterToName: if (value != null) { string str = value.ToString(); return str.Length > 0 && str[0] == '@'? str.Substring(1): str; } break; case ConvertType.ExceptionToErrorNumber: if (value is AseException) { AseException ex = (AseException)value; if (ex.Errors.Count > 0) return ex.Errors[0].MessageNumber; } break; } return value; }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.ExceptionToErrorNumber: if (value is SqlCeException) return ((SqlCeException)value).NativeError; break; } return SqlProvider.Convert(value, convertType); }
public override object Convert(object value, ConvertType convertType) { if (ConvertType.NameToQueryField == convertType) { return FieldMarker + value; } if (ConvertType.NameToQueryTable == convertType) { return TableMarker + value; } return base.Convert(value, convertType); }
static TaiKhoanDAO() { try { //<add key="Cache_TaiKhoan" value="true"/> Cache = ConvertType.ToBoolean(System.Configuration.ConfigurationManager.AppSettings.Get("Cache_TaiKhoan")); } catch { Cache = false; } }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: return("@" + value.ToString().Replace(" ", string.Empty)); case ConvertType.NameToQueryField: case ConvertType.NameToQueryFieldAlias: case ConvertType.NameToQueryTableAlias: { var name = value.ToString(); if (name.Length > 0 && name[0] == '[') { return(value); } } return("[" + value + "]"); case ConvertType.NameToDatabase: case ConvertType.NameToOwner: case ConvertType.NameToQueryTable: { var name = value.ToString(); if (name.Length > 0 && name[0] == '[') { return(value); } if (name.IndexOf('.') > 0) { value = string.Join("].[", name.Split('.')); } } return("[" + value + "]"); case ConvertType.SprocParameterToName: if (value != null) { var str = value.ToString(); return(str.Length > 0 && str[0] == '@'? str.Substring(1): str); } break; } return(value); }
// The method to call Game Objects methods //---------------------------------------- public void sendTopic() { Component[] cs = (Component[])targetGameObject.GetComponents(typeof(Component)); foreach (Component c in cs) { //Debug.Log("name: "+c.name+" type: "+c.GetType() +" basetype: "+c.GetType().BaseType); PropertyInfo propertyInfo = c.GetType().GetProperty(topicMessage.property); if (propertyInfo != null) { //Debug.Log ("------->> Good. Property exist. Its name is : " + propertyInfo.Name + " and its value is: " + propertyInfo.GetValue ((System.Object)c, null)); System.Object obj = (System.Object)c; if (propertyInfo.PropertyType.Equals(typeof(Vector3))) { XmlNode[] node = (XmlNode[])topicMessage.value; Vector3 vect = ConvertType.vector3FromXmlNode(node, MqttSetting.GAMA_POINT); propertyInfo.SetValue(obj, (object)vect, null); } else { try{ XmlNode[] node = (XmlNode[])topicMessage.value; XmlNode n = node[1]; object val = Convert.ChangeType(n.Value, propertyInfo.PropertyType); propertyInfo.SetValue(obj, val, null); }catch (Exception ex) { Debug.Log("Error: Please check the property value conversion - " + ex.Message); } } } else { //Debug.Log ("------->> Sorry. Property doesn't exist : "+property +" and component is "+ c.name); } /* * foreach (PropertyInfo fi in c.GetType().GetProperties ()) { * System.Object obj = (System.Object)c; * if (fi.Name.Equals ("isKinematic")) { * Debug.Log("------->> Good. I have got it. "); * object val = (Boolean)true; * fi.SetValue( * obj, * val, * null); * } * * //Debug.Log("fi name: "+fi.Name+" type: "+fi.PropertyType); * } */ } }
private DialoguesNPC_Template CreateTemplate(string line) { string id = string.Empty; string npc_id = string.Empty; int first_relationship = 0; int end_relationship = 0; Place condition_place = Place.Null; List <Dialogue> dialoguesList = new List <Dialogue>(); CreateEvent condition_event = CreateEvent.Null; string ideasIdList = string.Empty; string[] entries = line.Split(','); for (int i = 0; i < entries.Length; i++) { string entry = entries[i]; switch (entry) { case INST_SET_ID: id = entries[++i]; break; case INST_SET_NpcID: npc_id = entries[++i]; break; case INST_SET_FirstRelationship: first_relationship = int.Parse(entries[++i]); break; case INST_SET_EndRelationship: end_relationship = int.Parse(entries[++i]); break; case INST_SET_PlaceCondition: condition_place = ConvertType.CheckPlace(entries[++i]); break; case INST_SET_Dialogue: dialoguesList.Add(new Dialogue(entries[++i], ConvertType.CheckFeel(entries[++i]))); break; case INST_SET_Event: condition_event = ConvertType.CheckCreateEvent(entries[++i]); break; case INST_SET_CreateIdea: ideasIdList = ConvertType.CheckString(entries[++i]); break; } } return(new DialoguesNPC_Template(id, npc_id, first_relationship, end_relationship, condition_place, dialoguesList, condition_event, ideasIdList)); }
private void button2_Click(object sender, EventArgs e) { try { bool isnew = true; int vistrisua = 0; dm_vinabiz dm = new dm_vinabiz(); dm.id = ConvertType.ToInt(txt_id.Text); dm.name = txt_name.Text.Trim(); dm.path = txt_path.Text; dm.paren_id = comboBox1.SelectedValue.Equals(-1) ? (int?)null : ConvertType.ToInt(comboBox1.SelectedValue); dm.isLoai = ConvertType.ToInt(cmbLoai.SelectedValue); dm.orderid = ConvertType.ToInt(txt_orderid.Text); if (dm.id == 0) { isnew = true; SQLDatabase.AdddmVinabiz(dm); } else { isnew = false; vistrisua = dataGridView1.SelectedRows[0].Index; SQLDatabase.Updatedm_vinabiz(dm); } int vttruoc = comboBox1.SelectedIndex; BindDM_NhomVatGia(); BindDMSanPham(ConvertType.ToInt(comboBox1.SelectedValue)); comboBox1.SelectedIndex = vttruoc; if (isnew) { int nRowIndex = dataGridView1.Rows.Count - 1; if (dataGridView1.Rows.Count - 1 >= nRowIndex) { dataGridView1.FirstDisplayedScrollingRowIndex = nRowIndex; dataGridView1.Rows[nRowIndex].Selected = true; dataGridView1.Rows[nRowIndex].Cells[0].Selected = true; } } else { dataGridView1.Rows[vistrisua].Selected = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "button2_Click"); } }
private void button1_Click(object sender, EventArgs e) { string strsql = ""; strsql = string.Format("select max(orderid) as vitri from dm_vinabiz where isloai={0}", cmbLoai.SelectedValue); DataTable table = SQLDatabase.ExcDataTable(strsql); txt_name.Text = ""; txt_id.Text = ""; txt_orderid.Text = (ConvertType.ToInt(table.Rows[0]["vitri"]) + 1).ToString(); txt_path.Text = ""; txt_name.Focus(); }
private void btn_scanner_giaihan_tang_Click(object sender, EventArgs e) { try { if (ConvertType.ToInt(txtGioiHan.Text) >= 5000000) { return; } txtGioiHan.Text = (ConvertType.ToInt(txtGioiHan.Text) + gioihan_bat).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message, "btn_scanner_giaihan_tang_Click"); } }
private void btn_scanner_dosau_tang_Click(object sender, EventArgs e) { try { if (ConvertType.ToInt(txtDoSau.Text) >= 20) { return; } txtDoSau.Text = (ConvertType.ToInt(txtDoSau.Text) + dosau_bat).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message, "btn_scanner_dosau_tang_Click"); } }
private void btn_scanner_timeout_tang_Click(object sender, EventArgs e) { try { if (ConvertType.ToInt(txt_timeout.Text) >= 100000) { return; } txt_timeout.Text = (ConvertType.ToInt(txt_timeout.Text) + timeout_bat).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message, "btn_scanner_sleep_tang_Click"); } }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: return("?"); case ConvertType.NameToParameter: return(value); } return(base.Convert(value, convertType)); }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: return "?"; case ConvertType.NameToParameter: return value; } return base.Convert(value, convertType); }
public void ProcessTopic(object obj) { setAllProperties(obj); if (targetGameObject != null) { XmlNode[] positionNode = (XmlNode[])topicMessage.position; Vector3 position = ConvertType.vector3FromXmlNode(positionNode, MqttSetting.GAMA_POINT); sendTopic(position); } }
private void btn_scanner_soluong_giam_Click(object sender, EventArgs e) { try { if (ConvertType.ToInt(txtSoLuong.Text) <= 0) { return; } txtSoLuong.Text = (ConvertType.ToInt(txtSoLuong.Text) - soluong_bat).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message, "btn_scanner_soluong_giam_Click"); } }
private void button1_Click(object sender, EventArgs e) { PleaseWait objPleaseWait = null; try { objPleaseWait = new PleaseWait(); objPleaseWait.Show(); objPleaseWait.Update(); saveas = new List <SaveAs>(); foreach (DataGridViewRow row in dataGridView1.SelectedRows) { int id = ConvertType.ToInt(row.Cells["id"].Value.ToString()); string id_chon = row.Cells["id_chon"].Value.ToString(); string ma_chon = row.Cells["ma_chon"].Value.ToString(); string orderid_chon = row.Cells["orderid_chon"].Value.ToString(); string parentid_chon = row.Cells["parentid_chon"].Value.ToString(); string path_chon = row.Cells["path_chon"].Value.ToString(); saveas.Add(new SaveAs() { id = ConvertType.ToInt(row.Cells["id"].Value.ToString()), id_chon = row.Cells["id_chon"].Value.ToString(), ma_chon = row.Cells["ma_chon"].Value.ToString(), name_chon = row.Cells["name_chon"].Value.ToString(), orderid_chon = row.Cells["orderid_chon"].Value.ToString(), parentid_chon = row.Cells["parentid_chon"].Value.ToString(), path_chon = row.Cells["path_chon"].Value.ToString() }); SQLDatabase.DelSaveAs(new SaveAs() { id = ConvertType.ToInt(row.Cells["id"].Value.ToString()) }); } if (objPleaseWait != null) { objPleaseWait.Close(); } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { if (objPleaseWait != null) { objPleaseWait.Close(); } MessageBox.Show(ex.Message, "button1_Click"); } }
protected override SqlExpression TranslateConverter(SqlUnary uo) { if (uo.SqlType.IsNumeric) { if (prevConvert != ConvertType.Number) { sb.Append("TO_NUMBER("); prevConvert = ConvertType.Number; Visit(uo.Operand); sb.Append(")"); } else { Visit(uo.Operand); } } else if (uo.SqlType.IsString || uo.SqlType.IsChar) { if (prevConvert != ConvertType.Char) { prevConvert = ConvertType.Char; sb.Append("TO_CHAR("); Visit(uo.Operand); sb.Append(")"); } else { Visit(uo.Operand); } } else if (uo.ClrType == typeof(DateTime)) { if (prevConvert != ConvertType.Date) { prevConvert = ConvertType.Date; sb.Append("TO_DATE("); Visit(uo.Operand); sb.Append(",'YYYY-MM-DD HH24:MI:SS')"); } else { Visit(uo.Operand); } } else { Visit(uo.Operand); } return(uo); }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryField: case ConvertType.NameToQueryFieldAlias: case ConvertType.NameToQueryTable: case ConvertType.NameToQueryTableAlias: case ConvertType.NameToDatabase: case ConvertType.NameToOwner: if (value != null && IdentifierQuoteMode != PostgreSQLIdentifierQuoteMode.None) { var name = value.ToString(); if (name.Length > 0 && name[0] == '"') { return(name); } if (IdentifierQuoteMode == PostgreSQLIdentifierQuoteMode.Quote || name #if NETFX_CORE .ToCharArray() #endif .Any(c => char.IsUpper(c) || char.IsWhiteSpace(c))) { return('"' + name + '"'); } } break; case ConvertType.NameToQueryParameter: case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: return(":" + value); case ConvertType.SprocParameterToName: if (value != null) { var str = value.ToString(); return(str.Length > 0 && str[0] == ':' ? str.Substring(1) : str); } break; } return(value); }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: return("@" + value); case ConvertType.NameToQueryField: case ConvertType.NameToQueryFieldAlias: case ConvertType.NameToQueryTableAlias: { var name = value.ToString(); if (name.Length > 0 && name[0] == '[') { return(value); } } return("[" + value + "]"); case ConvertType.NameToDatabase: case ConvertType.NameToOwner: case ConvertType.NameToQueryTable: { var name = value.ToString(); if (name.Length > 0 && name[0] == '[') { return(value); } if (name.IndexOf('.') > 0) { value = string.Join("].[", name.Split('.')); } } return("[" + value + "]"); case ConvertType.SprocParameterToName: { var name = (string)value; return(name.Length > 0 && name[0] == '@'? name.Substring(1): name); } } return(value); }
public IConvertibleFile GetConvertibleFile(ImportedFileModel fileModel, ConvertType type) { var convertible = type switch { ConvertType.Step => (IConvertibleFile) new StepConvertibleFile(fileModel), ConvertType.Stl => new StlConvertibleFile(fileModel), ConvertType.Obj => new ObjConvertibleFile(fileModel), _ => new StepConvertibleFile(fileModel) }; convertible.Convert(); return(convertible); } }
static void _ConvertAll(ConvertType eConvertType) { if (ms_locked) { return; } ms_locked = true; ms_beginTime = System.DateTime.Now.Ticks; var dir = Path.GetFullPath(Application.dataPath + ExcelConfig.XLSX_PATH); string[] strList = Directory.GetFiles(dir, "Z-资源配置表.xls", SearchOption.AllDirectories); Debug.LogFormat("[npoi] start convert sum = {0}", strList.Length); ms_num = 0; contents.Clear(); for (int i = 0; i < strList.Length; ++i) { string name = Path.GetFileName(strList[i]); ConvertParams param = new ConvertParams { name = name, index = i, sum = strList.Length, applicationPath = Application.dataPath, eConvertType = eConvertType, }; contents.Add(param); } int iThreadMax = 1; if (iThreadMax == 0) { _ConvertTable(contents); } else { int iMaxThread = iThreadMax <= contents.Count ? iThreadMax : contents.Count; Thread[] threads = new Thread[iMaxThread]; for (int i = 0; i < threads.Length; ++i) { threads[i] = new Thread(_ConvertTable); threads[i].Priority = System.Threading.ThreadPriority.Highest; threads[i].Start(contents); } } }
private void thêmToolStripMenuItem_Click(object sender, EventArgs e) { try { dm_vinabiz_LoaiDinhNghia model = new dm_vinabiz_LoaiDinhNghia(); model.name = ""; model.orderid = ConvertType.ToInt(SQLDatabase.ExcDataTable("select max(orderid) from dm_vinabiz_LoaiDinhNghia").Rows[0][0]) + 1; model.isAct = false; SQLDatabase.Adddm_vinabiz_LoaiDinhNghia(model); BindDM_loaidinhnghia(); } catch (Exception ex) { MessageBox.Show(ex.Message, "thêmToolStripMenuItem2_Click"); } }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.ExceptionToErrorNumber: { if (value is SQLiteException) return ((SQLiteException) value).ErrorCode; break; } } return SqlProvider.Convert(value, convertType); }
protected override void MapFromDatabase(IDataReader reader) { base.MapFromDatabase(reader); AccessDetailsEntityDetail.UniqueIdentifier = ConvertType.ToInt64(reader["UniqueIdentifier"].ToString()); AccessDetailsEntityDetail.AccDate = ConvertType.ToString(reader["AccDate"].ToString()); AccessDetailsEntityDetail.AccTime = ConvertType.ToDecimal(reader["AccTime"].ToString()); AccessDetailsEntityDetail.DoorNo = ConvertType.ToString(reader["DoorNo"].ToString()); AccessDetailsEntityDetail.EmpCode = ConvertType.ToString(reader["EmpCode"].ToString()); AccessDetailsEntityDetail.EmpName = ConvertType.ToString(reader["EmpName"].ToString()); AccessDetailsEntityDetail.Empno = ConvertType.ToString(reader["Empno"].ToString()); AccessDetailsEntityDetail.Flg = ConvertType.ToString(reader["Flg"].ToString()); AccessDetailsEntityDetail.RNo = ConvertType.ToInt64(reader["RNo"].ToString()); AccessDetailsEntityDetail.Status = ConvertType.ToString(reader["Status"].ToString()); }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: // Use positional parameters rather than named parameters; return("?"); default: return(base.Convert(value, convertType)); } }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.ExceptionToErrorNumber: if (value is SqlCeException) { return(((SqlCeException)value).NativeError); } break; } return(SqlProvider.Convert(value, convertType)); }
internal bool VerifyExport(ConvertType convertType) { if (convertType == ConvertType.kFromPanoramaTo6Sided) { for (int i0 = 0; i0 < faceSuffixes.Length; ++i0) { if (string.IsNullOrEmpty(faceSuffixes[i0]) != false) { return(false); } } } return(true); }
/// <summary> /// 转换Solution /// </summary> /// <param name="slnFileName">sln文件</param> /// <param name="convertType">转换类型</param> public static void ParseSolution(string slnFileName, ConvertType convertType) { //读取sln文件内容 string[] slnContextLines = ReadSlnFile(slnFileName); //获取csproj文件路径 List <string> csprojs = GetCSProjFileName(slnFileName, slnContextLines); //修改sln文件 ModifySln(slnFileName, slnContextLines, convertType); //修改csproj文件 ModifyCSProjFile(csprojs, convertType); }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryField: case ConvertType.NameToQueryTable: if (QuoteIdentifiers) { string name = value.ToString(); if (name.Length > 0 && name[0] == '"') { return(value); } return('"' + name + '"'); } break; case ConvertType.NameToQueryParameter: case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: return("@" + value); case ConvertType.SprocParameterToName: if (value != null) { string str = value.ToString(); return(str.Length > 0 && str[0] == '@' ? str.Substring(1) : str); } break; case ConvertType.ExceptionToErrorNumber: if (value is FbException) { FbException ex = (FbException)value; if (ex.Errors.Count > 0) { return(ex.Errors[0].Number); } } break; } return(value); }
private void GetCheckTreeViewNode(TreeNode node, ref List <int> listid) { foreach (TreeNode item in node.Nodes) { if (item.Checked) { listid.Add(ConvertType.ToInt(item.Tag)); } if (item.Nodes.Count > 0) { this.GetCheckTreeViewNode(item, ref listid); } } }
public long Convert(long Value, ConvertType type) { long result; if (type == ConvertType.DecimalToBinary) { result = ConvertDecimalToBin(Value); } else { result = ConvertBinToDecimal(Value); } return(result); }
private void Awake() { _totalItem = 0; baseItemShopSlots = new List <BaseItemSellingSlot>(); _inventoryContainer = InventoryContainer.Instance; _characterStatusController = CharacterStatusController.Instance; _itemTemplateController = ItemTemplateController.Instance; _notificationController = NotificationController.Instance; _placesController = PlacesController.Instance; _storeContoller = StoreContoller.Instance; _placeId = ConvertType.GetPlaceId(_place); _inventoryContainer.OnInventoryUpdated.AddListener(Initializing); }
/// <summary> /// Sends an event indicating a call to convert for an Input binding /// </summary> /// <param name="type">The type of object we're converting to</param> /// <param name="properties">Any other properties to send with the event</param> /// <param name="measurements">Any other measurements to send with the event</param> public void TrackConvert(ConvertType type, IDictionary <string, string> properties = null, IDictionary <string, double> measurements = null) { try { properties ??= new Dictionary <string, string>(); properties.Add(TelemetryPropertyName.Type.ToString(), type.ToString()); this.TrackEvent(TelemetryEventName.Convert, properties, measurements); } catch (Exception ex) { // We don't want errors sending telemetry to break the app, so just log and move on Debug.Fail($"Error sending event Create : {ex.Message}"); } }
protected override void MapFromDatabase(IDataReader reader) { base.MapFromDatabase(reader); CallLetterEntityDetail.UniqueIdentifier = ConvertType.ToInt64(reader["UniqueIdentifier"].ToString()); CallLetterEntityDetail.CallDate = ConvertType.ToSystem.DateTime(reader["CallDate"].ToString()); CallLetterEntityDetail.CallNo = ConvertType.ToSystem.Int64(reader["CallNo"].ToString()); CallLetterEntityDetail.CandAdd = ConvertType.ToSystem.String(reader["CandAdd"].ToString()); CallLetterEntityDetail.CandTo = ConvertType.ToSystem.String(reader["CandTo"].ToString()); CallLetterEntityDetail.CompCode = ConvertType.ToSystem.String(reader["CompCode"].ToString()); CallLetterEntityDetail.ContNo = ConvertType.ToSystem.String(reader["ContNo"].ToString()); CallLetterEntityDetail.IntDate = ConvertType.ToSystem.String(reader["IntDate"].ToString()); CallLetterEntityDetail.IntTime = ConvertType.ToSystem.String(reader["IntTime"].ToString()); CallLetterEntityDetail.Pos = ConvertType.ToSystem.String(reader["Pos"].ToString()); CallLetterEntityDetail.Regards = ConvertType.ToSystem.String(reader["Regards"].ToString()); }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.ExceptionToErrorNumber: if (value is OdbcException) { OdbcException ex = (OdbcException)value; if (ex.Errors.Count > 0) return ex.Errors[0].NativeError; } break; } return base.Convert(value, convertType); }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: return "@" + value; case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: return ":" + value; case ConvertType.SprocParameterToName: if (value != null) { var str = value.ToString(); return str.Length > 0 && str[0] == ':'? str.Substring(1): str; } break; case ConvertType.NameToQueryField: case ConvertType.NameToQueryFieldAlias: case ConvertType.NameToQueryTable: case ConvertType.NameToQueryTableAlias: if (value != null && IdentifierQuoteMode != DB2IdentifierQuoteMode.None) { var name = value.ToString(); if (name.Length > 0 && name[0] == '"') return name; if (IdentifierQuoteMode == DB2IdentifierQuoteMode.Quote || name.StartsWith("_") || name #if NETFX_CORE .ToCharArray() #endif .Any(c => char.IsLower(c) || char.IsWhiteSpace(c))) return '"' + name + '"'; } break; } return value; }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter : return "?"; case ConvertType.NameToCommandParameter : case ConvertType.NameToSprocParameter : return ":" + value; case ConvertType.SprocParameterToName : if (value != null) { var str = value.ToString(); return (str.Length > 0 && str[0] == ':')? str.Substring(1): str; } break; } return value; }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.ExceptionToErrorNumber: if (value is NpgsqlException) { var ex = (NpgsqlException)value; foreach (NpgsqlError error in ex.Errors) return error.Code; return 0; } break; } return SqlProvider.Convert(value, convertType); }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryField: case ConvertType.NameToQueryTable: if (QuoteIdentifiers) { string name = value.ToString(); if (name.Length > 0 && name[0] == '"') return value; return '"' + name + '"'; } break; case ConvertType.NameToQueryParameter: case ConvertType.NameToParameter: return "@" + value; case ConvertType.ParameterToName: if (value != null) { string str = value.ToString(); return str.Length > 0 && str[0] == '@' ? str.Substring(1) : str; } break; case ConvertType.ExceptionToErrorNumber: if (value is FbException) { FbException ex = (FbException)value; if (ex.Errors.Count > 0) return ex.Errors[0].Number; } break; } return value; }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryField: case ConvertType.NameToQueryFieldAlias: case ConvertType.NameToQueryTable: case ConvertType.NameToQueryTableAlias: if (value != null && IdentifierQuoteMode != PostgreSQLIdentifierQuoteMode.None) { var name = value.ToString(); if (name.Length > 0 && name[0] == '"') return name; if (IdentifierQuoteMode == PostgreSQLIdentifierQuoteMode.Quote || name.Any(c => char.IsUpper(c) || char.IsWhiteSpace(c))) return '"' + name + '"'; } break; case ConvertType.NameToQueryParameter: case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: return ":" + value; case ConvertType.SprocParameterToName: if (value != null) { var str = value.ToString(); return (str.Length > 0 && str[0] == ':')? str.Substring(1): str; } break; } return value; }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: return "@" + value; case ConvertType.NameToQueryField: case ConvertType.NameToQueryFieldAlias: case ConvertType.NameToQueryTableAlias: { var name = value.ToString(); if (name.Length > 0 && name[0] == '[') return value; } return "[" + value + "]"; case ConvertType.NameToDatabase: case ConvertType.NameToOwner: case ConvertType.NameToQueryTable: { var name = value.ToString(); if (name.Length > 0 && name[0] == '[') return value; if (name.IndexOf('.') > 0) value = string.Join("].[", name.Split('.')); } return "[" + value + "]"; case ConvertType.SprocParameterToName: { var name = (string)value; return name.Length > 0 && name[0] == '@'? name.Substring(1): name; } } return value; }
public static byte[] GetThumbImage(string fileName, int? canvasWidth, int? canvasHeight, ConvertType CType) { Image image = null; try { image = Image.FromFile(fileName); } catch { return null; } return GetThumb(image, canvasWidth ?? image.Width, canvasHeight ?? image.Height, CType); }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryField: case ConvertType.NameToQueryFieldAlias: case ConvertType.NameToQueryTable: case ConvertType.NameToQueryTableAlias: case ConvertType.NameToOwner: if (QuoteIdentifiers) { var name = value.ToString(); if (name.Length > 0 && name[0] == '"') return value; return '"' + name + '"'; } break; case ConvertType.NameToQueryParameter: case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: return ":" + value.ToString().Replace(" ", string.Empty); case ConvertType.SprocParameterToName: if (value != null) { var str = value.ToString(); return (str.Length > 0 && str[0] == ':')? str.Substring(1): str; } break; } return value; }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: return ":" + value; case ConvertType.NameToCommandParameter: return value; case ConvertType.NameToSprocParameter: { var valueStr = value.ToString(); if(string.IsNullOrEmpty(valueStr)) throw new ArgumentException("Argument 'value' must represent parameter name."); return valueStr; } case ConvertType.SprocParameterToName: { return value.ToString(); } case ConvertType.NameToQueryField : case ConvertType.NameToQueryFieldAlias: case ConvertType.NameToQueryTableAlias: { var name = value.ToString(); if (name.Length > 0 && name[0] == '"') return value; return "\"" + value + "\""; } case ConvertType.NameToDatabase : case ConvertType.NameToOwner : case ConvertType.NameToQueryTable : if (value != null) { var name = value.ToString(); if (name.Length > 0 && name[0] == '\"') return value; if (name.IndexOf('.') > 0) value = string.Join("\".\"", name.Split('.')); return "\"" + value + "\""; } break; } return value; }
public override object Convert(object value, ConvertType convertType) { if (value == null) throw new ArgumentNullException("value"); switch (convertType) { case ConvertType.ExceptionToErrorNumber: if (value is MySqlException) return ((MySqlException)value).Number; break; case ConvertType.ExceptionToErrorMessage: if (value is MySqlException) return ((MySqlException)value).Message; break; } return SqlProvider.Convert(value, convertType); }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: string name = value.ToString().Replace(" ", string.Empty); if (name.Length <= 28) return ":" + name; int hashCode = name.GetHashCode(); return string.Format(":P{0}{1}_", hashCode < 0 ? "m" : "", Math.Abs(hashCode)); } return value; }
/// <summary> /// Converts a nif /// </summary> /// <param name="type"></param> /// <param name="targetFilename"></param> public void Convert(ConvertType type, string targetFilename) { switch (type) { case ConvertType.WaveFrontObject: ConvertWavefront wf = new ConvertWavefront(m_nifFile); wf.Write(targetFilename); break; case ConvertType.PolyText: case ConvertType.Poly: ConvertPoly conv = new ConvertPoly(m_nifFile); m_polygons = conv.Polys.ToArray(); if (type == ConvertType.PolyText) conv.WritePlain(targetFilename); else conv.Write(targetFilename); break; } }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: return ":" + value; case ConvertType.NameToParameter: return ParameterPrefix == null? value: ParameterPrefix + value; case ConvertType.ParameterToName: string name = (string)value; if (name.Length > 0) { if (name[0] == ':') return name.Substring(1); if (ParameterPrefix != null && name.ToUpper(CultureInfo.InvariantCulture).StartsWith(ParameterPrefix)) { return name.Substring(ParameterPrefix.Length); } } break; case ConvertType.ExceptionToErrorNumber: if (value is OracleException) return ((OracleException)value).Number; break; } return value; }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryParameter: return ParameterSymbol + value.ToString(); case ConvertType.NameToCommandParameter: return ParameterSymbol + CommandParameterPrefix + value; case ConvertType.NameToSprocParameter: { var valueStr = value.ToString(); if(string.IsNullOrEmpty(valueStr)) throw new ArgumentException("Argument 'value' must represent parameter name."); if (valueStr[0] == ParameterSymbol) valueStr = valueStr.Substring(1); if (valueStr.StartsWith(SprocParameterPrefix, StringComparison.Ordinal)) valueStr = valueStr.Substring(SprocParameterPrefix.Length); return ParameterSymbol + SprocParameterPrefix + valueStr; } case ConvertType.SprocParameterToName: { var str = value.ToString(); str = (str.Length > 0 && (str[0] == ParameterSymbol || (TryConvertParameterSymbol && ConvertParameterSymbols.Contains(str[0])))) ? str.Substring(1) : str; if (!string.IsNullOrEmpty(SprocParameterPrefix) && str.StartsWith(SprocParameterPrefix)) str = str.Substring(SprocParameterPrefix.Length); return str; } case ConvertType.NameToQueryField : case ConvertType.NameToQueryFieldAlias: case ConvertType.NameToQueryTableAlias: { var name = value.ToString(); if (name.Length > 0 && name[0] == '`') return value; return "`" + value + "`"; } case ConvertType.NameToDatabase : case ConvertType.NameToOwner : case ConvertType.NameToQueryTable : if (value != null) { var name = value.ToString(); if (name.Length > 0 && name[0] == '`') return value; if (name.IndexOf('.') > 0) value = string.Join("`.`", name.Split('.')); return "`" + value + "`"; } break; } return value; }
/// <summary> /// Converts a backup to the specified type. /// </summary> /// <param name="convertType">Type of the convert.</param> /// <param name="sourceFile">The source file.</param> /// <returns></returns> /// <exception cref="System.ArgumentException"></exception> public String ConvertTo( ConvertType convertType, String sourceFile ) { try { switch ( convertType ) { case ConvertType.Basic: this.LogDebug ( "Checking if Extended so can be converted to Basic" ); if ( IsExtendedBackup ( sourceFile ) ) { this.LogDebug ( "Converting Extended to Basic" ); return RemoveExtendedInfo ( sourceFile ); } else { throw new ArgumentException ( "Did not pass Extended Backup test" ); } case ConvertType.Extended: this.LogDebug ( "Checking if Basic so can be converted to Extended" ); if ( IsBasicBackup ( sourceFile ) ) { this.LogDebug ( "Converting Basic to Extended" ); return WriteExtendedInfo ( sourceFile ); } else { throw new ArgumentException ( "Did not pass Basic Bacup test" ); } default: throw new ArgumentException ( "Unsupported conversion type" ); } } catch ( Exception ex ) { throw; } }
public override object Convert(object value, ConvertType convertType) { if (value == null) throw new ArgumentNullException("value"); switch (convertType) { case ConvertType.NameToQueryParameter: return ParameterSymbol + value.ToString(); case ConvertType.NameToCommandParameter: return ParameterSymbol + CommandParameterPrefix + value.ToString(); case ConvertType.NameToSprocParameter: { string valueStr = value.ToString(); if(string.IsNullOrEmpty(valueStr)) throw new ArgumentException("Argument 'value' must represent parameter name."); if (valueStr[0] == ParameterSymbol) valueStr = valueStr.Substring(1); if (valueStr.StartsWith(SprocParameterPrefix, StringComparison.Ordinal)) valueStr = valueStr.Substring(SprocParameterPrefix.Length); return ParameterSymbol + SprocParameterPrefix + valueStr; } case ConvertType.SprocParameterToName: if (value != null) { string str = value.ToString(); str = (str.Length > 0 && (str[0] == ParameterSymbol || (TryConvertParameterSymbol && ConvertParameterSymbols.Contains(str[0])))) ? str.Substring(1) : str; if ((!string.IsNullOrEmpty(SprocParameterPrefix)) && str.StartsWith(SprocParameterPrefix)) str = str.Substring(SprocParameterPrefix.Length); return str; } break; } return value; }
string getToolPath(ConvertType type) { string ret = ""; string param = ""; switch (type) { case ConvertType.ETC: ret = System.IO.Path.Combine(Global.toolsDir, "PackImg2Mng.py"); param += " -m ETC "; break; case ConvertType.JPGA: ret = System.IO.Path.Combine(Global.toolsDir, "PackImg2Mng.py"); param += " -m JPG "; break; case ConvertType.PVR: ret = System.IO.Path.Combine(Global.toolsDir, "PackImg2Mng.py"); param += " -m PVR "; break; case ConvertType.PVRTC4: ret = System.IO.Path.Combine(Global.toolsDir, "PackImg2Mng.py"); param += " -m PVR "; break; } return ret + param; }
public override object Convert(object value, ConvertType convertType) { switch (convertType) { case ConvertType.NameToQueryField: case ConvertType.NameToQueryFieldAlias: case ConvertType.NameToQueryTable: case ConvertType.NameToQueryTableAlias: if (QuoteIdentifiers || this._reservedWords.Contains(value.ToString().ToUpper())) { var name = value.ToString(); if (name.Length > 0 && name[0] == '"') return value; return '"' + name + '"'; } break; case ConvertType.NameToQueryParameter: case ConvertType.NameToCommandParameter: case ConvertType.NameToSprocParameter: return ":" + value; case ConvertType.SprocParameterToName: if (value != null) { var str = value.ToString(); return (str.Length > 0 && str[0] == ':')? str.Substring(1): str; } break; } return value; }