コード例 #1
0
        public override int SaveChanges()
        {
            if (LogChangesDuringSave)
            {
                if (!BusinessName.IsEmpty())
                {
                    //根据表示判断用重写的SaveChanges方法,还是普通的上下文SaveChanges方法
                    var entries = from e in this.ChangeTracker.Entries()
                                  where e.State != EntityState.Unchanged
                                  select e;
                    //过滤所有修改了的实体,包括:增加 / 修改 / 删除
                    string       operationType = string.Empty;
                    T_LogSetting logsetting    = new T_LogSetting();
                    IList <T_LogSettingDetail> logsettingdetails = new List <T_LogSettingDetail>();
                    if (entries != null)
                    {
                        foreach (var entry in entries)
                        {
                            InitLogSetting(entry, logsetting, logsettingdetails);
                        }
                        T_LogSetting.Add(logsetting);
                    }
                    if (logsettingdetails != null && logsettingdetails.Count() > 0)
                    {
                        T_LogSettingDetail.AddRange(logsettingdetails);
                    }
                }
            }

            return(base.SaveChanges());  //返回普通的上下文SaveChanges方法
        }
コード例 #2
0
        public BusinessRegistration Validate()
        {
            //  Method to validate a new business user

            BusinessUserDTO existingBusinessUser = _businessUserDAL.CheckBusinessUserNameEmailName(UserName, Email, BusinessName).FirstOrDefault();

            BusinessRegistration _registerValidation = new BusinessRegistration();

            if (existingBusinessUser == null)
            {
                _registerValidation.Valid = true;
            }
            else
            {
                if (existingBusinessUser.UserName.ToLower() == UserName.ToLower())
                {
                    _registerValidation.UserNameError = true;
                }
                if (existingBusinessUser.Email.ToLower() == Email.ToLower())
                {
                    _registerValidation.EmailError = true;
                }
                if (existingBusinessUser.BusinessName.ToLower() == BusinessName.ToLower())
                {
                    _registerValidation.BusinessNameError = true;
                }
            }

            return(_registerValidation);
        }
コード例 #3
0
        public ActionResult Create([Bind(Include = "ID,BusinessName1,Logo,Email,Website,BusinessType_id,Branch_id")] BusinessName businessName, HttpPostedFileBase Logo)
        {
            string newname   = "";
            string extention = Path.GetExtension(Logo.FileName);

            newname = DateTime.Now.Ticks.ToString() + extention;
            var mypath = Path.Combine(Server.MapPath("~/Logoimg"), newname);

            Logo.SaveAs(mypath);
            if (ModelState.IsValid)
            {
                businessName.Logo = newname;

                db.BusinessName.Add(businessName);
                if (db.SaveChanges() > 0)
                {
                    TempData["success"] = "success add business";
                }
                else
                {
                    TempData["error"] = "not add yet";
                }
                return(RedirectToAction("Index"));
            }

            ViewBag.Branch_id       = new SelectList(db.Branch, "ID", "Branchname", businessName.Branch_id);
            ViewBag.BusinessType_id = new SelectList(db.BusinessType, "ID", "BusinessType1", businessName.BusinessType_id);
            return(View(businessName));
        }
コード例 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            BusinessName businessName = db.BusinessName.Find(id);

            db.BusinessName.Remove(businessName);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "Id,Name")] BusinessName businessName)
 {
     if (ModelState.IsValid)
     {
         db.Entry(businessName).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(businessName));
 }
コード例 #6
0
        public ActionResult Create([Bind(Include = "Id,Name")] BusinessName businessName)
        {
            if (ModelState.IsValid)
            {
                db.BusinessName.Add(businessName);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(businessName));
        }
コード例 #7
0
        // GET: BusinessNames/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BusinessName businessName = db.BusinessName.Find(id);

            if (businessName == null)
            {
                return(HttpNotFound());
            }
            return(View(businessName));
        }
コード例 #8
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BusinessName businessName = db.BusinessName.Find(id);

            if (businessName == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Branch_id       = new SelectList(db.Branch, "ID", "Branchname", businessName.Branch_id);
            ViewBag.BusinessType_id = new SelectList(db.BusinessType, "ID", "BusinessType1", businessName.BusinessType_id);
            return(View(businessName));
        }
