コード例 #1
0
        public ActionResult ProductDetail(int?id)
        {
            domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
            User User = domainIndentifier.GetUserRelatedDomain();

            UserID                   = User != null ? User.Id : 0;
            ViewBag.UserID           = UserID;
            Session["CurrentUserID"] = UserID;
            ProductDetailViewModel ProductDetailViewModel = new ProductDetailViewModel();
            var product = db.Products.FirstOrDefault(x => x.Id == id && x.UserID == UserID);

            if (product != null)
            {
                if (User.IsActive == false)
                {
                    return(HttpNotFound("User Not Active"));
                }
                ProductDetailViewModel.ProductDetail   = product;
                ProductDetailViewModel.RelatedProducts = db.Products.Where(x => x.Id == id).OrderByDescending(x => x.Id).Take(4).ToList();
                return(View(ProductDetailViewModel));
            }
            else
            {
                if (UserID != 0)
                {
                    return(HttpNotFound("Page is not designed"));
                }
                return(HttpNotFound());
            }
        }
コード例 #2
0
        public ActionResult Login(string Email, string Password)
        {
            // validate current sub domain
            domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
            User User = domainIndentifier.GetUserRelatedDomain();

            UserID                   = User != null ? User.Id : 0;
            ViewBag.UserID           = UserID;
            Session["CurrentUserID"] = UserID;
            // end of validation

            var isUserExist = db.ShopUsers.FirstOrDefault(x => x.Email == Email.ToLower() && x.Password == Password && x.UserID == UserID);

            if (isUserExist == null)
            {
                TempData["Msg"] = "<p class='text-danger text-center'>Incorrect Username/Password.</p>";
            }
            else
            {
                Session["WebloggedUserID"] = isUserExist.Id;
                // return RedirectToAction("Detail", "Orders", new { area = "UserPanel" });
                return(Redirect("/"));
            }
            return(View());
        }
コード例 #3
0
 public ActionResult Cart()
 {
     try
     {
         domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
         User User = domainIndentifier.GetUserRelatedDomain();
         UserID                   = User != null ? User.Id : 0;
         ViewBag.UserID           = UserID;
         Session["CurrentUserID"] = UserID;
         var cart          = (List <CartModel>)Session["cart"];
         var productDetail = new List <CartViewModel>();
         foreach (var item in cart)
         {
             var Detail = db.Products.FirstOrDefault(x => x.Id == item.ProductID && x.UserID == UserID);
             productDetail.Add(new CartViewModel()
             {
                 Name        = Detail.Name,
                 Description = Detail.Description,
                 Discount    = Detail.Discount,
                 Quantity    = item.Quantity,
                 Fee         = 0,
                 TotalPrice  = item.Quantity * Detail.Price,
                 Image       = Detail.ProductImage,
                 Price       = Detail.Price,
                 ProductID   = Detail.Id
             });
         }
         return(View(productDetail));
     }
     catch
     {
         var EmptyList = new List <CartViewModel>();
         return(View(EmptyList));
     }
 }
コード例 #4
0
        /// <summary>
        /// Find a client
        /// </summary>
        public Client FindClient(DomainIdentifier identifier)
        {
            PersonPersister persister = new PersonPersister();

            // HACK: I norder to work around Client Registry Hack
            ApplicationContext.CurrentContext = Context;
            // First we want to find the appropriate helper
            IDbConnection conn = DatabasePersistenceService.ReadOnlyConnectionManager.GetConnection();

            try
            {
                var    tPerson = persister.GetPerson(conn, null, identifier, true);
                Client retVal  = new Client()
                {
                    AlternateIdentifiers = tPerson.AlternateIdentifiers,
                    BirthTime            = tPerson.BirthTime,
                    GenderCode           = tPerson.GenderCode,
                    Id               = tPerson.Id,
                    IsMasked         = tPerson.IsMasked,
                    LegalName        = tPerson.Names == null || tPerson.Names.Count == 0 ? null : tPerson.Names.Find(n => n.Use == NameSet.NameSetUse.Legal) ?? tPerson.Names[0],
                    PerminantAddress = tPerson.Addresses == null || tPerson.Addresses.Count == 0 ? null : tPerson.Addresses.Find(n => n.Use == AddressSet.AddressSetUse.HomeAddress) ?? tPerson.Addresses[0],
                    TelecomAddresses = tPerson.TelecomAddresses
                };
                retVal.Add(tPerson, "PSN", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.TargetOf, null);
                return(retVal);
            }
            finally
            {
                DatabasePersistenceService.ConnectionManager.ReleaseConnection(conn);
            }
        }
