コード例 #1
0
 //Methods
 #region
 public void SetRace(int anID, string aName, DateTime aRaceDate, Model.Address anAddress, int aRaceTypeId, string aMemo,
                     string anImageURL, double aLongitud, double aLatitud, int aPartMasc, int aPartFem)
 {
     this.Id         = anID;
     this.Name       = aName;
     this.RaceDate   = aRaceDate;
     this.Address    = anAddress;
     this.RaceTypeID = aRaceTypeId;
     this.Memo       = aMemo;
     this.ImageURL   = anImageURL;
     this.Latitud    = aLatitud;
     this.Longitud   = aLongitud;
     this.PartMasc   = aPartMasc;
     this.PartFem    = aPartFem;
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: sander-/BCExplorer
        private static void UpdateTxIdBlob_Obsolete(Model.Address existing,
                                                    string transactionId)
        {
            // the last txid is first in the blob
            var txIds = existing.TxIdBlob.Split(CRLF, StringSplitOptions.RemoveEmptyEntries).ToList();

            // append at pos 0
            txIds.Insert(0, transactionId);
            var sb = new StringBuilder();

            foreach (var txid in txIds.Distinct())
            {
                sb.Append(txid + CRLF);
            }
            existing.TxIdBlob = sb.ToString();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: sander-/BCExplorer
        private static void UpdateTxIdBlob(Model.Address existing, string transactionId,
                                           DateTime time,
                                           decimal balance,
                                           decimal amount,
                                           Model.BCExplorerContext context)
        {
            var at = new Model.AddressTransaction()
            {
                Address       = existing,
                TimeStamp     = time,
                Balance       = balance,
                Amount        = amount,
                TransactionId = transactionId
            };

            context.AddressTransactions.Add(at);
        }
コード例 #4
0
        public Response <Model.Address> CreateAddress(Model.Address address)
        {
            Response <Model.Address> response        = null;
            AddressBusiness          addressBusiness = null;

            try
            {
                addressBusiness = new AddressBusiness();
                return(addressBusiness.Create(address));
            }
            catch (Exception ex)
            {
                response = new Response <Model.Address>(null, ResponseStatus.Error, ex.Message);
            }

            return(response);
        }
コード例 #5
0
ファイル: address_edit.aspx.cs プロジェクト: LutherW/MTMS
        private bool DoAdd()
        {
            bool result = false;
            Model.Address model = new Model.Address();
            BLL.Address bll = new BLL.Address();

            model.Name = txtName.Text.Trim();
            model.Code = string.IsNullOrEmpty(txtCode.Text.Trim()) ? model.Name : txtCode.Text.Trim();
            model.CategoryName = ddlCategory.SelectedValue;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加装卸货地址:" + model.Name); //记录日志
                result = true;
            }
            return result;
        }
コード例 #6
0
ファイル: address_edit.aspx.cs プロジェクト: uwitec/MYTMS
        private bool DoAdd()
        {
            bool result = false;

            Model.Address model = new Model.Address();
            BLL.Address   bll   = new BLL.Address();

            model.Name         = txtName.Text.Trim();
            model.Code         = string.IsNullOrEmpty(txtCode.Text.Trim()) ? model.Name : txtCode.Text.Trim();
            model.CategoryName = ddlCategory.SelectedValue;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加装卸货地址:" + model.Name); //记录日志
                result = true;
            }
            return(result);
        }
コード例 #7
0
ファイル: address_edit.aspx.cs プロジェクト: uwitec/MYTMS
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.Address   bll   = new BLL.Address();
            Model.Address model = bll.GetModel(_id);

            model.Name         = txtName.Text.Trim();
            model.Code         = string.IsNullOrEmpty(txtCode.Text.Trim()) ? model.Name : txtCode.Text.Trim();
            model.CategoryName = ddlCategory.SelectedValue;

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改装卸货地址信息:" + model.Name); //记录日志
                result = true;
            }
            return(result);
        }