コード例 #9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (BusinessName.Length != 0)
            {
                hash ^= BusinessName.GetHashCode();
            }
            if (FilterType != global::Google.Ads.GoogleAds.V6.Enums.FeedItemSetStringFilterTypeEnum.Types.FeedItemSetStringFilterType.Unspecified)
            {
                hash ^= FilterType.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #10
0
 //create new business
 public void CreateBusinessApplication()
 {
     //call home page to enter inside setting window
     Thread.Sleep(500);
     BusinessCreate.ClickOn();
     softAssert.VerifyElementIsPresent(BusinessName);
     //    BusinessName.EnterClearText("1", "name test");
     BusinessSavebutton.ClickOn();
     softAssert.VerifyElementIsPresent(BusinessEmail);
     BusinessName.EnterClearText(Constant.businessName);
     BusinessPractinerNum.EnterClearText(Constant.businessNum);
     BusinessAddress.EnterClearText(Constant.businessAddress);
     BusinessCity.EnterClearText(Constant.businessCity);
     BusinessPhone.EnterClearText(Constant.businessNum);
     BusinessEmail.EnterClearText(Constant.businessEmail);
     BusinessSavebutton.ClickOn();
     softAssert.VerifySuccessMsg();
 }
コード例 #11
0
        public override int GetHashCode()
        {
            int hashCode = -1340049772;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (BusinessName != null)
            {
                hashCode += BusinessName.GetHashCode();
            }

            if (Country != null)
            {
                hashCode += Country.GetHashCode();
            }

            if (LanguageCode != null)
            {
                hashCode += LanguageCode.GetHashCode();
            }

            if (Currency != null)
            {
                hashCode += Currency.GetHashCode();
            }

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            if (MainLocationId != null)
            {
                hashCode += MainLocationId.GetHashCode();
            }

            return(hashCode);
        }
コード例 #12
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Merchant other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((BusinessName == null && other.BusinessName == null) || (BusinessName?.Equals(other.BusinessName) == true)) &&
                   ((Country == null && other.Country == null) || (Country?.Equals(other.Country) == true)) &&
                   ((LanguageCode == null && other.LanguageCode == null) || (LanguageCode?.Equals(other.LanguageCode) == true)) &&
                   ((Currency == null && other.Currency == null) || (Currency?.Equals(other.Currency) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((MainLocationId == null && other.MainLocationId == null) || (MainLocationId?.Equals(other.MainLocationId) == true)));
        }
コード例 #13
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Location other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true)) &&
                   ((Timezone == null && other.Timezone == null) || (Timezone?.Equals(other.Timezone) == true)) &&
                   ((Capabilities == null && other.Capabilities == null) || (Capabilities?.Equals(other.Capabilities) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((MerchantId == null && other.MerchantId == null) || (MerchantId?.Equals(other.MerchantId) == true)) &&
                   ((Country == null && other.Country == null) || (Country?.Equals(other.Country) == true)) &&
                   ((LanguageCode == null && other.LanguageCode == null) || (LanguageCode?.Equals(other.LanguageCode) == true)) &&
                   ((Currency == null && other.Currency == null) || (Currency?.Equals(other.Currency) == true)) &&
                   ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) &&
                   ((BusinessName == null && other.BusinessName == null) || (BusinessName?.Equals(other.BusinessName) == true)) &&
                   ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) &&
                   ((WebsiteUrl == null && other.WebsiteUrl == null) || (WebsiteUrl?.Equals(other.WebsiteUrl) == true)) &&
                   ((BusinessHours == null && other.BusinessHours == null) || (BusinessHours?.Equals(other.BusinessHours) == true)) &&
                   ((BusinessEmail == null && other.BusinessEmail == null) || (BusinessEmail?.Equals(other.BusinessEmail) == true)) &&
                   ((Description == null && other.Description == null) || (Description?.Equals(other.Description) == true)) &&
                   ((TwitterUsername == null && other.TwitterUsername == null) || (TwitterUsername?.Equals(other.TwitterUsername) == true)) &&
                   ((InstagramUsername == null && other.InstagramUsername == null) || (InstagramUsername?.Equals(other.InstagramUsername) == true)) &&
                   ((FacebookUrl == null && other.FacebookUrl == null) || (FacebookUrl?.Equals(other.FacebookUrl) == true)) &&
                   ((Coordinates == null && other.Coordinates == null) || (Coordinates?.Equals(other.Coordinates) == true)) &&
                   ((LogoUrl == null && other.LogoUrl == null) || (LogoUrl?.Equals(other.LogoUrl) == true)) &&
                   ((PosBackgroundUrl == null && other.PosBackgroundUrl == null) || (PosBackgroundUrl?.Equals(other.PosBackgroundUrl) == true)) &&
                   ((Mcc == null && other.Mcc == null) || (Mcc?.Equals(other.Mcc) == true)) &&
                   ((FullFormatLogoUrl == null && other.FullFormatLogoUrl == null) || (FullFormatLogoUrl?.Equals(other.FullFormatLogoUrl) == true)));
        }