コード例 #5
0
        public async Task <ActionResult> Edit()
        {
            // validate current sub domain
            domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
            var User = domainIndentifier.GetUserRelatedDomain();

            UserID                   = User != null ? User.Id : 0;
            ViewBag.UserID           = UserID;
            Session["CurrentUserID"] = UserID;

            //// check user is login or not
            if (string.IsNullOrEmpty(Convert.ToString(Session["WebloggedUserID"])))
            {
                return(Redirect("/Account/Login"));
            }

            // bussiness logic
            long ShopUserID = Convert.ToInt64(Session["WebloggedUserID"]);

            ViewBag.ShopUserID = ShopUserID;
            // end

            ShopUser shopUser = await db.ShopUsers.FindAsync(ShopUserID);

            if (shopUser == null)
            {
                return(HttpNotFound());
            }
            return(View(shopUser));
        }
コード例 #6
0
 /// <summary>
 /// Create an II from a domain identifier
 /// </summary>
 /// <param name="authorityId"></param>
 /// <param name="dtls"></param>
 /// <returns></returns>
 public II CreateII(DomainIdentifier id)
 {
     return(new II()
     {
         Root = id.Domain, Extension = id.Identifier
     });
 }
コード例 #7
0
        // GET: User/Orders
        public ActionResult Detail()
        {
            // validate current sub domain
            domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
            var User = domainIndentifier.GetUserRelatedDomain();
            UserID = User != null ? User.Id : 0;
            ViewBag.UserID = UserID;
            Session["CurrentUserID"] = UserID;

            //// check user is login or not
            if (string.IsNullOrEmpty(Convert.ToString(Session["WebloggedUserID"])))
            {
                return Redirect("/Account/Login");
            }

            // bussiness logic
            long ShopUserID = Convert.ToInt64(Session["WebloggedUserID"]);
            ViewBag.ShopUserID = ShopUserID;

               var PlacedOrders = (from PlacedOrder in db.PlacedOrders.AsEnumerable()
                                where PlacedOrder.ShopUserID == ShopUserID
                                select new Model.Models.PlacedOrdersViewModel()
                                {
                                    PlacedOrderID = PlacedOrder.Id,
                                    OrderStatus = ((OrderStatus)PlacedOrder.OrderStatus).ToString(),
                                    DateTime = PlacedOrder.OrderCreatedDateTime,
                                    PaymentMmethod = ((ShopPaymentMethod)PlacedOrder.PaymentMethod).ToString(),
                                    TotalPrice = PlacedOrder.TotalPrice.Value
                                }).ToList();
            return View(PlacedOrders);
        }
コード例 #8
0
        /// <summary>
        /// Create domain identifier
        /// </summary>
        /// <param name="iI"></param>
        /// <returns></returns>
        protected virtual DomainIdentifier CreateDomainIdentifier(MARC.Everest.DataTypes.II iI, List <IResultDetail> dtls)
        {
            var retVal = new DomainIdentifier()
            {
                Domain             = iI.Root,
                Identifier         = iI.Extension,
                AssigningAuthority = iI.AssigningAuthorityName
            };

            // Assign the assigning authority identifier from configuration
            var config  = this.m_context.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService;
            var oidData = config.OidRegistrar.FindData(iI.Root);

            if (oidData != null)
            {
                var assigningAut = oidData.Attributes.Find(o => o.Key.Equals("AssigningAuthorityName"));
                if (!assigningAut.Equals(default(KeyValuePair <String, String>)))
                {
                    if (!String.IsNullOrEmpty(retVal.AssigningAuthority) &&
                        !retVal.AssigningAuthority.Equals(assigningAut.Value))
                    {
                        dtls.Add(new FixedValueMisMatchedResultDetail(retVal.AssigningAuthority, assigningAut.Value, true, null));
                    }

                    retVal.AssigningAuthority = assigningAut.Value;
                }
            }
            return(retVal);
        }
コード例 #9
0
        public ActionResult Index()
        {
            domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
            User User = domainIndentifier.GetUserRelatedDomain();

            UserID = User != null ? User.Id : 0;
            Menu UserData = db.Menus.FirstOrDefault(x => x.Name == "Index" && x.UserID == UserID);

            ViewBag.UserID           = UserID;
            Session["CurrentUserID"] = UserID;
            if (UserData != null && UserID != 0)
            {
                if (User.IsActive == false)
                {
                    return(HttpNotFound("User Not Active"));
                }
                return(View(UserData));
            }
            else
            {
                if (UserID != 0)
                {
                    return(HttpNotFound("Page is not designed"));
                }
                return(HttpNotFound());
            }
        }
コード例 #10
0
        public ActionResult Home(string Page, int?id)
        {
            domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
            User User = domainIndentifier.GetUserRelatedDomain();

            UserID                   = User != null ? User.Id : 0;
            ViewBag.UserID           = UserID;
            Session["CurrentUserID"] = UserID;
            Menu page = db.Menus.FirstOrDefault(x => x.Id == id && x.UserID == UserID);

            if (page != null)
            {
                if (User.IsActive == false)
                {
                    return(HttpNotFound("User Not Active"));
                }
                return(View(page));
            }
            else
            {
                if (UserID != 0)
                {
                    return(HttpNotFound("Page is not designed"));
                }
                return(HttpNotFound());
            }
        }