コード例 #8
0
        public string Add(Model.Address payload, string jobId, string customerName, string contact, EType type)
        {
            MySqlCommand    command = null;
            MySqlDataReader reader  = null;

            try
            {
                var    destinationTable = (type == EType.From ? TABLE_JOB_FROM : TABLE_JOB_TO);
                string query            = string.Format("INSERT into {0} (add_1, add_2, add_3, state_id, country_id, postcode, gps_longitude, gps_latitude, create_by)" +
                                                        "VALUES (@add_1, @add_2, @add_3, @state_id, @country_id, @postcode, @gps_longitude, @gps_latitude, @create_by); " +
                                                        "INSERT into {1} (address_id, job_id, customer_name, customer_contact) " +
                                                        "VALUES (LAST_INSERT_ID(), @job_id, @customer_name, @customer_contact)",
                                                        TABLE_ADD, destinationTable);

                command = new MySqlCommand(query);
                command.Parameters.AddWithValue("@add_1", payload.address1);
                command.Parameters.AddWithValue("@add_2", payload.address2);
                command.Parameters.AddWithValue("@add_3", payload.address3);
                command.Parameters.AddWithValue("@state_id", payload.stateId);
                command.Parameters.AddWithValue("@country_id", payload.countryId);
                command.Parameters.AddWithValue("@postcode", payload.postcode);
                command.Parameters.AddWithValue("@gps_longitude", payload.gpsLongitude);
                command.Parameters.AddWithValue("@gps_latitude", payload.gpsLatitude);
                command.Parameters.AddWithValue("@create_by", payload.createdBy);

                command.Parameters.AddWithValue("@job_id", jobId);
                command.Parameters.AddWithValue("@customer_name", customerName);
                command.Parameters.AddWithValue("@customer_contact", contact);

                return(PerformSqlNonQuery(command).ToString());
            }
            catch (Exception e)
            {
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Error, e.Message);
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.StackTrace);
            }
            finally
            {
                CleanUp(reader, command);
            }

            return(null);
        }
コード例 #9
0
        public (bool isvalid, string reason) ValidateAddress(Model.Address address)
        {
            var failurereason = new StringBuilder();
            var isvalid       = true;

            var ispostalcodevalid = CheckPostalCode(address);

            if (!ispostalcodevalid.isvalid)
            {
                failurereason.AppendLine(ispostalcodevalid.reason);
            }

            var iscountryvalid = CheckCountry(address);

            if (!iscountryvalid.isvalid)
            {
                failurereason.AppendLine(iscountryvalid.reason);
            }

            var isaddresslinevalid = CheckAddressLine(address);

            if (!isaddresslinevalid.isvalid)
            {
                failurereason.AppendLine(isaddresslinevalid.reason);
            }

            var isprovinceorstatevalid = CheckProvinceOrState(address);

            if (!isprovinceorstatevalid.isvalid)
            {
                failurereason.AppendLine(isprovinceorstatevalid.reason);
            }

            //check is any property of address returned failure reason
            if (failurereason.Length > 0)
            {
                isvalid = false;
            }

            var failurereasonarray = failurereason.ToString().TrimEnd(Environment.NewLine.ToCharArray()).Split("\r\n");

            return(isvalid, string.Join("|", failurereasonarray));
        }
コード例 #10
0
        public FrmPatient(Model.Patient editPatient)
        {
            InitializeComponent();
            InitializeAdditionalComponents();

            patient           = editPatient;
            selectedAddress   = editPatient.Address;
            selectedInsurance = editPatient.InsuranceAgency;
            selectedDoctor    = editPatient.LocalDoctor;

            tbGender.Text      = editPatient.Gender;
            dtpBirthday.Value  = editPatient.Birthday;
            tbInsuranceNr.Text = Convert.ToString(editPatient.InsuranceNr);
            tbNote.Text        = editPatient.Note;

            InitializeAddresses();
            cbInsurance.SelectedIndex = insuranceAgencies.Select(o => o.Id).ToList().IndexOf(selectedInsurance.Id);
            cbDoctor.SelectedIndex    = doctors.Select(o => o.Id).ToList().IndexOf(selectedDoctor.Id);

            InitializeAddresses();
        }
コード例 #11
0
ファイル: Address.cs プロジェクト: LutherW/MTMS
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.Address> DataTableToList(DataTable dt)
        {
            List<Model.Address> modelList = new List<Model.Address>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Model.Address model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.Address();
                    if (dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    model.Name = dt.Rows[n]["Name"].ToString();
                    model.CategoryName = dt.Rows[n]["CategoryName"].ToString();
                    model.Code = dt.Rows[n]["Code"].ToString();

                    modelList.Add(model);
                }
            }
            return modelList;
        }