コード例 #14
0
        public IActionResult OnPost(string returnUrl = null)
        {
            returnUrl = returnUrl ?? Url.Content("~/");
            if (ModelState.IsValid)
            {
                //tid
                var random = new Random();
                var tid    = PhoneNumber.Substring(3, 8) + BusinessName.Substring(0, 3).ToUpper() + DateTime.Now.ToString("ddMMyyHHmmss");
                //var normed = Regex.Replace(tid, @"\s+", "");
                var normed = tid.Replace(" ", String.Empty);
                Transactionid = normed;
                //deseriliaze entire model
                var nos = JsonConvert.SerializeObject(ModelState.Values);
                //
                desJSON = nos;

                //get total
                double total = 5000.00 * Double.Parse(noofselectedlgas);
                var    amt   = total.ToString("0.00");
                var    final = amt + " NGN";
                totalamount             = amt;
                ViewData["totalamount"] = final;
                //
            }

            StateList = _context.State.Select(a =>
                                              new SelectListItem
            {
                Value = a.Id.ToString(),
                Text  = a.Statename
            }).ToList();

            LGAList = _context.Lga.Select(a =>
                                          new SelectListItem
            {
                Value = a.Id.ToString(),
                Text  = a.Lganame
            }).ToList();
            return(Page());
        }
コード例 #15
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ResourceName.Length != 0)
            {
                hash ^= ResourceName.GetHashCode();
            }
            if (Campaign.Length != 0)
            {
                hash ^= Campaign.GetHashCode();
            }
            if (phoneNumber_ != null)
            {
                hash ^= PhoneNumber.GetHashCode();
            }
            if (FinalUrl.Length != 0)
            {
                hash ^= FinalUrl.GetHashCode();
            }
            if (AdvertisingLanguageCode.Length != 0)
            {
                hash ^= AdvertisingLanguageCode.GetHashCode();
            }
            if (businessSettingCase_ == BusinessSettingOneofCase.BusinessName)
            {
                hash ^= BusinessName.GetHashCode();
            }
            if (businessSettingCase_ == BusinessSettingOneofCase.BusinessLocationId)
            {
                hash ^= BusinessLocationId.GetHashCode();
            }
            hash ^= (int)businessSettingCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #16