コード例 #11
0
 public static Extension CreateIdentificationExtension(DomainIdentifier id)
 {
     return(new Extension()
     {
         Url = GetExtensionNameUrl("identification"),
         Value = new PatientMessageProcessor().ConvertDomainIdentifier(id)
     });
 }
コード例 #12
0
 /// <summary>
 /// Eventhandler that's called when an IPC connection is disposed.
 /// </summary>
 /// <param name="domainIdentifier"></param>
 private void OnDomainDisposed(DomainIdentifier domainIdentifier)
 {
     lock (_domainConnectionsSyncRoot)
     {
         if (_domainConnections.ContainsKey(domainIdentifier))
         {
             _domainConnections.Remove(domainIdentifier);
         }
     }
 }
コード例 #13
0
        /// <summary>
        /// Convert domain identifier
        /// </summary>
        internal Identifier ConvertDomainIdentifier(DomainIdentifier itm)
        {
            // Attempt to lookup the OID
            var oid    = ApplicationContext.ConfigurationService.OidRegistrar.FindData(itm.Domain);
            var retVal = new Identifier()
            {
                Value = itm.Identifier
            };

            if (oid == null)
            {
                retVal.System = new Uri(String.Format("urn:oid:{0}", itm.Domain));
            }
            else if (itm.Domain == "urn:ietf:rfc:3986")
            {
                retVal.System = new Uri(itm.Domain);
            }
            else
            {
                retVal.System = new Uri(oid.Ref != null ? oid.Ref.ToString() : string.Format("urn:oid:{0}", itm.Domain));
            }

            // Assigning auth?
            if (oid != null)
            {
                var assgn = oid.Attributes.Find(o => o.Key == "CustodialOrgName").Value;
                if (!String.IsNullOrEmpty(assgn))
                {
                    retVal.Assigner = new Resource <Organization>()
                    {
                        Display = assgn
                    }
                }
                ;
                else
                {
                    retVal.Assigner = new Resource <Organization>()
                    {
                        Display = oid.Description
                    }
                };
                assgn = oid.Attributes.Find(o => o.Key == "AssigningAuthorityName").Value;
                if (!String.IsNullOrEmpty(assgn))
                {
                    retVal.Label = assgn;
                }
            }

            return(retVal);
        }
コード例 #14
0
        /// <summary>
        /// Convert an identifier
        /// </summary>
        internal DomainIdentifier ConvertIdentifier(Identifier id, List <IResultDetail> dtls)
        {
            // Attempt to lookup the OID
            //if(id.System == null)
            if (id.System == null && id.Label != null)
            {
                var dat = ApplicationContext.ConfigurationService.OidRegistrar.GetOid(id.Label);
                if (dat != null)
                {
                    id.System = new Uri(MessageUtil.TranslateDomain(dat.Oid));
                }
                else
                {
                    dat = ApplicationContext.ConfigurationService.OidRegistrar.FindData(o => o.Attributes.Find(a => a.Key == "AssigningAuthorityName").Value == id.Label.ToString());
                    if (dat != null)
                    {
                        id.System = new Uri(MessageUtil.TranslateDomain(dat.Oid));
                    }
                    throw new ConstraintException(String.Format("Can't find an OID with label {0}", id.Label));
                }
            }
            String oid    = MessageUtil.TranslateFhirDomain(id.System.ToString());
            var    lookup = ApplicationContext.ConfigurationService.OidRegistrar.FindData(oid);
            var    retVal = new DomainIdentifier()
            {
                Domain             = oid,
                Identifier         = id.Value,
                AssigningAuthority = id.Label
            };

            // Assigning auth?
            if (lookup == null)
            {
                dtls.Add(new VocabularyIssueResultDetail(ResultDetailType.Warning, ApplicationContext.LocalizationService.GetString("DBCF00C"), null, null));
            }
            else
            {
                var asn = lookup.Attributes.Find(o => o.Key == "AssigningAuthorityName");
                if (asn.Value == null)
                {
                    dtls.Add(new VocabularyIssueResultDetail(ResultDetailType.Error, String.Format(ApplicationContext.LocalizationService.GetString("MSGE06A"), oid), null, null));
                }
                else if (!String.IsNullOrEmpty(retVal.AssigningAuthority) && asn.Value != retVal.AssigningAuthority)
                {
                    dtls.Add(new FixedValueMisMatchedResultDetail(retVal.AssigningAuthority, asn.Value, "Identifier"));
                }
            }
            return(retVal);
        }