コード例 #12
0
        public void SignUp()
        {
            var Address = new Model.Address()
            {
                Address1 = "Address 1 - N° et rue",
                Address2 = "Address 2",
                Country  = "France",
                Province = "Province",
                Zip      = "11111",
            };
            var Contact = new Model.Contact()
            {
                AcceptTermsOfService = true,
                Email     = "*****@*****.**",
                Facebook  = "facebook url",
                FirstName = "John",
                LastName  = "Doe",
                IsActive  = true,
                Language  = "Fr",
                Linkedin  = "LinkedinUrl",
                Phone     = "0707070707",
                Viadeo    = "viadeoUrl",
                Website   = "websiteUrl",
            };

            Contact.Status.Id = 1;
            var tenant = new Tenant();

            tenant.CreatedOn = DateTime.Now;
            tenant.UpdatedOn = DateTime.Now;
            tenant.IsActive  = true;
            tenant.StatusId  = 1;
            var isCreated = _tenantCore.Create(tenant).Result;

            Assert.IsTrue(isCreated);
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: sander-/BCExplorer
        static void ProcessStakingReward(Network.Models.Transaction tx, Model.BCExplorerContext context)
        {
            foreach (var vin in tx.TransactionsIn)
            {
                //var vin = tx.TransactionsIn[0];
                var inAddress  = vin.PrevVOutFetchedAddress;
                var oldBalance = vin.PrevVOutFetchedValue;

                var outValue1 = tx.TransactionsOut[1].Value;
                var outValue2 = tx.TransactionsOut[2].Value;
                var change    = outValue1 + outValue2 - oldBalance;

                // we can assume that only pre-existing addresses get a staking reward
                Model.Address existing = context.Addresses.Find(inAddress);
                if (existing == null)
                {
                    _logger.LogError($"{vin.PrevVOutFetchedAddress} could not be found.");
                }

                existing.Balance += change;
                existing.LastModifiedBlockHeight = (int)tx.Block.Height;
                UpdateTxIdBlob(existing, tx.TransactionId, tx.Time, existing.Balance, change, context);
            }
        }
コード例 #14
0
 public InvalidAddressError(Model.Address address)
 {
     this.Address = address;
 }
コード例 #15
0
 public IActionResult Create([FromBody] Model.Address newAddress)
 {
     return(StatusCode(StatusCodes.Status200OK, repo.Create(newAddress)));
 }
コード例 #16
0
ファイル: Address.cs プロジェクト: LutherW/MTMS
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Address GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select Id, Name, CategoryName, Code  ");
            strSql.Append("  from mtms_Address ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters = {
                    new SqlParameter("@Id", SqlDbType.Int,4)
            };
            parameters[0].Value = Id;

            Model.Address model = new Model.Address();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                model.CategoryName = ds.Tables[0].Rows[0]["CategoryName"].ToString();
                model.Code = ds.Tables[0].Rows[0]["Code"].ToString();

                return model;
            }
            else
            {
                return null;
            }
        }
コード例 #17
0
        public void check_failurereason_when_invalid_address(Model.Address address, bool isvalid, string reason)
        {
            var addressvalidateresults = this.addressService.ValidateAddress(address);

            Assert.Equal((isvalid, reason), (addressvalidateresults));
        }
