public void MapFields(string[] fields) { if (fields == null || fields.Length == 0) { ResetMap(); } else { indexMaps = new int[fields.Length]; names = fields; // 对照 for (int i = 0; i < fields.Length; i++) { if (KeyField.Equals(fields[i])) { indexMaps[i] = 0; } else if (ValueField.Equals(fields[i])) { indexMaps[i] = 1; } else { indexMaps[i] = -1; } } } }
public void Process(HierarchyDef hierarchyDef, FieldDef fieldDef, KeyAttribute attribute) { ArgumentValidator.EnsureArgumentIsInRange(attribute.Position, 0, WellKnown.MaxKeyFieldNumber - 1, "attribute.Position"); var keyField = new KeyField(fieldDef.Name, attribute.Direction); if (hierarchyDef.KeyFields.Count > attribute.Position) { var current = hierarchyDef.KeyFields[attribute.Position]; if (current != null) { throw new DomainBuilderException(string.Format(Strings.ExKeyFieldsXAndXHaveTheSamePositionX, current.Name, fieldDef.Name, attribute.Position)); } hierarchyDef.KeyFields[attribute.Position] = keyField; } else { // Adding null stubs for not yet processed key fields while (hierarchyDef.KeyFields.Count < attribute.Position) { hierarchyDef.KeyFields.Add(null); } // Finally adding target key field at the specified position hierarchyDef.KeyFields.Add(keyField); } }
public void DeleteLine(string recid) { //{ // "RecId": "5637147579" //} var callContext = new CallContext() { MessageId = Guid.NewGuid().ToString(), LogonAsUser = string.Format(@"{0}\{1}", UserAccount.Domain, UserAccount.Username), Language = "en-us" }; KeyField keyField = new KeyField() { Field = "RecId", Value = recid }; EntityKey entityKey = new EntityKey(); entityKey.KeyData = new KeyField[1] { keyField }; EntityKey[] entityKeys = new EntityKey[1] { entityKey }; using (STMSODailyLineServiceClient client = new STMSODailyLineServiceClient()) { client.ClientCredentials.Windows.ClientCredential.Domain = UserAccount.Domain; client.ClientCredentials.Windows.ClientCredential.UserName = UserAccount.Username; client.ClientCredentials.Windows.ClientCredential.Password = UserAccount.Password; client.delete(callContext, entityKeys); } }
private void userLogin(object sender, EventArgs e) { BackBtn.Visible = false; ForeBtn.Visible = false; NameText.Visible = false; if (Users[userIndex].CheckKey(KeyField.Text)) { WelText.Text = "checked okay!"; WelText.Visible = true; WaitImg.Visible = true; DateTime d = DateTime.Now; while ((DateTime.Now - d).Seconds <= 2) { Application.DoEvents(); } this.Close(); } else { WelText.Text = "fatal password"; WelText.Visible = true; DateTime t = DateTime.Now; while ((DateTime.Now - t).Seconds <= 2) { Application.DoEvents(); } WelText.Visible = false; BackBtn.Visible = true; ForeBtn.Visible = true; NameText.Visible = true; KeyField.Focus(); } }
public virtual void OnDefinitionsBuilt(BuildingContext context, DomainModelDef model) { if (!IsEnabled) { return; } TypeIdField = new KeyField(WellKnown.TypeIdFieldName); }
public ModelConfig() { CustomForms = new Dictionary <string, CustomForm>(); FormConfig = new FormConfig(); GridConfig = new GridConfig(); KeyField = new KeyField(); TreeConfig = new TreeConfig(); }
public CheckBoxMatrix() { //RowField = new BaseField(); //ColumnField = new BaseField(); MatrixKeyField = new KeyField(); RowKeyField = new KeyField(); ColumnKeyField = new KeyField(); ContextKeyField = new KeyField(); }
public FieldBuilder(IFieldConfig fieldConfig, ICollection <Field> allFormFields, KeyField keyField) { //_fieldConfig = fieldConfig; //_modelConfig = modelConfig; //_formConfig = formConfig; _allFormFields = allFormFields; _fieldConfig = fieldConfig; _keyField = keyField; }
public object GetValueByOriName(string field) { if (curRow >= 0 && curRow < keys.Length) { if (ValueField.Equals(field)) { return(values[curRow]); } else if (KeyField.Equals(field)) { return(keys[curRow]); } } return(DBNull.Value); }
public override bool Exists(KeyField keyField, string fieldValue, int id, int orgId) { bool exists = true; using (var con = _db.GetConnection()) { switch (keyField) { case KeyField.Code: exists = con.Any <AccountYear>(o => o.Id != id && o.YearCode == fieldValue && o.OrgId == orgId); break; default: throw new Exception($"Unknown keyfield '{keyField}'"); } } return(exists); }
public override bool Exists(KeyField keyField, string fieldValue, int id, int orgId) { bool exists = true; using (var con = _db.GetConnection()) { switch (keyField) { case KeyField.Code: exists = con.Any <Product>(o => o.Id != id && o.Code == fieldValue && o.OrgId == orgId); break; case KeyField.Name: exists = con.Any <Product>(o => o.Id != id && o.ProductName == fieldValue && o.OrgId == orgId); break; } } return(exists); }
public static EntityKey[] read(string value) { KeyField keyField = new KeyField() { Field = "RecId", Value = value }; EntityKey entityKey = new EntityKey(); entityKey.KeyData = new KeyField[1] { keyField }; EntityKey[] entityKeys = new EntityKey[1] { entityKey }; return(entityKeys); }
public override bool Exists(KeyField keyField, string fieldValue, int id, int orgId) { using (var con = _db.GetConnection()) { string query; switch (keyField) { case KeyField.Code: query = $"select 1 from product_categories where code=@code COLLATE NOCASE and org_id=@orgId and id <> @id"; return(con.ExecuteScalar <int>(query, new { code = fieldValue, orgId, id }) == 1); case KeyField.Name: query = $"select 1 from product_categories where category_name=@categoryName COLLATE NOCASE and org_id=@orgId and id <> @id"; return(con.ExecuteScalar <int>(query, new { categoryName = fieldValue, orgId, id }) == 1); default: return(true); } } }
public KeyDefinition DeserializeKeyDefinition(XElement xKeyDef) { try { var keyDef = new KeyDefinition(); if (xKeyDef == null) { return(keyDef); } // KeyFields foreach (XElement xField in xKeyDef.Element("keyfields").Elements()) { var keyField = new KeyField(); keyField.Name = xField.Attribute(XName.Get("name")).Value; // Keygenerator string keyGeneratorName = xField.Attribute(XName.Get("generator")).Value; if (!string.IsNullOrEmpty(keyGeneratorName)) { keyField.Generator = StringPhoneticKeyBuilderFactory.GetInstance(keyGeneratorName); keyField.Generator.MaxLength = (int)xField.Attribute(XName.Get("maxlength")); } keyDef.Fields.Add(keyField); } // Target Field keyDef.TargetKeyField = xKeyDef.Element("targetkeyfield") .Attribute(XName.Get("name")) .Value; return(keyDef); } catch (Exception ex) { throw new ArgumentException("Fehler in " + this.GetType().FullName + " Method: [" + System.Reflection.MethodBase.GetCurrentMethod() + "] Data: " + xKeyDef.ToString(), ex); } }
public void OnKeyFieldValueChanged(Key key, KeyField target) { var prev = binding[currentKey][(int)target.targetEnum][target.targetIndex]; for (var i = 0; i < binding[currentKey].Count; i++) { var list = binding[currentKey][i]; for (var index = 0; index < list.Count; index++) { if (list[index] != key) { continue; } list[index] = prev; ((BindingEnum)i switch { BindingEnum.Speed => speedKeys, BindingEnum.Play => playKeys, _ => throw new ArgumentOutOfRangeException() })[index].SetValue(prev);
public bool Exists(KeyField keyField, string fieldValue, int id) { bool exists = true; using (var con = _db.GetConnection()) { switch (keyField) { case KeyField.Code: exists = con.Any <Organization>(o => o.Id != id && o.Code == fieldValue); //exists = con.ExecuteScalar<int>("select 1 from organizations where code like @code and id<>@id", // new { code = fieldValue, id }) == 1; break; case KeyField.Name: exists = con.Any <Organization>(o => o.Id != id && o.OrgName == fieldValue); //int res = con.ExecuteScalar<int>("select 1 from organizations where org_name like @name and id<>@id", // new { name = fieldValue, id }); //exists = res == 1; break; } } return(exists); }
public abstract bool Exists(KeyField keyField, string fieldValue, int id, int orgId);
/// <inheritdoc/> /// <exception cref="NotSupportedException">Method is not supported.</exception> protected override IPathNode VisitKeyField(KeyField keyField) { throw new NotSupportedException(String.Format(Strings.ExVisitKeyFieldIsNotSupportedByX, typeof(DomainModelConverter))); }
public void EditLine(RetailSOLine soDaily) { EntityKey[] entitykey = new EntityKey[1]; AxdSTMSODailyLine axdSoLine = new AxdSTMSODailyLine(); var callContext = new CallContext() { MessageId = Guid.NewGuid().ToString(), LogonAsUser = string.Format(@"{0}\{1}", UserAccount.Domain, UserAccount.Username), Language = "en-us" }; KeyField keyField = new KeyField() { Field = "RecId", Value = soDaily.RecId }; EntityKey entityKey = new EntityKey(); entityKey.KeyData = new KeyField[1] { keyField }; EntityKey[] entityKeys = new EntityKey[1] { entityKey }; using (var client = new STMSODailyLineServiceClient()) { client.ClientCredentials.Windows.ClientCredential.Domain = UserAccount.Domain; client.ClientCredentials.Windows.ClientCredential.UserName = UserAccount.Username; client.ClientCredentials.Windows.ClientCredential.Password = UserAccount.Password; axdSoLine = client.read(callContext, entityKeys); } string orderDate = soDaily.Date.ToShortDateString(); using (var client = new STMSODailyLineServiceClient()) { AxdEntity_StmSalesSoDailyLine soLineEntity = axdSoLine.StmSalesSoDailyLine[0]; var axdsoline2 = new AxdSTMSODailyLine() { ClearNilFieldsOnUpdate = axdSoLine.ClearNilFieldsOnUpdate, ClearNilFieldsOnUpdateSpecified = true, DocPurpose = axdSoLine.DocPurpose, DocPurposeSpecified = true, SenderId = axdSoLine.SenderId }; var solineEntityNew = new AxdEntity_StmSalesSoDailyLine(); solineEntityNew._DocumentHash = soLineEntity._DocumentHash; ///for update method solineEntityNew.RecId = Convert.ToInt64(soDaily.RecId); solineEntityNew.RecIdSpecified = true; if (soDaily.Date != DateTime.MinValue) { solineEntityNew.SalesDate = DateTime.ParseExact(orderDate, "dd/MM/yyyy", CultureInfo.InvariantCulture); } else { solineEntityNew.SalesDate = soLineEntity.SalesDate; } solineEntityNew.SalesDateSpecified = true; //solineEntityNew.SalesPoolId = soDaily.Pool; solineEntityNew.Series = soDaily.Series; solineEntityNew.Model = soDaily.Model; solineEntityNew.Sink = soDaily.Sink; solineEntityNew.SalesQty = Convert.ToDecimal(soDaily.Qty); solineEntityNew.SalesQtySpecified = true; solineEntityNew.StmStoreId = soDaily.Top; solineEntityNew.SalesAmount = Convert.ToDecimal(soDaily.Amount); solineEntityNew.SalesAmountSpecified = true; solineEntityNew.SalesOrderDaily = Convert.ToInt64(soDaily.RecIdHeader); solineEntityNew.SalesOrderDailySpecified = true; axdsoline2.StmSalesSoDailyLine = new AxdEntity_StmSalesSoDailyLine[1] { solineEntityNew }; client.ClientCredentials.Windows.ClientCredential.Domain = UserAccount.Domain; client.ClientCredentials.Windows.ClientCredential.UserName = UserAccount.Username; client.ClientCredentials.Windows.ClientCredential.Password = UserAccount.Password; client.update(callContext, entityKeys, axdsoline2); } }
public bool Exists(KeyField keyField, string fieldValue, int id) { throw new System.NotImplementedException(); }
public bool Exists(KeyField keyField, string fieldValue, int id, int superId) { throw new NotImplementedException(); }
public void AddKeyField(KeyField kf) { keyFields.Add(kf); }
public KeyField(KeyField pattern) { occupantId = pattern.occupantId; keyFieldId = pattern.keyFieldId; keyFieldName = pattern.keyFieldName; }
public CustomForm() { KeyField = new KeyField(); FormConfig = new FormConfig(); }