コード例 #15
0
        /// <summary>
        /// Create a domain identifier list
        /// </summary>
        //internal static List<DomainIdentifier> CreateDomainIdentifierList(List<MARC.Everest.RMIM.CA.R020403.REPC_MT500006CA.RecordId> list)
        //{
        //    List<DomainIdentifier> retVal = new List<DomainIdentifier>();
        //    foreach (var recId in list)
        //        retVal.Add(new DomainIdentifier()
        //        {
        //            Domain = recId.Value.Root,
        //            Identifier = recId.Value.Extension
        //        });
        //    return retVal;
        //}

        /// <summary>
        /// Validates common transport wrapper flags
        /// </summary>
        public static void ValidateTransportWrapper(IInteraction interaction, ISystemConfigurationService config, List <IResultDetail> dtls)
        {
            // Check the response mode code
            string rspMode  = Util.ToWireFormat((interaction as IImplementsResponseModeCode <ResponseMode>).ResponseModeCode);
            string procMode = Util.ToWireFormat((interaction as IImplementsProcessingCode <ProcessingID>).ProcessingCode);

            var profile = interaction as IImplementsProfileId;

            // Check response mode
            if (rspMode != "I")
            {
                dtls.Add(new UnsupportedResponseModeResultDetail(rspMode));
            }
            //// Check processing id
            //if (procMode != "P" && procMode != "D")
            //    dtls.Add(new UnsupportedProcessingModeResultDetail(procMode));

            // Check version identifier
            if (!interaction.VersionCode.CodeValue.Equals("V3-2008N"))
            {
                dtls.Add(new UnsupportedVersionResultDetail(String.Format("Version '{0}' is not supported by this endpoint", interaction.VersionCode)));
            }
            else if (profile == null || profile.ProfileId.Count(o => II.Comparator(o, MCCI_IN000002CA.GetProfileId()[0]) == 0) == 0)
            {
                dtls.Add(new UnsupportedVersionResultDetail(String.Format("Supplied profile identifier does not match any profile identifier this endpoint can reliably process")));
            }


            Sender sndr = interaction.GetType().GetProperty("Sender").GetValue(interaction, null) as Sender;

            if (sndr == null || sndr.NullFlavor != null || sndr.Device == null || sndr.Device.NullFlavor != null || sndr.Device.Id == null || sndr.Device.Id.IsNull)
            {
                dtls.Add(new MandatoryElementMissingResultDetail(ResultDetailType.Error, "Sender information is missing from message", null));
            }
            else
            {
                var sndrId = new DomainIdentifier()
                {
                    Domain = sndr.Device.Id.Root, Identifier = sndr.Device.Id.Extension
                };
                if (!config.IsRegisteredDevice(sndrId))
                {
                    dtls.Add(new UnrecognizedSenderResultDetail(sndrId));
                }
            }
        }
コード例 #16
0
        public ActionResult Login(string Url = null)
        {
            // validate current sub domain
            domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
            User User = domainIndentifier.GetUserRelatedDomain();

            UserID                   = User != null ? User.Id : 0;
            ViewBag.UserID           = UserID;
            Session["CurrentUserID"] = UserID;

            //// check user is login or not
            if (!string.IsNullOrEmpty(Convert.ToString(Session["WebloggedUserID"])))
            {
                return(RedirectToAction("Detail", "Orders", new { area = "UserPanel" }));
            }
            return(View());
        }
コード例 #17
0
        public ActionResult OrdersItems(int? PoID)
        {
            // validate current sub domain
            domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
            var User = domainIndentifier.GetUserRelatedDomain();
            UserID = User != null ? User.Id : 0;
            ViewBag.UserID = UserID;
            Session["CurrentUserID"] = UserID;

            //// check user is login or not
            if (string.IsNullOrEmpty(Convert.ToString(Session["WebloggedUserID"])))
            {
                return Redirect("/Account/Login");
            }

            // bussiness logic
            long ShopUserID = Convert.ToInt64(Session["WebloggedUserID"]);
            ViewBag.ShopUserID = ShopUserID;

            var OrdersList = (from PlacedOrders in db.PlacedOrders
                              where PlacedOrders.Id == PoID && PlacedOrders.ShopUserID == ShopUserID
                              join orders in db.Orders
                              on PlacedOrders.Id equals orders.PlacedOrdersId
                              join ProductDetail in db.Products
                              on orders.ProductID equals ProductDetail.Id
                              select new CustomerOrdersListModel()
                              {
                                  ProductID = ProductDetail.Id,
                                  Name = ProductDetail.Name,
                                  Price = orders.Price,
                                  Description = ProductDetail.Description,
                                  Discount = orders.Discount,
                                  Fee = 0,
                                  Image = ProductDetail.ProductImage,
                                  Quantity = orders.Quantity,
                                  TotalPrice = orders.Price * orders.Quantity
                              }).OrderByDescending(x => x.ProductID).ToList();
            var ReceiverDetail = db.PlacedOrders.FirstOrDefault(x => x.ShopUserID == ShopUserID && x.Id == PoID);
            OrdersProductsViewModels Model = new OrdersProductsViewModels();
            Model.CustomerOrdersListModel = OrdersList;
            Model.OrderReceiverName = ReceiverDetail != null ? ReceiverDetail.ReceivedPersonName : string.Empty;
            Model.ReceiverPhoneNo = ReceiverDetail != null ? ReceiverDetail.ReceivedPhoneNumber : string.Empty;
            Model.ShippingAddress = ReceiverDetail != null ? ReceiverDetail.ShippingAddress : string.Empty;
            return View(Model);
        }