コード例 #18
0
        private List <Model.JobDetails> getDetailsList(MySqlDataReader reader)
        {
            List <Model.JobDetails> jobDetailsList = new List <Model.JobDetails>();

            while (reader.Read())
            {
                var jobId         = reader["id"].ToString();
                var existedResult = jobDetailsList.Find(x => x.jobId == jobId);
                if (existedResult != null)
                {
                    // already have same job id
                    var addFromObj = new Model.Address();
                    try
                    {
                        addFromObj.addressId     = reader["addFromId"].ToString();
                        addFromObj.address1      = (string)reader["add_from_1"];
                        addFromObj.address2      = (string)reader["add_from_2"];
                        addFromObj.address3      = (string)reader["add_from_3"];
                        addFromObj.stateId       = reader["state_from"].ToString();
                        addFromObj.countryId     = reader["country_from"].ToString();
                        addFromObj.postcode      = (string)reader["postcode_from"];
                        addFromObj.gpsLongitude  = (float)reader["longitude_from"];
                        addFromObj.gpsLatitude   = (float)reader["latitude_from"];
                        addFromObj.contactPerson = (string)reader["customerFrom"];
                        addFromObj.contact       = (string)reader["contactFrom"];

                        existedResult.addressFrom.Add(addFromObj);
                    }
                    catch (Exception)
                    {
                        // possible do not have from address
                    }

                    var addToObj = new Model.Address();
                    try
                    {
                        addToObj.addressId     = reader["addToId"].ToString();
                        addToObj.address1      = (string)reader["add_to_1"];
                        addToObj.address2      = (string)reader["add_to_2"];
                        addToObj.address3      = (string)reader["add_to_3"];
                        addToObj.stateId       = reader["state_to"].ToString();
                        addToObj.countryId     = reader["country_to"].ToString();
                        addToObj.postcode      = (string)reader["postcode_to"];
                        addToObj.gpsLongitude  = (float)reader["longitude_to"];
                        addToObj.gpsLatitude   = (float)reader["latitude_to"];
                        addToObj.contactPerson = (string)reader["customerTo"];
                        addToObj.contact       = (string)reader["contactTo"];

                        existedResult.addressTo.Add(addToObj);
                    }
                    catch (Exception)
                    {
                        // possible do not have to address
                    }

                    continue;
                }

                // new job id
                var addFromList   = new List <Model.Address>();
                var addFromObjNew = new Model.Address();
                try
                {
                    addFromObjNew.addressId     = reader["addFromId"].ToString();
                    addFromObjNew.address1      = (string)reader["add_from_1"];
                    addFromObjNew.address2      = (string)reader["add_from_2"];
                    addFromObjNew.address3      = (string)reader["add_from_3"];
                    addFromObjNew.stateId       = reader["state_from"].ToString();
                    addFromObjNew.countryId     = reader["country_from"].ToString();
                    addFromObjNew.postcode      = (string)reader["postcode_from"];
                    addFromObjNew.gpsLongitude  = (float)reader["longitude_from"];
                    addFromObjNew.gpsLatitude   = (float)reader["latitude_from"];
                    addFromObjNew.contactPerson = (string)reader["customerFrom"];
                    addFromObjNew.contact       = (string)reader["contactFrom"];

                    addFromList.Add(addFromObjNew);
                }
                catch (Exception)
                {
                    // possible do not have from address
                }

                var addToList   = new List <Model.Address>();
                var addToObjNew = new Model.Address();
                try
                {
                    addToObjNew.addressId     = reader["addToId"].ToString();
                    addToObjNew.address1      = (string)reader["add_to_1"];
                    addToObjNew.address2      = (string)reader["add_to_2"];
                    addToObjNew.address3      = (string)reader["add_to_3"];
                    addToObjNew.stateId       = reader["state_to"].ToString();
                    addToObjNew.countryId     = reader["country_to"].ToString();
                    addToObjNew.postcode      = (string)reader["postcode_to"];
                    addToObjNew.gpsLongitude  = (float)reader["longitude_to"];
                    addToObjNew.gpsLatitude   = (float)reader["latitude_to"];
                    addToObjNew.contactPerson = (string)reader["customerTo"];
                    addToObjNew.contact       = (string)reader["contactTo"];

                    addToList.Add(addToObjNew);
                }
                catch (Exception)
                {
                    // possible do not have to address
                }

                jobDetailsList.Add(new Model.JobDetails()
                {
                    jobId               = jobId,
                    ownerUserId         = reader["owner_id"].ToString(),
                    jobTypeId           = reader["job_type_id"].ToString(),
                    fleetTypeId         = reader["fleet_type_id"].ToString(),
                    amount              = (float)reader["amount"],
                    amountPaid          = (float)reader["amount_paid"],
                    cashOnDelivery      = (int)reader["cash_on_delivery"] == 0 ? false : true,
                    workerAssistant     = (int)reader["worker_assistance"],
                    deliveryDate        = reader.GetDateTime("delivery_date").ToString("yyyy-MM-dd HH:mm:ss"),
                    remarks             = (string)reader["remarks"],
                    enabled             = (int)reader["enabled"] == 0 ? false : true,
                    deleted             = (int)reader["deleted"] == 0 ? false : true,
                    createdBy           = reader["created_by"].ToString(),
                    creationDate        = reader.GetDateTime("creation_date").ToString("yyyy-MM-dd HH:mm:ss"),
                    modifiedBy          = reader["modify_by"].ToString(),
                    lastModifiedDate    = reader.GetDateTime("last_modified_date").ToString("yyyy-MM-dd HH:mm:ss"),
                    jobStatusId         = reader["job_status_id"] == null ? null : reader["job_status_id"].ToString(),
                    amountPartner       = reader.GetFloat("partner_amount"),
                    assembleBed         = (int)reader["assemble_bed"],
                    assembleDiningTable = (int)reader["assemble_dining_table"],
                    assembleWardrobe    = (int)reader["assemble_wardrobe"],
                    assembleOfficeTable = (int)reader["assemble_office_table"],
                    bubbleWrapping      = (int)reader["bubble_wrapping"],
                    shrinkWrapping      = (int)reader["shrink_wrapping"],
                    addressFrom         = addFromList,
                    addressTo           = addToList
                });
            }

            return(jobDetailsList);
        }
コード例 #19
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.Address model)
 {
     return(dal.Update(model));
 }
コード例 #20
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.Address model)
 {
     return(dal.Add(model));
 }