0
 public ActionResult Edit([Bind(Include = "ID,BusinessName1,Logo,Email,Website,BusinessType_id,Branch_id")] BusinessName businessName)
 {
     if (ModelState.IsValid)
     {
         var query = Get(businessName.ID);
         if (query != null)
         {
             query.ID              = businessName.ID;
             query.Logo            = businessName.Logo;
             query.Website         = businessName.Website;
             query.Email           = businessName.Email;
             query.BusinessName1   = businessName.BusinessName1;
             query.BusinessType_id = businessName.BusinessType_id;
             query.Branch_id       = businessName.Branch_id;
         }
         //db.Entry(businessName).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Branch_id       = new SelectList(db.Branch, "ID", "Branchname", businessName.Branch_id);
     ViewBag.BusinessType_id = new SelectList(db.BusinessType, "ID", "BusinessType1", businessName.BusinessType_id);
     return(View(businessName));
 }
コード例 #17
0
        protected override void RunActualProcess()
        {
            // ReSharper disable once StringLiteralTypo
            ExcelHelper eh  = new ExcelHelper(Services.Logger, MyStage);
            var         arr = eh.ExtractDataFromExcel2(CombineForFlaSettings("BusinessInBurgdorf.xlsx"), 1, "A1", "C2000", out var _);
            var         db  = Services.SqlConnectionPreparer.GetDatabaseConnection(Stage.Raw, Constants.PresentSlice);

            db.RecreateTable <BusinessName>();

            db.BeginTransaction();
            for (var row = 2; row < arr.GetLength(0); row++)
            {
                var a = new BusinessName();
                if (arr[row, 0] == null)
                {
                    continue;
                }

                AssignFields(a, arr, row);
                db.Save(a);
            }

            db.CompleteTransaction();
        }
コード例 #18
0
        protected override void RunActualProcess()
        {
            // ReSharper disable once StringLiteralTypo
            var arr = ExcelHelper.ExtractDataFromExcel(@"U:\SimZukunft\RawDataForMerging\BusinessInBurgdorf.xlsx", 1, "A1", "B2000");

            Services.SqlConnection.RecreateTable <BusinessName>(Stage.Raw, Constants.PresentSlice);

            var db = Services.SqlConnection.GetDatabaseConnection(Stage.Raw, Constants.PresentSlice).Database;

            db.BeginTransaction();
            for (var row = 1; row < arr.GetLength(0); row++)
            {
                var a = new BusinessName();
                if (arr[row, 1] == null)
                {
                    continue;
                }

                AssignFields(a, arr, row);
                db.Save(a);
            }

            db.CompleteTransaction();
        }
コード例 #19
0
        /// <summary>
        /// Returns true if CommonOrganisation instances are equal
        /// </summary>
        /// <param name="other">Instance of CommonOrganisation to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CommonOrganisation other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     LastUpdateTime == other.LastUpdateTime ||
                     LastUpdateTime != null &&
                     LastUpdateTime.Equals(other.LastUpdateTime)
                     ) &&
                 (
                     AgentFirstName == other.AgentFirstName ||
                     AgentFirstName != null &&
                     AgentFirstName.Equals(other.AgentFirstName)
                 ) &&
                 (
                     AgentLastName == other.AgentLastName ||
                     AgentLastName != null &&
                     AgentLastName.Equals(other.AgentLastName)
                 ) &&
                 (
                     AgentRole == other.AgentRole ||
                     AgentRole != null &&
                     AgentRole.Equals(other.AgentRole)
                 ) &&
                 (
                     BusinessName == other.BusinessName ||
                     BusinessName != null &&
                     BusinessName.Equals(other.BusinessName)
                 ) &&
                 (
                     LegalName == other.LegalName ||
                     LegalName != null &&
                     LegalName.Equals(other.LegalName)
                 ) &&
                 (
                     ShortName == other.ShortName ||
                     ShortName != null &&
                     ShortName.Equals(other.ShortName)
                 ) &&
                 (
                     Abn == other.Abn ||
                     Abn != null &&
                     Abn.Equals(other.Abn)
                 ) &&
                 (
                     Acn == other.Acn ||
                     Acn != null &&
                     Acn.Equals(other.Acn)
                 ) &&
                 (
                     IsACNCRegistered == other.IsACNCRegistered ||
                     IsACNCRegistered != null &&
                     IsACNCRegistered.Equals(other.IsACNCRegistered)
                 ) &&
                 (
                     IndustryCode == other.IndustryCode ||
                     IndustryCode != null &&
                     IndustryCode.Equals(other.IndustryCode)
                 ) &&
                 (
                     OrganisationType == other.OrganisationType ||
                     OrganisationType != null &&
                     OrganisationType.Equals(other.OrganisationType)
                 ) &&
                 (
                     RegisteredCountry == other.RegisteredCountry ||
                     RegisteredCountry != null &&
                     RegisteredCountry.Equals(other.RegisteredCountry)
                 ) &&
                 (
                     EstablishmentDate == other.EstablishmentDate ||
                     EstablishmentDate != null &&
                     EstablishmentDate.Equals(other.EstablishmentDate)
                 ));
        }