コード例 #18
0
        /// <summary>
        /// Create an II from a domain identifier
        /// </summary>
        /// <param name="authorityId"></param>
        /// <param name="dtls"></param>
        /// <returns></returns>
        public II CreateII(DomainIdentifier id, List <IResultDetail> dtls)
        {
            string assAuth = id.AssigningAuthority;

            if (String.IsNullOrEmpty(assAuth))
            {
                var oidData = this.m_configService.OidRegistrar.FindData(o => o.Attributes != null && o.Attributes.Exists(a => a.Key == "AssigningAuthorityName") && o.Oid == id.Domain);
                if (oidData != null)
                {
                    assAuth = oidData.Attributes.Find(o => o.Key == "AssigningAuthorityName").Value;
                }
            }

            return(new II()
            {
                Root = id.Domain, Extension = String.IsNullOrEmpty(id.Identifier) ? null : id.Identifier, AssigningAuthorityName = assAuth
            });
        }
コード例 #19
0
 /// <summary>
 /// Tries to create a new proxy to an object of type <typeparamref name="TEndPoint"/>
 /// located in the <see cref="AppDomain"/> with the specified identifier.
 /// </summary>
 /// <typeparam name="TEndPoint">The type of the object to get access to.</typeparam>
 /// <param name="id">The identifier of the targetted application domain.</param>
 /// <param name="result">The newly created proxy.</param>
 /// <returns></returns>
 public bool TryConnect <TEndPoint>(DomainIdentifier id, out TEndPoint result)
     where TEndPoint : EndPointObject
 {
     if (!CanConnect(id))
     {
         result = null;
         return(false);
     }
     try
     {
         result = Connect <TEndPoint>(id);
         return(true);
     }
     catch
     {
         result = null;
         return(false);
     }
 }
コード例 #20
0
        public int AddItem(string ProductID, int?Quantity)
        {
            int addedStatus = 0;

            domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
            User User = domainIndentifier.GetUserRelatedDomain();

            UserID                   = User != null ? User.Id : 0;
            ViewBag.UserID           = UserID;
            Session["CurrentUserID"] = UserID;
            if (Session["cart"] == null)
            {
                var cart = new List <CartModel>();
                cart.Add(new CartModel()
                {
                    ProductID = long.Parse(ProductID),
                    Quantity  = Quantity
                });
                Session["cart"] = cart;
            }
            else
            {
                var  cart         = (List <CartModel>)Session["cart"];
                long?ProID        = long.Parse(ProductID);
                var  ProductIndex = cart.FindIndex(x => x.ProductID == ProID);
                if (ProductIndex == -1)
                {
                    cart.Add(new CartModel()
                    {
                        ProductID = long.Parse(ProductID),
                        Quantity  = Quantity
                    });
                }
                else
                {
                    cart[ProductIndex].Quantity = Quantity;
                    addedStatus = 1;
                }
                Session["cart"] = cart;
            }
            return(addedStatus);
        }
コード例 #21
0
        public ActionResult Signup(ShopUser user)
        {
            try
            {
                domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
                User User = domainIndentifier.GetUserRelatedDomain();
                UserID = User != null ? User.Id : 0;
                Menu UserData = db.Menus.FirstOrDefault(x => x.Name == "Index" && x.UserID == UserID);
                ViewBag.UserID           = UserID;
                Session["CurrentUserID"] = UserID;


                if (ModelState.IsValid)
                {
                    var isUserExist = db.ShopUsers.FirstOrDefault(x => x.Email == user.Email.ToLower() && x.UserID == UserID);
                    if (isUserExist != null)
                    {
                        TempData["Msg"] = "<p class='text-danger text-center'>Sorry! This Email is already register with us.</p>";
                    }
                    else
                    {
                        user.UserID          = UserID;
                        user.CreatedDateTime = DateTime.UtcNow;
                        user.Email           = user.Email.ToLower();
                        db.ShopUsers.Add(user);
                        db.SaveChanges();
                        TempData["Msg"] = "<p class='text-success text-center'>Account has been created succesfully! Please Login.</p>";
                        return(RedirectToAction("Login"));
                    }
                }
                else
                {
                    TempData["Msg"] = "<p class='text-danger text-center'>Please fill required fileds!</p>";
                }
            }
            catch
            {
                TempData["Msg"] = "<p class='text-danger text-center'>Sorry! There is an error. Please try again.</p>";
            }
            return(View());
        }