コード例 #21
0
        [HttpDelete()]                                                       //Update
        public IActionResult Delete([FromBody] Model.Address value)
        {
            try
            {
                int Id = value.Id;
                if (Id != 0)
                {
                    int Address = _AddressRepo.Delete(Id);
                    if (Address < 1)
                    {
                        return(StatusCode(StatusCodes.Status206PartialContent));
                    }
                    else if (Address == 1)
                    {
                        return(StatusCode(StatusCodes.Status200OK, Address));
                    }
                    else
                    {
                        return(StatusCode(StatusCodes.Status501NotImplemented));
                    }
                }
                else
                {
                    return(StatusCode(StatusCodes.Status406NotAcceptable));
                }
            }
            catch (Helper.RepoException ex)
            {
                switch (ex.Type)
                {
                case EnumResultTypes.INVALIDARGUMENT:
                    return(StatusCode(StatusCodes.Status400BadRequest));

                case EnumResultTypes.NOTFOUND:
                    return(StatusCode(StatusCodes.Status204NoContent));

                case EnumResultTypes.SQLERROR:
                    return(StatusCode(StatusCodes.Status408RequestTimeout));

                case EnumResultTypes.ERROR:
                    return(StatusCode(StatusCodes.Status500InternalServerError));

                default:
                    return(StatusCode(StatusCodes.Status501NotImplemented));
                }
            }
            catch (Exception ex)
            {
                var logObj4 = new ExceptionData(ex);
                logObj4.CustomNumber = 123;
                logObj4.CustomText   = "abs";
                logObj4.Add("start_time", DateTime.UtcNow);
                logObj4.Add("myObject", new
                {
                    TappId = 15,
                    Name   = "Sebastian"
                });
                _logger.Error(logObj4);
                return(StatusCode(StatusCodes.Status501NotImplemented));
            }
        }
コード例 #22
0
        private Person MapPerson(Demographic options)
        {
            Person person = new Person();

            foreach (var item in options.Addresses)
            {
                Model.Address address = new Model.Address().Map(item);

                address.CreationTimestamp = DateTime.Now;

                person.Addresses.Add(address);
            }

            person.AssigningAuthority = options.Metadata.AssigningAuthority;
            person.CreationTimestamp  = DateTime.Now;
            person.Gender             = options.Gender;

            foreach (var item in options.OtherIdentifiers)
            {
                person.AlternateIdentifiers.Add(new Model.AlternateIdentifier
                {
                    CreationTimestamp = DateTime.Now,
                    Key   = item.AssigningAuthority,
                    Value = item.Value
                });
            }

            foreach (var item in options.Names)
            {
                Model.Name name = new Model.Name
                {
                    CreationTimestamp = DateTime.Now,
                    FirstNames        = new List <FirstName>
                    {
                        new FirstName
                        {
                            CreationTimestamp = DateTime.Now,
                            Value             = item.FirstName,
                        }
                    },
                    LastNames = new List <LastName>
                    {
                        new LastName
                        {
                            CreationTimestamp = DateTime.Now,
                            Value             = item.LastName,
                        },
                    },
                    Prefixes = new List <NamePrefix>
                    {
                        new NamePrefix
                        {
                            CreationTimestamp = DateTime.Now,
                            Value             = item.Prefix
                        }
                    },
                    NameUse = NameUse.Legal
                };

                name.MiddleNames = new List <MiddleName>();

                foreach (var middleName in item.MiddleNames)
                {
                    name.MiddleNames.Add(new MiddleName
                    {
                        CreationTimestamp = DateTime.Now,
                        Value             = middleName
                    });
                }

                name.Suffixes = new List <NameSuffix>();

                if (item.Suffixes != null)
                {
                    foreach (var suffix in item.Suffixes)
                    {
                        name.Suffixes.Add(new NameSuffix
                        {
                            CreationTimestamp = DateTime.Now,
                            Value             = suffix
                        });
                    }
                }

                person.Names.Add(name);
            }

            foreach (var item in options?.TelecomOptions?.EmailAddresses)
            {
                person.Telecoms.Add(new Model.Telecom
                {
                    CreationTimestamp = DateTime.Now,
                    TelecomType       = TelecomType.Email,
                    TelecomUse        = TelecomUse.Direct,
                    Value             = item
                });
            }

            foreach (var item in options?.TelecomOptions?.PhoneNumbers)
            {
                person.Telecoms.Add(new Model.Telecom
                {
                    CreationTimestamp = DateTime.Now,
                    TelecomType       = TelecomType.Phone,
                    TelecomUse        = TelecomUse.Direct,
                    Value             = item
                });
            }

            return(person);
        }