Ejemplo n.º 1
0
		private bool ShouldSend(Notification notification)
		{
			if (notification is FileChange &&
			    matchingFolders.Any(
				    f => ((FileChange) notification).File.StartsWith(f, StringComparison.InvariantCultureIgnoreCase)))
			{
				return true;
			}

			if (notification is ConfigChange && watchConfig > 0)
			{
				return true;
			}

			if (notification is ConflictNotification && watchConflicts > 0)
			{
				return true;
			}

			if (notification is SynchronizationUpdate && watchSync > 0)
			{
				return true;
			}

			if (notification is UploadFailed && watchCancellations > 0)
			{
				return true;
			}

			return false;
		}
Ejemplo n.º 2
0
        public void SetUp()
        {
            LocalizationManager.Stub();

            theNotification = new Notification(typeof(SampleInputModel));
            theNotification.RegisterMessage<SampleInputModel>(m => m.Field, StringToken.FromKeyString("Field", "Message"));
        }
Ejemplo n.º 3
0
        public void Connect()
        {
            //string exchangeName = "Appharborbot", queueName = "Appharborqueue", routingKey = "";
            //ConnectionFactory factory = new ConnectionFactory();
            //factory.Uri = @"amqp://13b7233d-b4f8-4986-9cd2-4254b38d1869_apphb.com:[email protected]/13b7233d-b4f8-4986-9cd2-4254b38d1869_apphb.com";
            //IConnection conn = factory.CreateConnection();
            ////IModel model = conn.CreateModel();

            //model.ExchangeDeclare(exchangeName, ExchangeType.Direct, true);
            //model.QueueDeclare(queueName, true, false,false, new Dictionary<string, object>());
            //model.QueueBind(queueName, exchangeName, routingKey);

            //byte[] messageBodyBytes = System.Text.Encoding.UTF8.GetBytes("Hello, world!");
            //model.BasicPublish(exchangeName, routingKey, null, messageBodyBytes);

            var bus = RabbitHutch.CreateBus("lemur.cloudamqp.com", "5672", "13b7233d-b4f8-4986-9cd2-4254b38d1869_apphb.com", "13b7233d-b4f8-4986-9cd2-4254b38d1869_apphb.com", "vDoN650Qz_Lz3wSLrdBOYkkm-EPsFfCx", new MyLogger());

            Notification n = new Notification();
            n.application = new Application();
            n.build = new Build();
            n.application.name = "test";

            bus.Connected += () => { System.Diagnostics.Trace.TraceInformation("connected"); };
            bus.Disconnected += () => { System.Diagnostics.Trace.TraceInformation("disconnected"); };

            using (var publishChannel = bus.OpenPublishChannel())
            {
                publishChannel.Publish<Notification>(n);
            }
        }
    void checkIfOnBalloon()
    {
        float playerSize = this.renderer.bounds.size.y;
        Vector3 position1 = transform.position;
        Vector3 position2 = transform.position;
        position1.x = position1.x - playerSize;
        position1.y = position1.y;
        position2.x = position2.x + playerSize;
        position2.y = position2.y - 2 * playerSize;

        Collider2D[] hits = Physics2D.OverlapAreaAll(new Vector2(position1.x, position1.y), new Vector2(position2.x, position2.y));
        Notification collision = new Notification(NotificationType.OnBalloonPlayerCollision, "Balloon Collided!");

        int i = 0;
        bool temp = false;
        while (i < hits.Length)  {
            Collider2D hit = hits[i];
            if (hit != null) {
                if (hit.tag == "platform") {
                    NotificationCenter.defaultCenter.postNotification(collision);
                    temp = true;
                }
            }
            i++;
        }
        this.GetComponent<Jump>().setGrounded(check);
    }
Ejemplo n.º 5
0
    void GameOver(Notification noti)
    {
        List<int> pointsList = stateGame.userLoged.getPoints ();

        if (pointsList.Count < 11 && pointsList.Count > 0) {

            if(pointsList.Count < 10 && !pointsList.Contains(points)) {
                stateGame.userLoged.addPoints (points);
            }else {
                if(!pointsList.Contains(points)) {
                    if (pointsList [0] < points) {
                        stateGame.userLoged.getPoints ()[0] = points;
                    }
                }
            }
            stateGame.userLoged.getPoints ().Sort ();

        } else {
            if(pointsList.Count == 0) {
                stateGame.userLoged.addPoints (points);
                stateGame.userLoged.getPoints ().Sort ();
            }
        }
        stateGame.Save (stateGame.userLoged);

        /*if (points > StateGame.stateGame.highScore) {
            StateGame.stateGame.highScore = points;
            StateGame.stateGame.usuario = user;
            StateGame.stateGame.Save();
        }*/
    }
	void TCD4Tutorial(Notification notification)
	{
		int index_receiver = (int)notification.data;

		if (index_receiver == 1) {
		
			manejador.info_macrofago.text="El Linficito TCD4 ayuda al Neutrófilo, liberando citoquinas o moléculas mensajeras del sistema inmune.";
			manejador.text_guia.text="Presiona click derecho sobre el Linfocito TCD4 para activar la habilidad de ayudar al Neutrófilo.";

			neutrofilo.SetActive(true);
			if(virus_neutrofilo!=null)
				virus_neutrofilo.SetActive(true);
		}

		if (index_receiver == 2) {
			
			manejador.info_macrofago.text="El linfoncito TCD4 ayuda al Linfocito B convirtiéndolo en una célula plasmática,la cual es una célula profesional que solo produce anticuerpos. ";
			manejador.text_guia.text="Presiona click derecho sobre el Linfocito TCD4 para activar la habilidad de ayudar al Linfocito B.";
			linfocitoB.SetActive(true);
			
		}

		if (index_receiver == 3) {
			
			manejador.panelInfo.SetActive(false);
			manejador.text_guia.text=PlayerPrefs.GetString("name")+" Defiendete de los patogenos.";
			manejador.text_guia.transform.parent.gameObject.GetComponent<RectTransform>().anchoredPosition=new Vector2(
				manejador.text_guia.transform.parent.gameObject.GetComponent<RectTransform>().anchoredPosition.x,
				manejador.text_guia.transform.parent.gameObject.GetComponent<RectTransform>().anchoredPosition.y+80);
			GameObject.Find("ManejadorVirus").GetComponent<ManejadorVirus>().enabled=true;
			
		}

	}
        public override void Handle(Connection connection)
        {
            var account = connection.Session.Account;
            var notification = new Notification();

            notification.UserId = account.Id;
            notification.Regex = new Regex(RegexPattern);
            notification.DeviceToken = DeviceToken;

            if (Program.NotificationManager.Exists(DeviceToken))
            {
                notification.Save();
            }
            else
            {
                if (Program.NotificationManager.FindWithId(account.Id).Count() < 5)
                {
                    notification.Insert();
                }
                else
                {
                    connection.SendSysMessage("You may only have 5 devices registered for push notifications.");
                    return;
                }
            }

            Program.NotificationsDirty = true;

            var notificationSubscription = new NotificationSubscription();
            notificationSubscription.DeviceToken = DeviceToken;
            notificationSubscription.RegexPattern = RegexPattern;
            notificationSubscription.Registered = true;

            connection.Send(notificationSubscription);
        }
Ejemplo n.º 8
0
 public void Notification_AddNotificationMessage_EnumerateAndFind()
 {
     var notification = new Notification { { "field", "was invalid" } };
     var notificationMessage = notification.Single();
     Assert.AreEqual("was invalid", notificationMessage.ErrorMessage);
     Assert.AreEqual("field", notificationMessage.PropertyName);
 }
 private void DisplayData(Notification notification)
 {
     EnableAppBarStatus(true);
     // Navigate to the appropriate destination page, configuring the new page
     // by passing required information as a navigation parameter
     frmNotification.Navigate(typeof(NotificationDetailFrame), notification);
 }
Ejemplo n.º 10
0
    public void PostNotification(Notification aNotification)
    {
        // First make sure that the name of the notification is valid.
        //Debug.Log("sender: " + aNotification.name);
        if (string.IsNullOrEmpty (aNotification.name)) {
            Debug.Log ("Null name sent to PostNotification.");
            return;
        }
        // Obtain the notification list, and make sure that it is valid as well
        List<Component> notifyList = (List<Component>) notifications [aNotification.name];
        if (notifyList == null) {
            Debug.Log ("Notify list not found in PostNotification: " + aNotification.name);
            return;
        }

        // Create an array to keep track of invalid observers that we need to remove
        List<Component> observersToRemove = new List<Component> ();

        // Itterate through all the objects that have signed up to be notified by this type of notification.
        foreach (Component observer in notifyList) {
            // If the observer isn't valid, then keep track of it so we can remove it later.
            // We can't remove it right now, or it will mess the for loop up.
            if (!observer) { observersToRemove.Add(observer); }
            else {
                // If the observer is valid, then send it the notification. The message that's sent is the name of the notification.
                observer.SendMessage(aNotification.name, aNotification, SendMessageOptions.DontRequireReceiver);
            }
        }

        // Remove all the invalid observers
        foreach (Component observer in observersToRemove) {
            notifyList.Remove(observer);
        }
    }
 public void valid_should_return_valid_notification()
 {
     var notification = new Notification();
     notification
         .IsValid()
         .ShouldBeTrue();
 }