コード例 #22
0
        /// <summary>
        /// Returns a new proxy to an object of type <typeparamref name="TEndPoint"/>
        /// located in the <see cref="AppDomain"/> with the specified identifier.
        /// </summary>
        /// <exception cref="ArgumentException"></exception>
        /// <exception cref="RemotingException"></exception>
        /// <typeparam name="TEndPoint">The type of the object to get access to.</typeparam>
        /// <param name="id">The identifier of the targetted application domain.</param>
        /// <returns></returns>
        public TEndPoint Connect <TEndPoint>(DomainIdentifier id)
            where TEndPoint : EndPointObject
        {
            DomainConnectionEndPoint remoteDomainEndPoint;

            lock (_domainConnectionsSyncRoot)
            {
                if (!_domainConnections.ContainsKey(id))
                {
                    throw new ArgumentException("Unable to connect to remote domain with id " + id);
                }
                remoteDomainEndPoint = _domainConnections[id].GetRemoteEndPoint();
            }
            var objectUri = remoteDomainEndPoint.CreateChannel <TEndPoint>();
            var result    = Activator.GetObject(typeof(TEndPoint), objectUri) as TEndPoint;

            if (result == null)
            {
                throw new RemotingException();
            }
            result.Ping();
            return(result);
        }
コード例 #23
0
        public ActionResult Checkout()
        {
            try
            {
                // validate current sub domain
                domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
                User User = domainIndentifier.GetUserRelatedDomain();
                UserID                   = User != null ? User.Id : 0;
                ViewBag.UserID           = UserID;
                Session["CurrentUserID"] = UserID;
                // end of validation

                // check cart is empty or not
                var cart = (List <CartModel>)Session["cart"];
                if (cart == null)
                {
                    return(Redirect("/"));
                }

                //// check user is login or not
                if (string.IsNullOrEmpty(Convert.ToString(Session["WebloggedUserID"])))
                {
                    return(RedirectToAction("Login"));
                }

                var productDetail = new List <CartViewModel>();
                foreach (var item in cart)
                {
                    var Detail = db.Products.FirstOrDefault(x => x.Id == item.ProductID && x.UserID == UserID);
                    productDetail.Add(new CartViewModel()
                    {
                        Name        = Detail.Name,
                        Description = Detail.Description,
                        Discount    = Detail.Discount,
                        Quantity    = item.Quantity,
                        Fee         = 0,
                        TotalPrice  = item.Quantity * Detail.Price,
                        Image       = Detail.ProductImage,
                        Price       = Detail.Price,
                        ProductID   = Detail.Id
                    });
                }
                if (productDetail != null)
                {
                    if (productDetail.Count() != 0)
                    {
                        if (User.IsActive == false)
                        {
                            return(HttpNotFound("User Not Active"));
                        }
                        ViewBag.TotalAllProductPirce = productDetail.Sum(x => x.Price * x.Quantity).Value;
                    }
                    else
                    {
                        if (UserID != 0)
                        {
                            return(HttpNotFound("Page is not designed"));
                        }
                        return(HttpNotFound());
                    }
                }

                return(View(productDetail));
            }
            catch
            {
                var EmptyList = new List <CartViewModel>();
                return(View(EmptyList));
            }
        }
コード例 #24
0
        public ActionResult Checkout(string FullName, string PhoneNo, string ShippingAddress, int PaymentMethod)
        {
            // validate current sub domain
            domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
            User User = domainIndentifier.GetUserRelatedDomain();

            UserID                   = User != null ? User.Id : 0;
            ViewBag.UserID           = UserID;
            Session["CurrentUserID"] = UserID;
            // end of validation

            //// check user is login or not
            if (string.IsNullOrEmpty(Convert.ToString(Session["WebloggedUserID"])))
            {
                return(RedirectToAction("Login"));
            }

            long ShopUserID = Convert.ToInt64(Session["WebloggedUserID"]);

            using (var Trac = db.Database.BeginTransaction())
            {
                try
                {
                    var cart = (List <CartModel>)Session["cart"];
                    if (cart == null)
                    {
                        return(RedirectToAction("Cart"));
                    }

                    double?        TotalPrice    = 0;
                    List <Product> ProductDetail = new List <Product>();
                    foreach (var item in cart)
                    {
                        var CurrentProductDetail = db.Products.FirstOrDefault(x => x.Id == item.ProductID);
                        ProductDetail.Add(CurrentProductDetail);
                        TotalPrice += CurrentProductDetail.Price * item.Quantity;
                    }

                    PlacedOrder PlacedOrder = new PlacedOrder()
                    {
                        ReceivedPersonName   = FullName,
                        ReceivedPhoneNumber  = PhoneNo,
                        ShippingAddress      = ShippingAddress,
                        TotalPrice           = TotalPrice,
                        ShopUserID           = ShopUserID,
                        OrderStatus          = (int)OrderStatus.Pending,
                        OrderCreatedDateTime = DateTime.UtcNow,
                        PaymentMethod        = (int)ShopPaymentMethod.CashOnDelivery
                    };

                    db.PlacedOrders.Add(PlacedOrder);
                    int IsPlacedOrderSaved = db.SaveChanges();      // Insert Record

                    List <Order> OrderList = new List <Order>();
                    foreach (var item in cart)
                    {
                        var ProductInfo = ProductDetail.FirstOrDefault(x => x.Id == item.ProductID);
                        if (ProductInfo != null)
                        {
                            OrderList.Add(new Order()
                            {
                                TotalPrice     = ProductInfo.Price * item.Quantity,
                                Quantity       = item.Quantity,
                                Discount       = 0,
                                Price          = ProductInfo.Price,
                                Tax            = 0,
                                ProductID      = ProductInfo.Id,
                                PlacedOrdersId = PlacedOrder.Id,
                            });
                        }
                    }
                    db.Orders.AddRange(OrderList);
                    int IsOrderSaved = db.SaveChanges();        // Insert Record
                    if (IsOrderSaved > 0 && IsPlacedOrderSaved > 0)
                    {
                        Trac.Commit();
                        TempData["CheckOutMsg"] = "<p class='text-success text-center'>Order has been Placed Succesfully!</p><b /><div class='text-center'><a href='/UserPanel/Orders/Detail'>Orders List</a></div>";
                        Session["cart"]         = null;
                        return(View());
                    }
                    TempData["CheckOutMsg"] = "<p class='text-danger text-center'>There is an error. Please try agian if you face issue again. Please Contact to Support!</p>";
                }
                catch (Exception er)
                {
                    Trac.Rollback();
                    TempData["CheckOutMsg"] = "<p class='text-danger text-center'>There is an error. Please try agian if you face issue again. Please Contact to Support!</p>";
                }
            }
            return(View());
        }
