public void SupplierRegion(rX supplier)
        {
            // Supplier Region
            var sup = db.supplierregions.FirstOrDefault(s => s.sid.Equals(supplier.idd) && s.region.Equals(supplier.region));

            if (sup == null)
            {
                var isms = (string.IsNullOrEmpty(supplier.mobile)) ? "n" : "y";

                db.supplierregions.Add(new ADO.supplierregion
                {
                    sid      = supplier.idd,
                    region   = supplier.region,
                    password = supplier.password,
                    mobile   = supplier.mobile,
                    sms      = isms,
                    status   = "A"
                });
            }
            else
            {
                sup.mobile   = supplier.mobile;
                sup.password = supplier.password;
            }

            db.SaveChanges();
        }
        public async Task <bool> AddSupplier(rX supplier)
        {
            var db = new dnbmssqlEntities();

            NullFiller.FillNullFields <rX>(supplier);
            Capitalize.UppercaseClassFields <rX>(supplier);

            // Supplier Login
            var username = supplier.idd + supplier.region;

            var sup_user = db.C_User.FirstOrDefault(s => s.UserName.Equals(username));

            if (sup_user == null)
            {
                var user = new User {
                    UserName = username, Email = username + "@danubeco.com", Region = supplier.region
                };

                try
                {
                    var result = await UserManager.CreateAsync(user, supplier.password);

                    if (!result.Succeeded)
                    {
                        return(false);
                    }
                    else
                    {
                        SupplierInfo(supplier);

                        return(true);
                    }
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else
            {
                var user = await UserManager.FindByIdAsync(sup_user.UserId);

                user.PasswordHash = UserManager.PasswordHasher.HashPassword(supplier.password);

                await UserManager.UpdateAsync(user);

                SupplierInfo(supplier);

                return(true);
            }
        }
        public void SupplierInfo(rX supplier)
        {
            // Supplier
            var supname = db.suppliers.FirstOrDefault(s => s.sid.Equals(supplier.idd));

            if (supname == null)
            {
                db.suppliers.Add(new ADO.supplier
                {
                    sid  = supplier.idd,
                    name = supplier.name
                });

                db.SaveChanges();
            }

            SupplierRegion(supplier);
        }
 => SplitEllipticalArc1(x, y, rX, rY, angle, startAngle, sweepAngle, t);