Ejemplo n.º 12
0
        // Constructor
        public MainPage()
        {
            
            InitializeComponent();
            ser = new NotificationClass();
            obj = new Notification(ser);

            //NotificationSwitch is set by user to start or stop push notifications.
            if (IsolatedStorageSettings.ApplicationSettings.Contains("notificationSwitch"))
            {
                //If notificationSwitch is ON(True) then only start notification service.
                if ((bool)IsolatedStorageSettings.ApplicationSettings["notificationSwitch"])
                {
                    //Start in-app Notification listening every time application starts.
                    obj.SetupNotification();
                }
            }
            else
            {
                //By Default Notifications are disabled.
                IsolatedStorageSettings.ApplicationSettings["notificationSwitch"] = false;
            }

            
        }
        public bool Deliver(Notification notification)
        {
            bool success = false;
            try
            {
                notification.Retry = false;
                notification.Status = "Processing";

                var configuration = FtpClientConfiguration.GetFtpConfigurationFromSettings(notification.UserData);

                FtpClient ftpClient = FtpClient.GetClientFromSettings(configuration);
                RenderedOutputFile outputFile = notification.Report.Render(configuration.FileFormat, String.Empty)[0];
                outputFile.Data.Position = 0;
                using (var stream = outputFile.Data)
                {
                    byte[] bytes = new byte[stream.Length];
                    stream.Read(bytes, 0, bytes.Length);
                    stream.Close();
                    ftpClient.UploadFile(bytes);
                }
                notification.Status = "Success";
                success = true;
            }
            catch (Exception ex)
            {
                notification.Status = String.Format("Error: {0}", ex.Message);
                success = false;
            }
            finally
            {
                notification.Save();
            }

            return success;
        }
Ejemplo n.º 14
0
 public Notification Validate(object target)
 {
     var validatedType = typeResolver.ResolveType(target);
     var notification = new Notification(validatedType);
     Validate(target, notification);
     return notification;
 }
Ejemplo n.º 15
0
        public void GetChildReturnsValidIfNoChild()
        {
            var notification = new Notification();
            var child = notification.GetChild("anything");

            child.IsValid().ShouldBeTrue();
        }
        public void createURLNotification(string url, 
Business.AppointmentVO appVO)
        {
            string subject = "";
            if(appVO._Id != null)
                subject = appVO._Subject;
            notificationURL = url;
            _notification = new Notification();
            _notification.Caption = "News: ";
            _notification.Critical = false;
            //
            StringBuilder HTMLString = new StringBuilder();
            HTMLString.Append("<html><body>");
            HTMLString.Append("<font color=\"#0000FF\">Information); availiable for:</font><br>");
            HTMLString.Append("<font color=\"#0000FF\"><b>Appointment: " + subject + "</b></font><br/>");
            HTMLString.Append("<form method=\"GET\" action=notify>");
            HTMLString.Append("<br/><input type=button name='show' value='Show info'>");
            HTMLString.Append("<input type=button name='cancel' value='Cancel'/>");
            HTMLString.Append("</body></html>");
            _notification.Text = HTMLString.ToString();
            //
            _notification.BalloonChanged += new
            BalloonChangedEventHandler(_notification_BalloonChanged);
            _notification.ResponseSubmitted += new
            ResponseSubmittedEventHandler(_notification_ResponseSubmitted);
            _notification.InitialDuration = 20;
            _notification.Visible = true;
        }
Ejemplo n.º 17
0
        public static SmiResultCode PlayNotes(int handle,
            uint noteCount,
            HapticsNote[] notes,
            bool repeat,
            Notification callback)
        {
            CallbackItem item= new CallbackItem();
            c_Notification cN = new c_Notification(Haptics.NotificationCallbakHandler);

            item.callback   = callback;
            item.handle     = handle;
            item.notesArray = notes;
            item.c_callback = cN; // reserve callback until callback is done

            lock (_locker)
            {
                // protect the _list inside of critical section
                _list.Add(item);
            }

            SmiResultCode result = c_PlayNotes(handle,
                               noteCount,
                               notes,
                               repeat,
                               cN);

            //System.Console.WriteLine("@PlayNotes handle     = " + handle);
            //System.Console.WriteLine("@PlayNotes noteCount  = " + noteCount);
            //System.Console.WriteLine("@PlayNotes repeat     = " + repeat);
            //System.Console.WriteLine("@PlayNotes result  = " + result);

            return result;
        }
Ejemplo n.º 18
0
 private void aumentarVidaProta(Notification notification)
 {
     if (vidaActual < 3){
         vidaActual++;
         mostrarVida();
     }
 }
Ejemplo n.º 19
0
        protected override void DoWork()
        {
            //Get task info
            var response = Communication.GetResponse("/service/jobs.php", true);

            //Shutdown if a task is avaible and the user is logged out or it is forced
            if (response.Error) return;

            Log.Entry(Name, "Restarting computer for task");

            if (!UserHandler.IsUserLoggedIn() || response.GetField("#force").Equals("1"))
                Power.Restart(Name);

            else if (!response.Error && !_notifiedUser)
            {
                Log.Entry(Name, "User is currently logged in, will try again later");

                var notification = new Notification("Please log off",
                    string.Format(
                        "{0} is attemping to service your computer, please log off at the soonest available time",
                        RegistryHandler.GetSystemSetting("Company")), 60);

                Bus.Emit(Bus.Channel.Notification, notification.GetJson(), true);
                _notifiedUser = true;
            }
        }