コード例 #25
0
 public UnrecognizedSenderResultDetail(DomainIdentifier sender) :
     base(ResultDetailType.Error, String.Format("'{1}^^^&{0}&ISO' is not a known solicitor", sender.Domain, sender.Identifier), (Exception)null)
 {
 }
コード例 #26
0
 static DomainConnectionEndPoint()
 {
     _id = DomainIdentifier.GetLocalDomainIdentifier();
 }
コード例 #27
0
        public async Task <ActionResult> Edit(ShopUser shopUser, HttpPostedFileBase file)
        {
            using (var Tran = db.Database.BeginTransaction())
            {
                try
                {
                    // validate current sub domain
                    domainIndentifier = new DomainIdentifier(Request.Url.Host, Request.ServerVariables["SERVER_NAME"]);
                    var User = domainIndentifier.GetUserRelatedDomain();
                    UserID                   = User != null ? User.Id : 0;
                    ViewBag.UserID           = UserID;
                    Session["CurrentUserID"] = UserID;

                    //// check user is login or not
                    if (string.IsNullOrEmpty(Convert.ToString(Session["WebloggedUserID"])))
                    {
                        return(Redirect("/Account/Login"));
                    }

                    // bussiness logic
                    long ShopUserID = Convert.ToInt64(Session["WebloggedUserID"]);
                    ViewBag.ShopUserID = ShopUserID;

                    if (ModelState.IsValid)
                    {
                        ShopUser Customer = db.ShopUsers.FirstOrDefault(x => x.Id == ShopUserID);
                        if (!System.IO.Directory.Exists(Server.MapPath("~/Content/upload/" + UserID + "/Commerce")))
                        {
                            System.IO.Directory.CreateDirectory(Server.MapPath("~/Content/upload/" + UserID + "/ShopUsers"));
                        }

                        if (file != null)
                        {
                            if (file.ContentLength > 0)
                            {
                                string FileExtention = Path.GetExtension(file.FileName);
                                string FileName      = Guid.NewGuid().ToString() + DateTime.Now.ToString("yyyydd") + ShopUserID + FileExtention;
                                string FileSavePath  = System.IO.Path.Combine(Server.MapPath("~/Content/upload/" + UserID + "/ShopUsers"), FileName);
                                file.SaveAs(FileSavePath);
                                Customer.ProfileImagePath = "Content/upload/" + UserID + "/ShopUsers" + FileName;
                            }
                        }
                        int    IsSavedIntoStorageTable = 0;
                        string PreProfilePath          = Customer.ProfileImagePath;
                        Customer.CurrentAddress   = shopUser.CurrentAddress;
                        Customer.DisplayName      = shopUser.DisplayName;
                        Customer.Email            = shopUser.Email;
                        Customer.FirstName        = shopUser.FirstName;
                        Customer.LastName         = shopUser.LastName;
                        Customer.Mobile           = shopUser.Mobile;
                        Customer.Password         = shopUser.Password;
                        Customer.PermanentAddress = shopUser.PermanentAddress;
                        Customer.Phone            = shopUser.Phone;
                        Customer.SecPhone         = shopUser.SecPhone;
                        int isSavedIntoShopUser = await db.SaveChangesAsync();      // Insert Data

                        if (!string.IsNullOrEmpty(PreProfilePath))
                        {
                            string fileToDelete = Server.MapPath("~/" + PreProfilePath);
                            if (!string.IsNullOrEmpty(fileToDelete))
                            {
                                if (System.IO.File.Exists(fileToDelete))
                                {
                                    long      length     = new System.IO.FileInfo(fileToDelete).Length;
                                    UserUsage PriHistory = db.UserUsages.FirstOrDefault(x => x.UserID == UserID);
                                    PriHistory.UsedStorage  = PriHistory.UsedStorage - Mathmatics.ConvertBytesToMegabytes(length);
                                    IsSavedIntoStorageTable = db.SaveChanges();                           // Insert Data
                                    System.IO.File.Delete(fileToDelete);
                                }
                            }
                        }
                        if (isSavedIntoShopUser > 0 && IsSavedIntoStorageTable > 0)
                        {
                            Tran.Commit();
                            return(RedirectToAction("Detail"));
                        }
                        return(View(shopUser));
                    }
                }
                catch (Exception er)
                {
                    Tran.Rollback();
                }
                return(View(shopUser));
            }
        }