コード例 #20
0
 // ReSharper disable once FunctionComplexityOverflow
 private static void AssignFields([NotNull] BusinessName a, [ItemNotNull][NotNull] object[,] arr, int row)
 {
     a.Name     = Helpers.GetString(arr[row, 1]);
     a.Category = Helpers.GetStringNotNull(arr[row, 2]);
 }
コード例 #21
0
ファイル: Class.cs プロジェクト: zzllkk2003/everest
        internal string GraphicalRepresentationClassOnly()
        {
            StringBuilder sb = new StringBuilder();

            // Members
            string memberString = "";

            foreach (ClassContent cc in this.content)
            {
                if (cc is Property)
                {
                    switch ((cc as Property).PropertyType)
                    {
                    case Property.PropertyTypes.Structural:
                        memberString += string.Format("@ {0}{2} : {1}\\l", cc.Name, (cc as Property).Type.ToString().Replace("&gt;", "\\>").Replace("&lt;", "\\<"), cc.BusinessName != null ? " (" + cc.BusinessName.Replace("&gt;", "\\>").Replace("&lt;", "\\<").Replace("\r", "").Replace("\n", "") + ")" : "");
                        break;

                    case Property.PropertyTypes.NonStructural:
                        memberString += string.Format("+ {0}{2} : {1}\\l", cc.Name, (cc as Property).Type.ToString().Replace("&gt;", "\\>").Replace("&lt;", "\\<"), cc.BusinessName != null ? " (" + cc.BusinessName.Replace("&gt;", "\\>").Replace("&lt;", "\\<").Replace("\r", "").Replace("\n", "") + ")" : "");
                        break;
                    }
                }
            }

            // Declare this as a node
            sb.AppendFormat("node [fontname=\"Arial\" fontsize=10 shape=record color=red] {2}_{0} [label=\"{{{0}{3}|{1}}}\"] ", Name, memberString, ContainerName, BusinessName != null ? " (" + BusinessName.Replace("&gt;", "\\>").Replace("&lt;", "\\<").Replace("\r", "").Replace("\n", "") + ")" : "");

            // Draw inheritence
            // Get the base representation
            if (this.baseClass != null && this.baseClass.Class != null)
            {
                sb.AppendFormat("edge [fontname=\"Arial\" fontsize=10 arrowhead=empty color=black style=\"solid\" headlabel=\"\" label=\"\"] node[color=black] {2}_{0}->{3}_{1} ", Name, baseClass.Class.Name, ContainerName, baseClass.Class.ContainerName);
            }
            // Draw Realization or Projections
            if (this.Realizations != null)
            {
                foreach (TypeReference tr in Realizations)
                {
                    sb.AppendFormat("edge [arrowhead=empty color=black style=dashed headlabel=\"\" label=\"\"] node[color=black] {2}_{0}->{3}_{1} ", Name, tr.Class.Name, ContainerName, tr.Class.ContainerName);
                }
            }

            return(sb.ToString());
        }
コード例 #22
0
        public override int GetHashCode()
        {
            int hashCode = -255518735;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (Name != null)
            {
                hashCode += Name.GetHashCode();
            }

            if (Address != null)
            {
                hashCode += Address.GetHashCode();
            }

            if (Timezone != null)
            {
                hashCode += Timezone.GetHashCode();
            }

            if (Capabilities != null)
            {
                hashCode += Capabilities.GetHashCode();
            }

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (MerchantId != null)
            {
                hashCode += MerchantId.GetHashCode();
            }

            if (Country != null)
            {
                hashCode += Country.GetHashCode();
            }

            if (LanguageCode != null)
            {
                hashCode += LanguageCode.GetHashCode();
            }

            if (Currency != null)
            {
                hashCode += Currency.GetHashCode();
            }

            if (PhoneNumber != null)
            {
                hashCode += PhoneNumber.GetHashCode();
            }

            if (BusinessName != null)
            {
                hashCode += BusinessName.GetHashCode();
            }

            if (Type != null)
            {
                hashCode += Type.GetHashCode();
            }

            if (WebsiteUrl != null)
            {
                hashCode += WebsiteUrl.GetHashCode();
            }

            if (BusinessHours != null)
            {
                hashCode += BusinessHours.GetHashCode();
            }

            if (BusinessEmail != null)
            {
                hashCode += BusinessEmail.GetHashCode();
            }

            if (Description != null)
            {
                hashCode += Description.GetHashCode();
            }

            if (TwitterUsername != null)
            {
                hashCode += TwitterUsername.GetHashCode();
            }

            if (InstagramUsername != null)
            {
                hashCode += InstagramUsername.GetHashCode();
            }

            if (FacebookUrl != null)
            {
                hashCode += FacebookUrl.GetHashCode();
            }

            if (Coordinates != null)
            {
                hashCode += Coordinates.GetHashCode();
            }

            if (LogoUrl != null)
            {
                hashCode += LogoUrl.GetHashCode();
            }

            if (PosBackgroundUrl != null)
            {
                hashCode += PosBackgroundUrl.GetHashCode();
            }

            if (Mcc != null)
            {
                hashCode += Mcc.GetHashCode();
            }

            if (FullFormatLogoUrl != null)
            {
                hashCode += FullFormatLogoUrl.GetHashCode();
            }

            return(hashCode);
        }