Ejemplo n.º 20
0
 public void Notify(Story story)
 {
     var frontpageItem = story.Item;
     var notification = new Notification(ApplicationName, NotificationTypeName, "ID", frontpageItem.Title, frontpageItem.Link);
     var callback = new CallbackContext(frontpageItem.Link);
     _growl.Notify(notification, callback);
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Returns the child window to display as part of the trigger action.
        /// </summary>
        /// <param name="notification">The notification to display in the child window.</param>
        /// <returns></returns>
        protected override ChildWindow GetChildWindow(Notification notification)
        {
            var childWindow = this.ChildWindow ?? this.CreateDefaultWindow(notification);
            childWindow.DataContext = notification;

            return childWindow;
        }
Ejemplo n.º 22
0
        public bool IsValid(Notification notification)
        {
            var isRemoteOpValid = _sequence.OfType<IOperateRemote>().All(x => x.IsValid(notification));
            var isCompositeSeqValid = _sequence.OfType<CompositeSequence>().All(x => x.IsValid(notification));

            return isRemoteOpValid && isCompositeSeqValid;
        }
 public void ReceiveNotification(Notification notification)
 {
     foreach (var n in notification.GetAllNotifications())
     {
         WebsiteMain.notifications.Add(n);
     }
 }
Ejemplo n.º 24
0
 private void acabarTorre(Notification notification)
 {
     u.moverApunto(transform, "nodoTorreBase", velTorre, new Vector2(separacionRunner.x, separacionRunner.y - 500), "salimosDeTorre");
     cambiarZoom(zoomNormal, velZoomNormal, "");
     cambiarEscalaLimitadores("_limitadoresBalas", new Vector3(1f, 1f, 1f));
     NotificationCenter.DefaultCenter().PostNotification(this, "empezarParallax");
 }
Ejemplo n.º 25
0
        /// <summary>
        /// GM取得拍卖行数据
        /// </summary>
        /// <param name="note"></param>
        public static object GMAuctionList(Notification note)
        {
            string[] strs = GMBusiness.GetCommand(note);
            if (strs.Length < 3)
                return null;
            PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
            if (player == null)
                return null;
            int pageIndex = 0;

            if (!int.TryParse(strs[1].Trim(), out pageIndex))
                return null;
            int pageSize = 6;

            int total = 0;
            int curIndex = 0;
            List<Auction> auctionList = AuctionAccess.Instance.AuctionSellerList(player.ID, pageSize, pageIndex, out total, out curIndex);
            List<Variant> list = new List<Variant>();
            foreach (Auction model in auctionList)
            {
                Variant mv = model.Value;
                Variant v = new Variant();
                foreach (var item in mv)
                {
                    v.Add(item.Key, item.Value);
                }
                v.Add("ID", model.ID);
                v.Add("Name", model.Name);
                list.Add(v);
            }
            return new object[] { list, total, curIndex };
        }
Ejemplo n.º 26
0
 public void Should_return_true_if_Messages_contains_only_messages_with_Info_Severity()
 {
     var notification = new Notification();
     var messageTest = new NotificationMessage(NotificationSeverity.Info, "");
     notification.Add(messageTest);
     Assert.IsTrue(notification.IsValid);
 }
Ejemplo n.º 27
0
 public RegisterNewCompanyCommand(ICompanyFactory factory, Notification notification,
                                  ICompanyRepository companies)
 {
     this.factory = factory;
     this.notification = notification;
     this.companies = companies;
 }
Ejemplo n.º 28
0
        public void Validate(object target, Notification notification)
        {
            var validatedType = _typeResolver.ResolveType(target);
            var context = ContextFor(target, notification);

            _graph.PlanFor(validatedType).Execute(context);
        }
Ejemplo n.º 29
0
    void OnCognitivLiftEvent(Notification notification)
    {
        if (canLift)
        {
            liftCounter++;

            timeUntilCanLiftNext = Time.time + timeBetweenLifts;
            canLift = false;

            if (liftCounter == 1)
            {
                StartCoroutine(explainMana());
            }
            else if (liftCounter == numberOfTimesToLift)
            {
                EventFactory.FireDisplayTextEvent(this, "Good job! You have learned LIFT!", 5.0f);

                NotificationCenter.DefaultCenter.PostNotification(this, "LiftCompleted");
            }
        }
        else
        {
            EventFactory.FireDisplayTextEvent(this, "Why don't you try lifting in " + (int) (timeUntilCanLiftNext - Time.time) + " seconds?", timeUntilCanLiftNext - Time.time);
        }
    }
Ejemplo n.º 30
0
 public void acabarShooter(Notification notification)
 {
     rigidbody2D.isKinematic = false;
     gen.estado = 1;
     gen.animator.SetInteger("Estado", gen.estado);
     run.saltar(1500, run.fuerzaSalto * 7);
 }
Ejemplo n.º 31
0
 public static string doPushMessage(string title, Dictionary <string, object> extras, string[] cids = null, string sendtype = "android", string msg_content = "", int PushAPP = 1, bool IsToAll = false)
 {
     try
     {
         if (cids == null && !IsToAll)
         {
             return("没有接收用户");
         }
         PushPayload pushPayload = new PushPayload();
         //pushPayload.notification = new Notification();
         if (IsToAll)
         {
             pushPayload.audience = Audience.all();
         }
         else
         {
             pushPayload.audience = Audience.s_registrationId(cids);
         }
         pushPayload.message = Message.content(msg_content);
         //pushPayload.message.setTitle(title);
         pushPayload.message.setContentType("text");
         foreach (var item in extras)
         {
             pushPayload.message.AddExtras(item.Key, item.Value.ToString());
         }
         pushPayload.message.AddExtras("sound", "widget://res/newmessage.mp3");
         var notification = new Notification();
         notification.setAlert(msg_content);
         if (sendtype.Equals("android"))
         {
             pushPayload.platform             = Platform.android();
             notification.AndroidNotification = new AndroidNotification();
             //notification.AndroidNotification.setAlert(msg_content);
             foreach (var item in extras)
             {
                 notification.AndroidNotification.AddExtra(item.Key, item.Value.ToString());
             }
             notification.AndroidNotification.AddExtra("sound", "widget://res/newmessage.mp3");
             //pushPayload.notification = notification;
         }
         else if (sendtype.Equals("ios"))
         {
             pushPayload.platform         = Platform.ios();
             notification.IosNotification = new IosNotification();
             notification.IosNotification.setBadge(1);
             notification.IosNotification.setSound("widget://res/newmessage.mp3");
             notification.IosNotification.setAlert(msg_content);
             foreach (var item in extras)
             {
                 notification.IosNotification.AddExtra(item.Key, item.Value.ToString());
             }
             pushPayload.notification = notification;
         }
         pushPayload.options.apns_production = true;
         pushPayload.options.time_to_live    = 3600;
         var    config = new Utility.SiteConfig();
         string key    = string.Empty;
         string secret = string.Empty;
         if (PushAPP == 1)
         {
             key    = config.JPushKey_User;
             secret = config.JPushMasterSecret_User;
         }
         else if (PushAPP == 2)
         {
             key    = config.JPushKey_Customer;
             secret = config.JPushMasterSecret_Customer;
         }
         else if (PushAPP == 3)
         {
             key    = config.JPushKey_Business;
             secret = config.JPushMasterSecret_Business;
         }
         var client   = new JPushClient(key, secret);
         var response = client.SendPush(pushPayload);
         return("code:" + response.ResponseResult.responseCode + " content:" + response.ResponseResult.responseContent);
     }
     catch (Exception ex)
     {
         Utility.LogHelper.WriteError("Jpush.JpushAPI", "PushMessage", ex);
         return(ex.Message);
     }
 }
        public bool ValidateNotification(Notification notification)
        {
            var retVal = ValidateNotificationRecipient(notification.Recipient);

            return(retVal);
        }
 public SendNotificationResult SendNotification(Notification notification)
 {
     return(Task.Run(() => SendNotificationAsync(notification)).Result);
 }
Ejemplo n.º 34
0
        protected void cfmApproveBtn_Click(object sender, EventArgs e)
        {
            TNFDAO          tnfDAO          = new TNFDAO();
            UserDAO         userDAO         = new UserDAO();
            BondDAO         bondDAO         = new BondDAO();
            NotificationDAO notificationDAO = new NotificationDAO();

            int notificationID = Convert.ToInt32(Request.QueryString["n"]);

            Notification currentNotification = notificationDAO.getNotificationByID(notificationID);
            TNF          currentTNF          = tnfDAO.getIndividualTNFByID(currentNotification.getUserIDFrom(), currentNotification.getTNFID());
            User         applicant           = userDAO.getUserByID(currentNotification.getUserIDFrom());
            User         approver            = userDAO.getUserByID(currentNotification.getUserIDTo());
            Bonds        checkBond           = bondDAO.getBondByTNFIDandUserID(currentTNF.getTNFID(), applicant.getUserID());
            User         currentUser         = (User)Session["currentUser"];

            if (currentUser.getJobCategory().Equals("hr"))
            {
                //to save HR form
                string   probationText          = "n";
                string   isFunding              = "n";
                string   isMSP                  = "n";
                string   duration               = "";
                string   sourceOfFunding        = txtSourceOfFunding.Text;
                DateTime?fundingApplicationDate = null;
                Workflow currentWorkflow        = currentTNF.getWorkflow();
                int      probationPeriod        = currentWorkflow.getProbationPeriod();
                TimeSpan ts = currentTNF.getApplicationDate().Subtract(applicant.getStartDate());

                if (ts.TotalDays < probationPeriod)
                {
                    probationText = "y";
                }
                if (rbnlFunding.SelectedValue.Equals("y"))
                {
                    isFunding = "y";
                }
                if (!txtFundingDate.Text.Equals(""))
                {
                    fundingApplicationDate = DateTime.ParseExact(txtFundingDate.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                }
                if (rbtnMSP.Checked)
                {
                    isMSP    = "y";
                    duration = mspBondDuration.Text;
                    tnfDAO.updateTNFDataHRFields(currentTNF.getTNFID(), probationText, Convert.ToDouble(trainingCost.Text), isFunding, sourceOfFunding, fundingApplicationDate, isMSP, duration);
                }
                else
                {
                    tnfDAO.updateTNFDataHRFields(currentTNF.getTNFID(), probationText, Convert.ToDouble(trainingCost.Text), isFunding, sourceOfFunding, fundingApplicationDate, "n", null);
                }

                if (checkBond != null)
                {
                    //update Bond end date to correspond to number of months entered
                    DateTime endDate = checkBond.getStartDate();
                    endDate = endDate.AddMonths(Convert.ToInt32(mspBondDuration.Text));
                    bondDAO.updateBondEndDate(checkBond.getBondID(), endDate);
                }
            }
            Workflow_Approve.makeApproval(currentTNF, approver, currentNotification, remarksInput.Text);
            Response.Redirect("approvalConfirmation.aspx");
        }
Ejemplo n.º 35
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["currentUser"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                if (!IsPostBack)
                {
                    User currentUser = (User)Session["currentUser"];

                    TNFDAO          tnfDAO          = new TNFDAO();
                    UserDAO         userDAO         = new UserDAO();
                    NotificationDAO notificationDAO = new NotificationDAO();

                    int notificationID = Convert.ToInt32(Request.QueryString["n"]);

                    Notification currentNotification = notificationDAO.getNotificationByID(notificationID);

                    if (currentNotification == null || !currentNotification.getUserIDTo().Equals(currentUser.getUserID()))
                    {
                        Response.Redirect("errorPage.aspx");
                    }

                    TNF  currentTNF = tnfDAO.getIndividualTNFByID(currentNotification.getUserIDFrom(), currentNotification.getTNFID());
                    User applicant  = userDAO.getUserByID(currentNotification.getUserIDFrom());

                    Course   courseApplied   = tnfDAO.getCourseFromTNF(currentNotification.getTNFID());
                    Lesson   lessonApplied   = tnfDAO.getLessonFromTNF(currentNotification.getTNFID());
                    TNFData  tnfData         = tnfDAO.getIndividualTNFDataByID(currentNotification.getTNFID());
                    Workflow currentWorkflow = currentTNF.getWorkflow();
                    int      probationPeriod = currentWorkflow.getProbationPeriod();
                    TimeSpan ts = currentTNF.getApplicationDate().Subtract(applicant.getStartDate());

                    //show warning if overseas, probation, > 10000
                    if (courseApplied.getPrice() > 10000)
                    {
                        warningPanelPrice.Visible = true;
                        lblWarningPrice.Visible   = true;
                        lblWarningPrice.Text      = "This course is over $10,000";
                    }
                    if (courseApplied.getOverseas().ToLower().Equals("y"))
                    {
                        warningPanelOverseas.Visible = true;
                        lblWarningOverseas.Visible   = true;
                        lblWarningOverseas.Text      = "This course is an overseas course";
                    }
                    if (ts.TotalDays < probationPeriod)
                    {
                        warningPanelProbation.Visible = true;
                        lblWarningProbation.Visible   = true;
                        probationDate.Enabled         = true;
                        lblWarningProbation.Text      = "Applicant is under probation";
                    }

                    //setting user information
                    nameOfStaffOutput.Text    = applicant.getName();
                    employeeNumberOutput.Text = applicant.getUserID();
                    emailOutput.Text          = applicant.getEmail();
                    designationOutput.Text    = applicant.getJobTitle();
                    departmentOutput.Text     = applicant.getDepartment();

                    //setting course and lesson information
                    courseOutput.Text     = courseApplied.getCourseName();
                    startDate.Text        = lessonApplied.getStartDate().ToString("d MMM yyyy");
                    endDate.Text          = lessonApplied.getEndDate().ToString("d MMM yyyy");
                    startTime.Text        = lessonApplied.getStartTime().ToString();
                    endTime.Text          = lessonApplied.getEndTime().ToString();
                    venueOutput.Text      = lessonApplied.getVenue();
                    instructorOutput.Text = lessonApplied.getInstructor();

                    string internalOrExternal = courseApplied.getInternalOrExternal();
                    if (internalOrExternal.ToLower().Equals("internal"))
                    {
                        inhouse.Checked     = true;
                        external.Checked    = false;
                        lblExternal.Visible = false;
                        externalCourseProviderOutput.Visible = false;
                    }
                    else
                    {
                        inhouse.Checked     = false;
                        external.Checked    = true;
                        lblExternal.Visible = true;
                        externalCourseProviderOutput.Visible = true;
                        externalCourseProviderOutput.Text    = courseApplied.getCourseProvider();
                    }
                    courseFeeOutput.Text = "$" + courseApplied.getPrice();

                    //setting tnf data information
                    string prepareForNewJobRole = tnfData.getPrepareForNewJobRole();
                    if (prepareForNewJobRole.Equals("y"))
                    {
                        objectiveInput1.Checked  = true;
                        objectiveElaborate1.Text = tnfData.getPrepareForNewJobRoleText();
                        completeDateOutput1.Text = tnfData.getPrepareForNewJobRoleCompletionDate().Value.ToString("MM-dd-yyyy");
                    }
                    else
                    {
                        objectiveInput1.Checked  = false;
                        objectiveElaborate1.Text = "-";
                        completeDateOutput1.Text = "-";
                    }

                    string shareKnowledge = tnfData.getShareKnowledge();
                    if (shareKnowledge.Equals("y"))
                    {
                        objectiveInput2.Checked  = true;
                        objectiveElaborate2.Text = tnfData.getShareKnowledgeText();
                        completeDateOutput2.Text = tnfData.getShareKnowledgeCompletionDate().Value.ToString("MM-dd-yyyy");
                    }
                    else
                    {
                        objectiveInput2.Checked  = false;
                        objectiveElaborate2.Text = "-";
                        completeDateOutput2.Text = "-";
                    }

                    string otherObjectives = tnfData.getOtherObjectives();
                    if (otherObjectives.Equals("y"))
                    {
                        objectiveInput3.Checked    = true;
                        objectiveElaborate3.Text   = tnfData.getOtherObjectivesText();
                        completionDateOutput3.Text = tnfData.getOtherObjectivesCompletionDate().Value.ToString("MM-dd-yyyy");
                    }
                    else
                    {
                        objectiveInput3.Checked    = false;
                        objectiveElaborate3.Text   = "-";
                        completionDateOutput3.Text = "-";
                    }

                    //all HR will view HR approval section
                    if (currentUser.getJobCategory().Equals("hr"))
                    {
                        hrApprovalView.Visible = true;
                        BondDAO    bondDAO     = new BondDAO();
                        DeptDAO    deptDAO     = new DeptDAO();
                        Bonds      checkBond   = bondDAO.getBondByTNFIDandUserID(currentTNF.getTNFID(), applicant.getUserID());
                        Department currentDept = deptDAO.getDeptByName(applicant.getDepartment());
                        lbl_HR.Text = "Is HR";
                        rfv_trainingCost.Enabled    = true;
                        rfv_mspBondDuration.Enabled = true;

                        if (checkBond != null)
                        {
                            rbtnBond.Checked        = true;
                            rbtnMSP.Enabled         = false;
                            rbtnNA.Enabled          = false;
                            mspBondDuration.Text    = string.Empty;
                            mspBondDuration.Enabled = true;
                        }
                        else
                        {
                            rbtnBond.Checked = false;
                            rbtnBond.Enabled = false;
                        }

                        costcentre.Text = currentDept.getCostCentre().ToString();
                        double balance = currentDept.getActualBudget() - courseApplied.getPrice();
                        trainingBudgetBal.Text  = balance.ToString();
                        trainingBudgetDate.Text = DateTime.Now.ToString("MM/dd/yyyy");
                    }
                    else
                    {
                        lbl_HR.Text = "Is not HR";
                        rfv_trainingCost.Enabled    = false;
                        rfv_mspBondDuration.Enabled = false;
                    }
                }
            }
        }
Ejemplo n.º 36
0
        public object ReloadItemIsSetGroup(int userID, int?branchID, string productionItemIDs, string workOrderIDs, string stickGroupdIDs, out Notification notification)
        {
            notification      = new Notification();
            notification.Type = NotificationType.Success;

            List <DTO.PurchaseRequestDetailDTO> data = new List <DTO.PurchaseRequestDetailDTO>();

            try
            {
                using (var context = CreateContext())
                {
                    var dbItem = context.PurchaseRequestMng_function_ReloadItemByMaterialGroup(branchID, productionItemIDs, workOrderIDs, stickGroupdIDs).ToList();

                    int i = 0;
                    foreach (var item in dbItem)
                    {
                        i = i - 1;
                        if (item != null /* && item.ProductionItemTypeID == 2*/)
                        {
                            DTO.PurchaseRequestDetailDTO dtoItem = new DTO.PurchaseRequestDetailDTO();
                            dtoItem.PurchaseRequestDetailID = i;
                            dtoItem.ProductionItemID        = item.ProductionItemID;
                            dtoItem.ProductionItemUD        = item.ProductionItemUD;
                            dtoItem.ProductionItemNM        = item.ProductionItemNM;
                            dtoItem.RequestQnt            = item.RequestQnt;
                            dtoItem.OrderQnt              = item.OrderQnt;
                            dtoItem.StockQnt              = item.StockQnt;
                            dtoItem.IsApproved            = item.IsApproved;
                            dtoItem.UnitNM                = item.UnitNM;
                            dtoItem.WorkOrderID           = item.WorkOrderID;
                            dtoItem.WorkOrderUD           = item.WorkOrderUD;
                            dtoItem.ProformaInvoiceNo     = item.ProformaInvoiceNo;
                            dtoItem.ProductionItemGroupID = item.ProductionItemGroupID;
                            dtoItem.ETA = DateTime.Now.ToString("dd/MM/yyyy");

                            data.Add(dtoItem);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                notification.Type    = NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }

            return(data);
        }
Ejemplo n.º 37
0
        public object GetProductionItemBaseOn(int userID, int?branchID, string workOrderIDs, string searchItem, out Notification notification)
        {
            notification      = new Notification();
            notification.Type = NotificationType.Success;

            List <DTO.ProductionItemDTO> data = new List <DTO.ProductionItemDTO>();

            try
            {
                Framework.DAL.DataFactory fwFactory = new Framework.DAL.DataFactory();
                int?companyID = fwFactory.GetCompanyID(userID);

                using (var context = CreateContext())
                {
                    if (string.IsNullOrEmpty(workOrderIDs)) // Free item
                    {
                        data = converter.DB2DTO_ProductionItem(context.PurchaseRequestMng_function_GetProductionItem(companyID, branchID, searchItem).ToList());
                    }
                    else // WorkOrder item
                    {
                        var dbItem = context.PurchaseRequestMng_function_GetProductionItemByWorkOrder2(companyID, workOrderIDs, branchID, searchItem).ToList();

                        int?productionItemID          = null;
                        DTO.ProductionItemDTO dtoItem = null;

                        foreach (var item in dbItem)
                        {
                            if (item != null /* && item.ProductionItemTypeID != 3*/) // Not get items depend on type is piece
                            {
                                if (productionItemID == null || productionItemID != item.ProductionItemID)
                                {
                                    dtoItem = new DTO.ProductionItemDTO();
                                    dtoItem.ProductionItemID = item.ProductionItemID;
                                    dtoItem.ProductionItemUD = item.ProductionItemUD;
                                    dtoItem.ProductionItemNM = item.ProductionItemNM;
                                    dtoItem.UnitNM           = item.UnitNM;
                                    dtoItem.ETA                   = null;
                                    dtoItem.IsApproved            = item.IsApproved;
                                    dtoItem.OrderQnt              = item.OrderQnt;
                                    dtoItem.StockQnt              = item.StockQnt;
                                    dtoItem.ProductionItemGroupID = item.ProductionItemGroupID;
                                    dtoItem.WorkOrderDTOs         = new List <DTO.WorkOrderDTO>();

                                    data.Add(dtoItem);

                                    productionItemID = item.ProductionItemID;
                                }

                                DTO.WorkOrderDTO dtoWorkOrder = new DTO.WorkOrderDTO();
                                dtoWorkOrder.WorkOrderID       = item.WorkOrderID;
                                dtoWorkOrder.WorkOrderUD       = item.WorkOrderUD;
                                dtoWorkOrder.ProformaInvoiceNo = item.ProformaInvoiceNo;
                                dtoWorkOrder.RequestingQnt     = item.RequestQnt;

                                dtoItem.WorkOrderDTOs.Add(dtoWorkOrder);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                notification.Type    = NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }

            return(data);
        }
Ejemplo n.º 38
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string obj = e.ExtraParams["values"];

            Department b = JsonConvert.DeserializeObject <Department>(obj);

            b.scName   = scId.SelectedItem.Text;
            b.recordId = id;

            b.caName = caId.SelectedItem.Text;
            // Define the object to add or edit as null
            if (supervisorId.SelectedItem.Text != null)
            {
                b.managerName = supervisorId.SelectedItem.Text;
            }
            if (parentId.SelectedItem != null)
            {
                b.parentName = parentId.SelectedItem.Text;
            }
            if (!b.isInactive.HasValue)
            {
                b.isInactive   = false;
                b.activeStatus = (Int16)ActiveStatus.ACTIVE;
            }
            else
            {
                b.activeStatus = (Int16)ActiveStatus.INACTIVE;
            }
            if (scId.SelectedItem != null)
            {
                b.scId = scId.SelectedItem.Value;
            }

            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <Department> request = new PostRequest <Department>();
                    request.entity = b;
                    PostResponse <Department> r = _branchService.ChildAddOrUpdate <Department>(request);
                    b.recordId = r.recordId;

                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...

                        Common.errorMessage(r);;
                        return;
                    }
                    else
                    {
                        //Add this record to the store
                        Store1.Reload();

                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });

                        this.EditRecordWindow.Close();
                        RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        sm.DeselectAll();
                        sm.Select(b.recordId.ToString());
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    int index = Convert.ToInt32(id);//getting the id of the record

                    PostRequest <Department> request = new PostRequest <Department>();
                    request.entity = b;
                    PostResponse <Department> r = _branchService.ChildAddOrUpdate <Department>(request);                   //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);;
                        return;
                    }
                    else
                    {
                        //ModelProxy record = this.Store1.GetById(index);
                        //BasicInfoTab.UpdateRecord(record);

                        //record.Set("managerName", b.managerName);
                        //record.Set("parentName", b.parentName);
                        //record.Set("caName", b.caName);
                        //record.Set("scName", b.scName);


                        //record.Commit();
                        Store1.Reload();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });

                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
            departmentStore.Reload();
        }
Ejemplo n.º 39
0
 public object GetInitData(int userId, out Notification notification)
 {
     return(factory.GetInitData(userId, out notification));
 }
Ejemplo n.º 40
0
 public bool IsValid(Notification notification)
 {
     return(true);
 }
Ejemplo n.º 41
0
 public object GetPurchaseOrderDetailByPurchaseRequestID(int userID, Hashtable filters, out Notification notification)
 {
     return(factory.GetPurchaseOrderDetailByPurchaseRequestID(filters, out notification));
 }
Ejemplo n.º 42
0
 public object GetSupplierPaymentTerm(int userId, int factoryRawMaterialID, out Notification notification)
 {
     return(factory.GetSupplierPaymentTerm(factoryRawMaterialID, out notification));
 }
Ejemplo n.º 43
0
 public bool Finish(int userId, int id, ref object dtoItem, out Notification notification)
 {
     return(factory.Finish(userId, id, ref dtoItem, out notification));
 }
Ejemplo n.º 44
0
 public bool Approve(int userId, int id, ref object dtoItem, out Notification notification)
 {
     return(factory.Approve(userId, id, ref dtoItem, out notification));
 }
Ejemplo n.º 45
0
        public DTO.EditDataDTO GetDataSpecification(int userId, int id, int?sampleProductID, int?productID, out Notification notification)
        {
            DTO.EditDataDTO editData = new EditDataDTO();
            editData.Data = new SpecificationOfProductDTO();
            editData.Data.specificationCushionImageDTOs = new List <SpecificationCushionImageDTO>();
            editData.Data.specificationImageDTOs        = new List <SpecificationImageDTO>();
            editData.Data.specificationPackingDTOs      = new List <SpecificationPackingDTO>();
            editData.Data.specificationWeavingFileDTOs  = new List <SpecificationWeavingFileDTO>();
            editData.Data.specificationWoodenartDTOs    = new List <SpecificationWoodenartDTO>();
            editData.Data.packingSpecificationDTOs      = new List <PackingSpecificationDTO>();
            editData.Data.clientOfProductDTOs           = new List <ClientOfProductDTO>();

            notification = new Notification()
            {
                Type = NotificationType.Success
            };

            try
            {
                using (var context = CreateContext())
                {
                    if (id > 0)
                    {
                        SpecificationOfProductMng_SpecificationOfProduct_View dbItem;
                        dbItem = context.SpecificationOfProductMng_SpecificationOfProduct_View
                                 .Include("SpecificationOfProductMng_SpecificationCushionImage_view")
                                 .Include("SpecificationOfProductMng_SpecificationImage_View")
                                 .Include("SpecificationOfProductMng_SpecificationPacking_View")
                                 .Include("SpecificationOfProductMng_SpecificationWeavingFile_View")
                                 .Include("SpecificationOfProductMng_SpecificationWoodenPart_View").FirstOrDefault(o => o.ProductSpecificationID == id);

                        editData.Data = converter.DB2DTO_GetDataSpecificationOfProduct(dbItem);

                        var cItem = context.SpecificationOfProductMng_ClientOfProduct_View.Where(o => o.ProductID == editData.Data.ProductID);
                        editData.Data.clientOfProductDTOs = converter.DB2DTO_ClientOfProduct(cItem.ToList());
                    }
                    else
                    {
                        // Create specification wooden part
                        editData.Data.specificationWoodenartDTOs.Add(new SpecificationWoodenartDTO()
                        {
                            RowIndex = 1, ProductSpecificationWoodenPartID = -1, DimensionH = null, DimensionW = null, DimensionL = null, ProductSpecificationID = null, Weight = null
                        });
                        editData.Data.specificationWoodenartDTOs.Add(new SpecificationWoodenartDTO()
                        {
                            RowIndex = 2, ProductSpecificationWoodenPartID = -2, DimensionH = null, DimensionW = null, DimensionL = null, ProductSpecificationID = null, Weight = null
                        });
                        editData.Data.specificationWoodenartDTOs.Add(new SpecificationWoodenartDTO()
                        {
                            RowIndex = 3, ProductSpecificationWoodenPartID = -3, DimensionH = null, DimensionW = null, DimensionL = null, ProductSpecificationID = null, Weight = null
                        });
                        editData.Data.specificationWoodenartDTOs.Add(new SpecificationWoodenartDTO()
                        {
                            RowIndex = 4, ProductSpecificationWoodenPartID = -4, DimensionH = null, DimensionW = null, DimensionL = null, ProductSpecificationID = null, Weight = null
                        });
                        editData.Data.specificationWoodenartDTOs.Add(new SpecificationWoodenartDTO()
                        {
                            RowIndex = 5, ProductSpecificationWoodenPartID = -5, DimensionH = null, DimensionW = null, DimensionL = null, ProductSpecificationID = null, Weight = null
                        });
                        editData.Data.specificationWoodenartDTOs.Add(new SpecificationWoodenartDTO()
                        {
                            RowIndex = 6, ProductSpecificationWoodenPartID = -6, DimensionH = null, DimensionW = null, DimensionL = null, ProductSpecificationID = null, Weight = null
                        });

                        editData.Data.specificationPackingDTOs = converter.DB2DTO_GetPacking2(context.SpecificationOfProductMng_PackingSpecification_View.ToList());

                        if (sampleProductID != null)
                        {
                            var dbSample = context.SpecificationOfProductMng_SampleProduct_View.FirstOrDefault(o => o.SampleProductID == sampleProductID);

                            editData.Data.SampleProductID    = dbSample.SampleProductID;
                            editData.Data.ProductUD          = dbSample.SampleProductUD;
                            editData.Data.ArticleDescription = dbSample.ArticleDescription;
                            editData.Data.ClientUD           = dbSample.ClientUD;
                            editData.Data.FactoryID          = dbSample.VNSuggestedFactoryID;
                            editData.Data.ClientID           = dbSample.ClientID;
                            editData.Data.ModelID            = dbSample.ModelID;
                        }

                        if (productID != null)
                        {
                            var dbProduct = context.SpecificationOfProductMng_Product_View.FirstOrDefault(o => o.ProductID == productID);

                            editData.Data.ProductID            = dbProduct.ProductID;
                            editData.Data.ProductUD            = dbProduct.ProductUD;
                            editData.Data.ModelID              = dbProduct.ModelID;
                            editData.Data.ArticleDescription   = dbProduct.ArticleDescription;
                            editData.Data.ProductOverallDimH   = dbProduct.ProductOverallDimH;
                            editData.Data.ProductOverallDimL   = dbProduct.ProductOverallDimL;
                            editData.Data.ProductOverallDimW   = dbProduct.ProductOverallDimW;
                            editData.Data.ProductOverallWeight = dbProduct.ProductOverallWeight;
                            editData.Data.FrameMaterial        = dbProduct.MaterialNM;
                            editData.Data.CushionColor         = dbProduct.CushionColor;
                            editData.Data.WickerColor          = dbProduct.WickerColor;
                            editData.Data.WickerType           = dbProduct.WickerType;

                            var iItem = context.SpecificationOfProductMng_Product_View.Where(o => o.ProductID == dbProduct.ProductID);
                            editData.Data.specificationImageDTOs = converter.DB2DTO_FromProductImage(iItem.ToList());


                            var cItem = context.SpecificationOfProductMng_ClientOfProduct_View.Where(o => o.ProductID == dbProduct.ProductID);
                            editData.Data.clientOfProductDTOs = converter.DB2DTO_ClientOfProduct(cItem.ToList());
                        }
                    }
                }
                return(editData);
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
                notification.DetailMessage.Add(ex.Message);
                if (ex.GetBaseException() != null)
                {
                    notification.DetailMessage.Add(ex.GetBaseException().Message);
                }
                return(editData);
            }
        }
Ejemplo n.º 46
0
 public object GetPurchaseRequest(int userId, Hashtable filters, out Notification notification)
 {
     return(factory.GetPurchaseRequest(filters, out notification));
 }
Ejemplo n.º 47
0
        public override bool UpdateData(int userId, int id, ref object dtoItem, out Notification notification)
        {
            notification = new Notification()
            {
                Type = NotificationType.Success
            };
            DTO.SpecificationOfProductDTO dtoItemSpec = ((Newtonsoft.Json.Linq.JObject)dtoItem).ToObject <DTO.SpecificationOfProductDTO>();
            try
            {
                using (var context = CreateContext())
                {
                    ProductSpecification dbItem;
                    if (id == 0)
                    {
                        dbItem = new ProductSpecification();
                        context.ProductSpecification.Add(dbItem);
                    }
                    else
                    {
                        dbItem = context.ProductSpecification.Where(o => o.ProductSpecificationID == id).FirstOrDefault();
                    }
                    if (dbItem == null)
                    {
                        notification.Message = "Data Not Found !";
                        return(false);
                    }
                    else
                    {
                        //Upload File
                        Module.Framework.DAL.DataFactory fwFactory = new Framework.DAL.DataFactory();
                        string tempFolder = FrameworkSetting.Setting.AbsoluteUserTempFolder + userId.ToString() + @"\";
                        //for SpecificationImage
                        foreach (DTO.SpecificationCushionImageDTO dtoSpecImage in dtoItemSpec.specificationCushionImageDTOs.Where(o => o.ScanHasChange))
                        {
                            dtoSpecImage.FileUD = fwFactory.CreateFilePointer(tempFolder, dtoSpecImage.ScanNewFile, dtoSpecImage.FileUD, dtoSpecImage.FriendlyName);
                        }
                        //for SpecificationImage
                        foreach (DTO.SpecificationImageDTO dtoSpecImage in dtoItemSpec.specificationImageDTOs.Where(o => o.ScanHasChange))
                        {
                            dtoSpecImage.FileUD = fwFactory.CreateFilePointer(tempFolder, dtoSpecImage.ScanNewFile, dtoSpecImage.FileUD, dtoSpecImage.FriendlyName);
                        }

                        //for SpecWeavingFile
                        foreach (DTO.SpecificationWeavingFileDTO dtoWeavingFile in dtoItemSpec.specificationWeavingFileDTOs.Where(o => o.ScanHasChange))
                        {
                            dtoWeavingFile.FileUD = fwFactory.CreateFilePointer(tempFolder, dtoWeavingFile.ScanNewFile, dtoWeavingFile.FileUD, dtoWeavingFile.FriendlyName);
                        }

                        converter.DTO2DB_UpdateSpecificationOfProduct(dtoItemSpec, ref dbItem);

                        //Remove
                        context.ProductSpecificationCushionImage.Local.Where(o => o.ProductSpecification == null).ToList().ForEach(o => context.ProductSpecificationCushionImage.Remove(o));
                        context.ProductSpecificationImage.Local.Where(o => o.ProductSpecification == null).ToList().ForEach(o => context.ProductSpecificationImage.Remove(o));
                        context.ProductSpecificationPacking.Local.Where(o => o.ProductSpecification == null).ToList().ForEach(o => context.ProductSpecificationPacking.Remove(o));
                        context.ProductSpecificationWeavingFile.Local.Where(o => o.ProductSpecification == null).ToList().ForEach(o => context.ProductSpecificationWeavingFile.Remove(o));
                        context.ProductSpecificationWoodenPart.Local.Where(o => o.ProductSpecification == null).ToList().ForEach(o => context.ProductSpecificationWoodenPart.Remove(o));

                        dbItem.UpdatedBy   = userId;
                        dbItem.UpdatedDate = DateTime.Now;

                        context.SaveChanges();

                        dtoItem = GetDataSpecification(userId, dbItem.ProductSpecificationID, dbItem.ProductID, null, out notification).Data;
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
                notification.DetailMessage.Add(ex.Message);
                if (ex.GetBaseException() != null)
                {
                    notification.DetailMessage.Add(ex.GetBaseException().Message);
                }
                return(false);
            }
        }
Ejemplo n.º 48
0
 public bool Cancel(int userId, int id, ref object dtoItem, out Notification notification)
 {
     return(factory.Cancel(userId, id, ref dtoItem, out notification));
 }
Ejemplo n.º 49
0
        public override SearchDataDTO GetDataWithFilter(Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Notification notification)
        {
            totalRows    = 0;
            notification = new Notification()
            {
                Type = NotificationType.Success
            };
            SearchDataDTO data = new SearchDataDTO();

            data.Data = new List <SpecificationOfProductSearchDTO>();

            string ProductUD          = null;
            string articleDescription = null;
            string clientUD           = null;
            string remark             = null;

            if (filters.ContainsKey("ProductUD") && !string.IsNullOrEmpty(filters["ProductUD"].ToString()))
            {
                ProductUD = filters["ProductUD"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("ArticleDescription") && !string.IsNullOrEmpty(filters["ArticleDescription"].ToString()))
            {
                articleDescription = filters["ArticleDescription"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("ClientUD") && !string.IsNullOrEmpty(filters["ClientUD"].ToString()))
            {
                clientUD = filters["ClientUD"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("Remark") && !string.IsNullOrEmpty(filters["Remark"].ToString()))
            {
                remark = filters["Remark"].ToString().Replace("'", "''");
            }

            try
            {
                using (var context = CreateContext())
                {
                    totalRows = context.SpecificationOfProductMng_Function_SearchView(ProductUD, articleDescription, clientUD, remark, orderBy, orderDirection).Count();
                    var result = context.SpecificationOfProductMng_Function_SearchView(ProductUD, articleDescription, clientUD, remark, orderBy, orderDirection);
                    data.Data = converter.DB2DTO_SearchResult(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
                notification.DetailMessage.Add(ex.Message);
                if (ex.GetBaseException() != null)
                {
                    notification.DetailMessage.Add(ex.GetBaseException().Message);
                }
            }


            return(data);
        }
Ejemplo n.º 50
0
        public DTO.InitDataDTO QuickSearchSample(int userId, int?factoryID, Hashtable filters, out Notification notification)
        {
            notification = new Notification()
            {
                Type = NotificationType.Success
            };
            DTO.InitDataDTO data = new DTO.InitDataDTO();
            data.Data = new List <DTO.QuickSearchSampleProductDTO>();
            try
            {
                int userID = userId;

                //if (filters.ContainsKey("factoryID") && !string.IsNullOrEmpty(filters["factoryID"].ToString()))
                //{
                //    factoryID = Convert.ToInt32(filters["factoryID"].ToString());
                //}

                string searchString = (filters.ContainsKey("searchQuery") && filters["searchQuery"] != null && !string.IsNullOrEmpty(filters["searchQuery"].ToString().Replace("'", "''"))) ? filters["searchQuery"].ToString() : null;

                using (var context = CreateContext())
                {
                    data.Data = converter.DB2DTO_QuickSerachSample(context.SpecificationMng_Function_QuickSearchSample(userID, factoryID, searchString).ToList());
                }
            }
            catch (Exception ex)
            {
                notification = new Notification {
                    Type = NotificationType.Error, Message = ex.Message
                };
                return(null);
            }
            return(data);
        }
Ejemplo n.º 51
0
 private void OnNotificaion(Notification notification, object handback)
 {
     _notificationFlag.Set();
 }
Ejemplo n.º 52
0
 public override bool Reset(int userId, int id, ref object dtoItem, out Notification notification)
 {
     throw new NotImplementedException();
 }
        public ActionResult Home()
        {
            if ((sesion = SessionDB.start(Request, Response, false, db)) == null)
            {
                return(Content("-1"));
            }
            try
            {
                Main view = new Main();
                EstadodeCuentaWebModel model = new EstadodeCuentaWebModel();

                Scripts.SCRIPTS = new string[]
                {
                    "js/Pagos/EstadodeCuentaWeb/ECW_Contratos.js"
                };

                ViewBag.Scripts = Scripts.addScript() + Scripts.setPrivileges(Privileges, sesion);

                sesion.vdata["HmeAclzn"] = "No";
                this.setDatosProfesor(sesion, model);

                // Datos persona
                model.GetDatos();
                sesion.vdata["ID_PERSONA"] = model.ID_PERSONA;
                ViewBag.Profesor           = model.Profesor;
                ViewBag.IDSIU       = model.IDSIU;
                ViewBag.NoCuenta    = model.NoCuenta;
                ViewBag.CuentaClabe = model.CuentaClabe;
                ViewBag.Banco       = model.Banco;
                ViewBag.RFC         = model.RFC;

                ViewBag.CorreoO365 = model.CorreoO365;
                ViewBag.SedesAll   = model.SedesAll;

                // Datos fiscales
                model.GetDatosFiscales();
                ViewBag.Fis_Sede      = model.Sede;
                ViewBag.Fis_RecibiDe  = model.Fis_Recibide;
                ViewBag.Fis_RFC       = model.Fis_RFC;
                ViewBag.Fis_Domicilio = model.Fis_Domicilio;
                ViewBag.Fis_Concepto  = model.Fis_Concepto;

                ViewBag.Email_Sociedad = model.Email_Sociedad;

                ViewBag.SEDES = view.createSelectSedesWeb("Sedes", sesion, model.ID_PERSONA);

                sesion.vdata["CVE_TIPOFACTURA"] = model.CveTipoFactura;
                sesion.saveSession();

                //Intercom
                ViewBag.User     = sesion.nickName.ToString();
                ViewBag.Email    = sesion.nickName.ToString();
                ViewBag.FechaReg = DateTime.Today;

                //cuenta
                if (!string.IsNullOrWhiteSpace(model.NoCuenta))
                {
                    if (model.VerificarCuenta())
                    {
                        ViewBag.casilla_valida     = "<input type=\"checkbox\" id=\"valida_check\" checked disabled/>";
                        ViewBag.boton_validacuenta = "<button type = 'button' id = \"btn_valida\" class='btn btn-sm btn-success' onclick=\"validaCuenta();\" disabled>Verificado</button>";
                    }
                    else
                    {
                        ViewBag.casilla_valida     = "<input type=\"checkbox\" id=\"valida_check\"/>";
                        ViewBag.boton_validacuenta = "<button type = 'button' id = \"btn_valida\" class='btn btn-sm btn-success' onclick=\"validaCuenta();\">Verificar</button>";
                    }
                }
                else
                {
                    ViewBag.casilla_valida     = "<input type=\"checkbox\" id=\"valida_check\" disabled/>";
                    ViewBag.boton_validacuenta = "<button type = 'button' id = \"btn_valida\" class='btn btn-sm btn-success' onclick=\"validaCuenta();\" disabled>Verificar</button>";

                    // limpiar validacuenta** y poner en 0
                    model.validaCuenta_2();
                }

                this.getPagosDashboardPagos(model);

                Log.write(this, "Start", LOG.CONSULTA, "Ingresa Pantalla Estado de cuenta Web", sesion);
            }
            catch (Exception e)
            {
                ViewBag.Notification = Notification.Error(e.Message);
                Log.write(this, "Start", LOG.ERROR, "Ingresa Pantalla Estado de cuenta Web" + e.Message, sesion);  //MODIFICAR LA REFERENCIA DE LA PAGINA A INGRESAR
            }
            return(View(Factory.View.Access + "Pagos/EstadodeCuentaWeb/Home.cshtml"));
        }
Ejemplo n.º 54
0
 private static bool FilterNotificaion(Notification notification)
 {
     return(true);
 }
        public async Task <ActionResult> AcceptFileRequest(int FileID, int NotificationID, string IDOfUserThatRequestedTheFileToBeShared, string IDOfTheFileOwner)
        {
            AspNetUser UserThatSentRequest; //IDOfUserThatRequestedTheFileToBeShared
            AspNetUser FileOwner;           //IDOfTheFileOwner (Person Currently Lofgged on)


            string GlobalErrorMessage = "";
            string rtnSuccessMessage  = "";

            Boolean UpdatedCorrectly = false;

            using (db)
            {
                try
                {
                    //updates the Notification acknolegemant to indicate that the notification has been responeded to.
                    Notification Noti = db.Notifications.Where(a => a.NotificationID == NotificationID).FirstOrDefault <Notification>();
                    if (!(Noti.UserHasAcknowledgement))
                    {
                        FileOwner = (from a in db.AspNetUsers
                                     where a.Id == IDOfTheFileOwner
                                     select a).FirstOrDefault <AspNetUser>();

                        UserThatSentRequest = (from a in db.AspNetUsers
                                               where a.Id == IDOfUserThatRequestedTheFileToBeShared
                                               select a).FirstOrDefault <AspNetUser>();

                        EmailSetting es = (from a in db.EmailSettings select a).FirstOrDefault <EmailSetting>();
                        var          PartialFileObject = db.Files.Where(a => a.FileID == FileID).Select(a => new { a.FileID, a.FileName, a.FileExtension }).FirstOrDefault();


                        //db.Files_U_SetFileStatus(FileID, (int)Common.Enum.DBLookupEnum.FileViewStatus.FileIsLocked);


                        FileSharedWithUser FSWU = new FileSharedWithUser()
                        {
                            UserIDOfSharedDocs = IDOfUserThatRequestedTheFileToBeShared,
                            FileID             = FileID,
                            DateShared         = DateTime.Now
                        };

                        Noti.UserHasAcknowledgement = true;

                        db.FileSharedWithUsers.Add(FSWU);

                        await db.SaveChangesAsync();

                        string FromName = FileOwner.FirstName + " " + FileOwner.LastName;
                        string ToName   = UserThatSentRequest.FirstName + " " + UserThatSentRequest.LastName;

                        //Email Message To the file owner. Notifying him/her of the that the Private File Was successfull shared  With the person that requested it.
                        //await Common.Email.EmailHelper.sendMessageAsync(
                        //   _ToAddress: FileOwner.Email,
                        //   _FromAddress: UserThatSentRequest.Email,
                        //   _FromName: FromName,
                        //   _ToName: ToName,
                        //   _Subject: "Over Docs System - File (" + PartialFileObject.FileID + " - " + PartialFileObject.FileName + "." + PartialFileObject.FileExtension + ") has been shared.",
                        //   _Message: "Good day " + FromName + ". <br/><br/>A file shared notifiction has been sent to you from the system to notify you that the following file has bee successfully Shared with " + ToName + " .<br/> File Name: " + PartialFileObject.FileName + "." + PartialFileObject.FileExtension + ".<br/>File Ref# " + FileID + ".<br/><br/> Regards Over Docs.",
                        //    _Credentials_UserName: es.UserName,
                        //    _Credentials_Password: es.Password,
                        //     _SMTP_HOST: es.SmtpHost,
                        //     _SMTP_PORT: es.SmtpPort,
                        //     _IsSsl: es.SslEnabled);

                        ////Email Message To the Person that requested the file. To Confirm that the file has been shared out with user and can now download if so desired.
                        //await Common.Email.EmailHelper.sendMessageAsync(
                        //   _ToAddress: UserThatSentRequest.Email,
                        //   _FromAddress: FileOwner.Email,
                        //   _FromName: ToName,
                        //   _ToName: FromName,
                        //   _Subject: "Over Docs System - Notification (" + PartialFileObject.FileID + " - " + PartialFileObject.FileName + "." + PartialFileObject.FileExtension + ") has been shared!",
                        //   _Message: "Good day " + ToName + ". <br/><br/>" + FromName + " has responded to your request to share the following file.<br/> (" + PartialFileObject.FileID + " - " + PartialFileObject.FileName + "." + PartialFileObject.FileExtension + ").<br/> The file has been successfully shared with you and is now viewable under you private documents.<br/>The file can now be download if you require it.<br/><br/> Regards Over Docs.",
                        //    _Credentials_UserName: es.UserName,
                        //    _Credentials_Password: es.Password,
                        //     _SMTP_HOST: es.SmtpHost,
                        //     _SMTP_PORT: es.SmtpPort,
                        //     _IsSsl: es.SslEnabled);

                        rtnSuccessMessage += "Notification has been successfully recorded and Email Notification Sent to the person that request it in forming them that the file is avaiable!";
                    }
                    else
                    {
                        rtnSuccessMessage += "Notification has been already successfully been sent both the owner and the person that request the file to be shared! please check you email.";
                    }
                }
                catch (DbEntityValidationException dbEx)
                {
                    foreach (DbEntityValidationResult entityErr in dbEx.EntityValidationErrors)
                    {
                        foreach (DbValidationError error in entityErr.ValidationErrors)
                        {
                            GlobalErrorMessage = "Error Property Name " + error.PropertyName + " : Error Message: " + error.ErrorMessage;
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobalErrorMessage = "Error : " + ex.Message.ToString();
                }


                return(Json(rtnSuccessMessage, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult DetallePago()
        {
            if ((sesion = SessionDB.start(Request, Response, false, db)) == null)
            {
                return(Content("-1"));
            }

            try
            {
                Main view = new Main();

                Scripts.SCRIPTS = new string[]
                {
                    "plugins/Angular/jquery.ui.widget.js"
                    , "plugins/Angular/jquery.iframe-transport.js"
                    , "plugins/Angular/jquery.fileupload.js"
                    , "js/Pagos/EstadodeCuenta/EstadodeCuenta.js"
                    , "js/Pagos/EstadodeCuentaWeb/ECW_EstadoCuenta.js"
                    , "js/Pagos/EstadodeCuentaWeb/ECW_RetencionesMensuales.js"
                    , "js/Pagos/EstadodeCuentaWeb/ECW_RetencionesAnuales.js"
                    , "js/Pagos/EstadodeCuentaWeb/EstadodeCuentaWeb.js"
                };

                ViewBag.Scripts = Scripts.addScript() + Scripts.setPrivileges(Privileges, sesion);

                EstadodeCuentaWebModel model = new EstadodeCuentaWebModel();
                model.sesion = sesion;

                this.setDatosProfesor(sesion, model);

                ViewBag.Profesor    = model.Profesor;
                ViewBag.NoCuenta    = model.NoCuenta;
                ViewBag.CuentaClabe = model.CuentaClabe;
                ViewBag.Banco       = model.Banco;
                ViewBag.RFC         = model.RFC;
                ViewBag.Direccion   = model.Direccion;

                /*DateTime dtAhora = DateTime.Now.AddHours(-6);
                 * String strDate = "";
                 * strDate = dtAhora.ToString();
                 * ViewBag.FECHAHORASYS = strDate;
                 * strDate = dtAhora.ToString("yyyy-MM-dd");
                 * ViewBag.FECHASYS = strDate;*/

                // Datos fiscales
                model.GetDatosFiscales();
                ViewBag.Fis_Sede      = model.Sede;
                ViewBag.Fis_RecibiDe  = model.Fis_Recibide;
                ViewBag.Fis_RFC       = model.Fis_RFC;
                ViewBag.Fis_Domicilio = model.Fis_Domicilio;
                ViewBag.Fis_Concepto  = model.Fis_Concepto;

                if (model.Email_Sociedad == "")
                {
                    ViewBag.Email_Sociedad = "*****@*****.**";
                }
                else
                {
                    ViewBag.Email_Sociedad = model.Email_Sociedad;
                }

                ViewBag.SEDES = view.createSelectSedesWeb("Sedes", sesion, model.ID_PERSONA, true);
                ViewBag.IDSIU = model.IDSIU;

                sesion.vdata["CVE_TIPOFACTURA"] = model.CveTipoFactura;
                sesion.saveSession();

                model.ID_ESTADODECUENTA = Convert.ToInt32(Request.QueryString["_idestadocuenta"]);

                //MENSAJE DE RECALCULO ASIMILADOS
                if (model.CveTipoFactura == "A")
                {
                    ViewBag.MENSAJEA = model.getMensajeRecalculoAsimilados();
                }

                ViewBag.ESTADO         = model.GetEstadoPago();
                ViewBag.ESTADODECUENTA = model.GetEstadodeCuenta();
                ViewBag.BLOQUEOS       = model.GetBloqueos();
                ViewBag.PENSIONES      = model.GetPensiones();

                Log.write(this, "Start", LOG.CONSULTA, "Ingresa Pantalla Estado de cuenta Web", sesion);
            }
            catch (Exception e)
            {
                ViewBag.Notification = Notification.Error(e.Message);
                Log.write(this, "Start", LOG.ERROR, "Ingresa Pantalla Detalle Pago" + e.Message, sesion);  //MODIFICAR LA REFERENCIA DE LA PAGINA A INGRESAR
            }
            return(View(Factory.View.Access + "Pagos/EstadodeCuentaWeb/DetallePago.cshtml"));
        }
Ejemplo n.º 57
0
 public bool Supports(Notification notification, ITarget target)
 {
     return(notification.Provider is GitLabProvider && target is SlackTarget);
 }
        public ActionResult PagosPendientes(EstadodeCuentaWebModel model)
        {
            if ((sesion = SessionDB.start(Request, Response, false, db)) == null)
            {
                return(Content("-1"));
            }

            try
            {
                Scripts.SCRIPTS = new string[]
                {
                    "js/Pagos/EstadodeCuentaWeb/PagosPendientes.js"
                };

                Main view = new Main();
                ViewBag.MainUser = this.CreateMenuInfoUser(sesion);
                ViewBag.Scripts  = Scripts.addScript() + Scripts.setPrivileges(Privileges, sesion);


                this.setDatosProfesor(sesion, model);

                string filter_Sede = Request.Params["filter_Sede"];
                if (filter_Sede != "" && filter_Sede != null)
                {
                    sesion.vdata["Sede"] = Request.Params["filter_Sede"];
                    model.Sede           = sesion.vdata["Sede"];
                }

                ViewBag.Profesor = model.Profesor;


                // Datos fiscales
                //   EstadodeCuentaWebModel model2 = new EstadodeCuentaWebModel();

                model.GetDatosFiscales();
                if (model.Email_Sociedad == "")
                {
                    ViewBag.Email_Sociedad = "*****@*****.**";
                }
                else
                {
                    ViewBag.Email_Sociedad = model.Email_Sociedad;
                }


                /* if (sesion.tipouser == 'U')
                 *  ViewBag.SEDES = view.createSelectSedes("Sedes", sesion);
                 * else  */
                ViewBag.SEDES = view.createSelectSedesWeb("Sedes", sesion, model.ID_PERSONA);
                ViewBag.IDSIU = model.IDSIU;

                sesion.vdata["CVE_TIPOFACTURA"] = model.CveTipoFactura;
                sesion.saveSession();



                //IMPRIME DATATABLE
                if (filter_Sede != "" && filter_Sede != null)
                {
                }
                else
                {
                    this.getPagosPendientes(model);
                }
            }
            catch (Exception e)
            {
                ViewBag.Notification = Notification.Error(e.Message);
                Log.write(this, "Start", LOG.ERROR, "Ingresa Pantalla Estado de cuenta Web" + e.Message, sesion);  //MODIFICAR LA REFERENCIA DE LA PAGINA A INGRESAR
            }
            return(View(Factory.View.Access + "Pagos/EstadodeCuentaWeb/PagosPendientes.cshtml"));
        }
Ejemplo n.º 59
0
 protected virtual void requiredFieldsAndFormatValidation(Notification notification)
 {
     // Empty
 }
        public async Task <ActionResult> SendRequestNotification(int FileID, int NotificationTypeID, string IDOFPersonLoggedOn, string IDOfTheFileOwner)
        {
            AspNetUser CurrentUser;
            AspNetUser FileOwner;


            string GlobalErrorMessage = "";
            string rtnSuccessMessage  = "";

            Notification hasNotificationAlreadyBeenSent;

            using (db)
            {
                try
                {
                    hasNotificationAlreadyBeenSent = (from a in db.Notifications
                                                      where
                                                      a.FileID == FileID &&
                                                      a.NotificationTypeID == (int)Common.Enum.DBLookupEnum.NotificationTypes.FileRequest &&
                                                      a.UserIDOfNotificationSender == IDOFPersonLoggedOn &&
                                                      a.UserIDOfNotificationRecipient == IDOfTheFileOwner
                                                      select a
                                                      ).FirstOrDefault <Notification>();

                    CurrentUser = (from a in db.AspNetUsers
                                   where a.Id == IDOFPersonLoggedOn
                                   select a).FirstOrDefault <AspNetUser>();
                    FileOwner = (from a in db.AspNetUsers
                                 where a.Id == IDOfTheFileOwner
                                 select a).FirstOrDefault <AspNetUser>();

                    var PartialFileObject = db.Files.Where(a => a.FileID == FileID).Select(a => new { a.FileID, a.FileName, a.FileExtension }).FirstOrDefault();


                    (from a in db.Files
                     where a.FileID == FileID
                     select a).FirstOrDefault <File>();

                    EmailSetting es = (from a in db.EmailSettings
                                       select a).FirstOrDefault <EmailSetting>();

                    string FromName = CurrentUser.FirstName + " " + CurrentUser.LastName;
                    string ToName   = FileOwner.FirstName + " " + FileOwner.LastName;

                    //test to see if the Request notification has been sent for this user.
                    if (hasNotificationAlreadyBeenSent is null)
                    {
                        Notification n = new Notification()
                        {
                            FileID                        = FileID,
                            DateCreated                   = DateTime.Now,
                            NotificationTypeID            = (int)Common.Enum.DBLookupEnum.NotificationTypes.FileRequest,
                            UserIDOfNotificationRecipient = IDOfTheFileOwner,
                            UserIDOfNotificationSender    = IDOFPersonLoggedOn,
                            UserHasAcknowledgement        = false
                        };
                        db.Notifications.Add(n);

                        await db.SaveChangesAsync();

                        rtnSuccessMessage += "Notification has been successfully recorded and Email Notification Sent to the file owner for approval.";

                        //determine if the notification has already been sent?

                        ////Email Message To the file owner. Notifying him/her of the that a user wants to gain access to a private file.
                        //await Common.Email.EmailHelper.sendMessageAsync(
                        //   _ToAddress: FileOwner.Email,
                        //   _FromAddress: CurrentUser.Email,
                        //   _FromName: FromName,
                        //   _ToName: ToName,
                        //   _Subject: "Over Docs System - Request to share private file (" + PartialFileObject.FileID + " - " + PartialFileObject.FileName + "." + PartialFileObject.FileExtension + ")",
                        //   _Message: "Good day " + FileOwner.FirstName + " " + FileOwner.LastName + ". <br/><br/>A request notifiction has been sent to you from: " + CurrentUser.FirstName + " " + CurrentUser.LastName + " to please share one of your documents.<br/> REquest for the following file:<br/>File Name: " + PartialFileObject.FileName + "." + PartialFileObject.FileExtension + ".<br/>File Ref# " + FileID + ".<br/><br/> Regards Over Docs.",
                        //    _Credentials_UserName: es.UserName,
                        //    _Credentials_Password: es.Password,
                        //     _SMTP_HOST: es.SmtpHost,
                        //     _SMTP_PORT: es.SmtpPort,
                        //     _IsSsl: es.SslEnabled);

                        ////Email Message To the Current user logged. To Confirm that a notification was sent.
                        //await Common.Email.EmailHelper.sendMessageAsync(
                        //   _ToAddress: CurrentUser.Email,
                        //   _FromAddress: FileOwner.Email,
                        //   _FromName: ToName,
                        //   _ToName: FromName,
                        //   _Subject: "Over Docs System - Notification sent to the owner of  (" + PartialFileObject.FileID + " - " + PartialFileObject.FileName + "." + PartialFileObject.FileExtension + ")",
                        //   _Message: "Good day " + CurrentUser.FirstName + " " + CurrentUser.LastName + ". <br/><br/>A REQUEST notifiction has been sent to the owner: " + FileOwner.FirstName + " " + FileOwner.LastName + ".<br/> For the following file:<br/>File Name: " + PartialFileObject.FileName + "." + PartialFileObject.FileExtension + ".<br/>File Ref# " + FileID + ".<br/><br/> Regards Over Docs.",
                        //    _Credentials_UserName: es.UserName,
                        //    _Credentials_Password: es.Password,
                        //     _SMTP_HOST: es.SmtpHost,
                        //     _SMTP_PORT: es.SmtpPort,
                        //     _IsSsl: es.SslEnabled);
                        rtnSuccessMessage += "Notification has been successfully recorded and posted to the file owner, as well Email Notification Sent to the file owner for approval.";
                    }
                    else
                    {
                        ////Email Message To the file owner. Notifying him/her of the that a user wants to gain access to a private file.
                        //await Common.Email.EmailHelper.sendMessageAsync(
                        //   _ToAddress: FileOwner.Email,
                        //   _FromAddress: CurrentUser.Email,
                        //   _FromName: FromName,
                        //   _ToName: ToName,
                        //   _Subject: "Over Docs System - Reminder - Request to share private file (" + PartialFileObject.FileID + " - " + PartialFileObject.FileName + "." + PartialFileObject.FileExtension + ")",
                        //   _Message: "Good day " + FileOwner.FirstName + " " + FileOwner.LastName + ". <br/><br/>This is a friendly reminder that a request notifiction has been sent to you from: " + CurrentUser.FirstName + " " + CurrentUser.LastName + " to please share one of your documents.<br/> Request for the following file:<br/>File Name: " + PartialFileObject.FileName + "." + PartialFileObject.FileExtension + "<br/>File Ref# " + FileID + ".<br/><br/> Regards Over Docs.",
                        //    _Credentials_UserName: es.UserName,
                        //    _Credentials_Password: es.Password,
                        //     _SMTP_HOST: es.SmtpHost,
                        //     _SMTP_PORT: es.SmtpPort,
                        //     _IsSsl: es.SslEnabled);

                        ////Email Message To the Current user logged. To Confirm that a notification was sent.
                        //await Common.Email.EmailHelper.sendMessageAsync(
                        //   _ToAddress: CurrentUser.Email,
                        //   _FromAddress: FileOwner.Email,
                        //   _FromName: ToName,
                        //   _ToName: FromName,
                        //   _Subject: "Over Docs System - Notification sent to the owner of  (" + PartialFileObject.FileID + " - " + PartialFileObject.FileName + "." + PartialFileObject.FileExtension + ")",
                        //   _Message: "Good day " + CurrentUser.FirstName + " " + CurrentUser.LastName + ". <br/><br/>A REQUEST notifiction has been re-sent to the owner: " + FileOwner.FirstName + " " + FileOwner.LastName + ", reminding him/her to review your notification.<br/> For the following file:<br/>File Name: " + PartialFileObject.FileName + "." + PartialFileObject.FileExtension + ".<br/>File Ref# " + FileID + ".<br/><br/> Regards Over Docs.",
                        //    _Credentials_UserName: es.UserName,
                        //    _Credentials_Password: es.Password,
                        //     _SMTP_HOST: es.SmtpHost,
                        //     _SMTP_PORT: es.SmtpPort,
                        //     _IsSsl: es.SslEnabled);

                        rtnSuccessMessage += "Notification has been successfully resent to the file owner and Email Notification Sent to the file owner for prompting to process your request.";
                    }
                }
                catch (DbEntityValidationException dbEx)
                {
                    foreach (DbEntityValidationResult entityErr in dbEx.EntityValidationErrors)
                    {
                        foreach (DbValidationError error in entityErr.ValidationErrors)
                        {
                            GlobalErrorMessage = "Error Property Name " + error.PropertyName + " : Error Message: " + error.ErrorMessage;
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobalErrorMessage = "Error : " + ex.Message.ToString();
                }
            };

            return(Json(rtnSuccessMessage, JsonRequestBehavior.AllowGet));
        }