コード例 #28
0
        /// <summary>
        /// Get location data from the database
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="tx"></param>
        /// <param name="domainIdentifier"></param>
        /// <returns></returns>
        private Place GetLocation(System.Data.IDbConnection conn, System.Data.IDbTransaction tx, DomainIdentifier domainIdentifier)
        {
            // Get configuration service
            ISystemConfigurationService config = ApplicationContext.ConfigurationService; //ApplicationContext.Current.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService;

            // Create database command
            IDbCommand cmd = DbUtil.CreateCommandStoredProc(conn, tx);

            try
            {
                // Fetch the client data using shrid
                if (String.IsNullOrEmpty(domainIdentifier.Domain) || domainIdentifier.Domain.Equals(config.OidRegistrar.GetOid(ClientRegistryOids.LOCATION_CRID).Oid))
                {
                    cmd.CommandText = "get_plc";
                    cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "plc_id_in", DbType.Decimal, Convert.ToDecimal(domainIdentifier.Identifier)));
                }
                else // get using alt id
                {
                    cmd.CommandText = "get_plc_extern";
                    cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "plc_id_domain_in", DbType.StringFixedLength, domainIdentifier.Domain));
                    cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "plc_id_in", DbType.StringFixedLength, (object)domainIdentifier.Identifier ?? DBNull.Value));
                }

                // Execute the reader
                IDataReader reader = cmd.ExecuteReader();

                // read data
                if (!reader.Read())
                {
                    return(null);
                }

                // Parse data
                Place   retVal = new Place();
                decimal?codeTypeId = null, addrSetId = null;
                try
                {
                    retVal.Id = Convert.ToDecimal(reader["plc_id"]);

                    // Define set identifiers
                    retVal.Name  = reader["plc_name"] == DBNull.Value ? null : Convert.ToString(reader["plc_name"]);
                    retVal.Class = reader["plc_cls_cs"] == DBNull.Value ? null : Convert.ToString(reader["plc_cls_cs"]);
                    addrSetId    = reader["plc_addr_set_id"] == DBNull.Value ? null : (decimal?)Convert.ToDecimal(reader["plc_addr_set_id"]);
                    codeTypeId   = reader["plc_typ_cd_id"] == DBNull.Value ? null : (decimal?)Convert.ToDecimal(reader["plc_typ_cd_id"]);
                }
                finally
                {
                    // Close the reader
                    reader.Close();
                }

                // Get addr set
                if (addrSetId.HasValue)
                {
                    retVal.Address = DbUtil.GetAddress(conn, tx, addrSetId, false);
                }
                // Get type code
                if (codeTypeId.HasValue)
                {
                    retVal.LocationType = DbUtil.GetCodedValue(conn, tx, codeTypeId);
                }

                // Read alternate identifiers
                retVal.AlternateIdentifiers.AddRange(GetAlternateIdentifiers(conn, tx, retVal.Id));

                // Return type

                return(retVal);
            }
            finally
            {
                cmd.Dispose();
            }
        }
コード例 #29
0
        /// <summary>
        /// Create an alternate identifier for the SDL
        /// </summary>
        private void CreateAlternateIdentifier(IDbConnection conn, IDbTransaction tx, decimal identifier, DomainIdentifier altId)
        {
            IDbCommand cmd = DbUtil.CreateCommandStoredProc(conn, tx);

            try
            {
                cmd.CommandText = "crt_plc_alt_id";

                // parameters
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "plc_id_in", DbType.Decimal, identifier));
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "alt_id_domain_in", DbType.StringFixedLength, altId.Domain));
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "alt_id_in", DbType.StringFixedLength, (object)altId.Identifier ?? DBNull.Value));

                // Execute
                cmd.ExecuteNonQuery();
            }
            finally
            {
                cmd.Dispose();
            }
        }
コード例 #30
0
 /// <summary>
 /// Returns whether a connection can be made to the specified remote domain.
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool CanConnect(DomainIdentifier id)
 {
     lock (_domainConnectionsSyncRoot)
         return(_domainConnections.ContainsKey(id));
 }