コード例 #23
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (LastUpdateTime != null)
         {
             hashCode = hashCode * 59 + LastUpdateTime.GetHashCode();
         }
         if (AgentFirstName != null)
         {
             hashCode = hashCode * 59 + AgentFirstName.GetHashCode();
         }
         if (AgentLastName != null)
         {
             hashCode = hashCode * 59 + AgentLastName.GetHashCode();
         }
         if (AgentRole != null)
         {
             hashCode = hashCode * 59 + AgentRole.GetHashCode();
         }
         if (BusinessName != null)
         {
             hashCode = hashCode * 59 + BusinessName.GetHashCode();
         }
         if (LegalName != null)
         {
             hashCode = hashCode * 59 + LegalName.GetHashCode();
         }
         if (ShortName != null)
         {
             hashCode = hashCode * 59 + ShortName.GetHashCode();
         }
         if (Abn != null)
         {
             hashCode = hashCode * 59 + Abn.GetHashCode();
         }
         if (Acn != null)
         {
             hashCode = hashCode * 59 + Acn.GetHashCode();
         }
         if (IsACNCRegistered != null)
         {
             hashCode = hashCode * 59 + IsACNCRegistered.GetHashCode();
         }
         if (IndustryCode != null)
         {
             hashCode = hashCode * 59 + IndustryCode.GetHashCode();
         }
         if (OrganisationType != null)
         {
             hashCode = hashCode * 59 + OrganisationType.GetHashCode();
         }
         if (RegisteredCountry != null)
         {
             hashCode = hashCode * 59 + RegisteredCountry.GetHashCode();
         }
         if (EstablishmentDate != null)
         {
             hashCode = hashCode * 59 + EstablishmentDate.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #24
0
        public async Task <IActionResult> OnPostSaveAgentAsync()
        {
            string merchantid = "";
            var    builder    = new ConfigurationBuilder()
                                .SetBasePath(Directory.GetCurrentDirectory())
                                .AddJsonFile("appsettings.json");
            var    configuration = builder.Build();
            string paendpoint    = configuration["payattititudeendpoint"];
            //
            var random = new Random();
            var tid    = PhoneNumber.Substring(3, 8) + BusinessName.Substring(0, 3).ToUpper() + DateTime.Now.ToString("ddMMyyHHmmss");
            //var normed = Regex.Replace(tid, @"\s+", "");
            var normed = tid.Replace(" ", String.Empty);

            Transactionid = normed;
            double totalamt = 5000.00 * Double.Parse(noofselectedlgas);
            var    am       = totalamt.ToString("0.00");
            //
            Pwpresponse response = new Pwpresponse();
            Pwprequest  payload  = new Pwprequest()
            {
                Description = "UP AGENT REGISTRATION FEE",
                TrxId       = normed,
                Amount      = am,
                Phone       = PhoneNumber
            };
            var despayload = JsonConvert.SerializeObject(payload);

            //ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => {
            //    return true;
            //};
            //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            HttpClient client = CreateWebRequest();

            var resp = await client.PostAsJsonAsync(paendpoint, payload);

            if (!resp.IsSuccessStatusCode)
            {
                //SuccessResponse response = new SuccessResponse {
                response.status       = null;
                response.amount       = null;
                response.approvalCode = null;
                response.date         = DateTime.Now.ToString();
                response.holder       = null;
                response.id           = null;
                response.paymentRef   = null;
                response.requestId    = null;
                response.existing     = null;
                response.phone        = null;
                response.success      = null;
                response.uan          = null;
                MutantStatus          = "A network error occured, Please try again";
                return(Page());
            }
            else
            {
                var readResult = await resp.Content.ReadAsStringAsync();

                var dresult = (Pwpresponse)JsonConvert.DeserializeObject(readResult, typeof(Pwpresponse));

                response.status       = dresult.status;
                response.amount       = dresult.amount;
                response.approvalCode = dresult.approvalCode;
                response.date         = dresult.date;
                response.holder       = dresult.holder;
                response.id           = dresult.id;
                response.paymentRef   = dresult.paymentRef;
                response.requestId    = dresult.requestId;
                response.existing     = dresult.existing;
                response.phone        = dresult.phone;
                response.success      = dresult.success;
                response.uan          = dresult.uan;

                if (response.success == "true")
                {
                    try
                    {
                        successstatus = response.success;
                        var agent = new Upagent
                        {
                            Phonenumber         = PhoneNumber,
                            Businessname        = BusinessName,
                            Businessphone       = BusinessPhoneNumber,
                            Selectedproprietors = JSONproprietors,
                            Businessemail       = BusinessEmail,
                            Officeaddress       = Address,
                            Officestateid       = Officestateid,
                            Officelgaid         = Officelgaid,
                            Acctypeid           = 2,
                            Rcnumber            = RCNumber,
                            Natureofbusiness    = NatureofBusiness,
                            Noofbusinessyears   = NoofBusinessYears,
                            Deslgaid            = Deslgaid,
                            Turnover            = Turnover,
                            Profitbeforetax     = ProfitBeforeTax,
                            Selectedlgas        = JSONLGAs,
                            invoiceNumber       = normed,
                            PATransactionid     = dresult.paymentRef,
                            PaymentStatus       = "1",
                            Trandate            = DateTime.Now.ToString()
                        };
                        _context.Add(agent);
                        await _context.SaveChangesAsync();

                        return(RedirectToPage("./Success"));
                    }
                    catch (Exception e) { }
                }
                else
                {
                    var agent = new Upagent
                    {
                        Phonenumber         = PhoneNumber,
                        Businessname        = BusinessName,
                        Businessphone       = BusinessPhoneNumber,
                        Selectedproprietors = JSONproprietors,
                        Businessemail       = BusinessEmail,
                        Officeaddress       = Address,
                        Officestateid       = Officestateid,
                        Officelgaid         = Officelgaid,
                        Acctypeid           = 2,
                        Rcnumber            = RCNumber,
                        Natureofbusiness    = NatureofBusiness,
                        Noofbusinessyears   = NoofBusinessYears,
                        Deslgaid            = Deslgaid,
                        Turnover            = Turnover,
                        Profitbeforetax     = ProfitBeforeTax,
                        Selectedlgas        = JSONLGAs,
                        invoiceNumber       = normed,
                        PATransactionid     = dresult.paymentRef,
                        PaymentStatus       = "0",
                        Trandate            = DateTime.Now.ToString(),
                    };
                    _context.Add(agent);
                    await _context.SaveChangesAsync();

                    StateList = _context.State.Select(a =>
                                                      new SelectListItem
                    {
                        Value = a.Id.ToString(),
                        Text  = a.Statename
                    }).ToList();

                    LGAList = _context.Lga.Select(a =>
                                                  new SelectListItem
                    {
                        Value = a.Id.ToString(),
                        Text  = a.Lganame
                    }).ToList();
                    Transactionid = null;
                    MutantStatus  = dresult.status;
                    return(Page());
                }

                StateList = _context.State.Select(a =>
                                                  new SelectListItem
                {
                    Value = a.Id.ToString(),
                    Text  = a.Statename
                }).ToList();

                LGAList = _context.Lga.Select(a =>
                                              new SelectListItem
                {
                    Value = a.Id.ToString(),
                    Text  = a.Lganame
                }).ToList();
                return(Page());
            }
        }