Example #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsValid)
                {
                    return;
                }
                CheckValidation objIsValid = new CheckValidation();
                string          firmname   = txtFirmName.Text;

                string query = "select vsFirmName from tblFirmDetails where vsFirmName = '" + firmname + "'";

                if (objFirmDtls.addFirmDetails(firmname, txtContactPerson.Text, txtTelephone.Text,
                                               txtCellphone.Text, txtPostalcode.Text, txtAdress.Text,
                                               txtStartDate.Text, txtEndDate.Text, txtEmail.Text, int.Parse(drpSector.SelectedValue)))
                {
                    lblMessage.ForeColor = System.Drawing.Color.Black;
                    lblMessage.Text      = ds.Tables[0].Rows[0][1].ToString();
                    Utility ObjUtility = new Utility();
                    ObjUtility.ResetFormControl(divControl);
                }

                else
                {
                    lblMessage.ForeColor = System.Drawing.Color.Red;
                    lblMessage.Text      = "Error is there.";
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }
 private void InsertProductBtn_Click(object sender, RoutedEventArgs e)
 {
     if (CheckValidation.CheckName(txtInsertName.Text) &&
         CheckValidation.CheckPriceAndQuantity(txtInsertPrice.Text, txtInsertQuantity.Text)
         )
     {
         var cate    = db.Categories.Where(x => x.NameCategory == cbbInsertCategory.SelectedValue).Select(x => x).ToList().Last();
         var sanpham = new Product()
         {
             NameProduct     = txtInsertName.Text,
             PriceProduct    = Decimal.Parse(txtInsertPrice.Text),
             QuantityProduct = int.Parse(txtInsertQuantity.Text),
             ImageProduct    = _nameImages,
             InfoProduct     = txtInsertInfo.Text,
             CategoryID      = cate.IDCategory
         };
         db.Products.Add(sanpham);
         db.SaveChanges();
         ResetGT();
     }
     else
     {
         MessageBox.Show("Thông tin sản phẩm không hợp lệ. Vui lòng kiểm tra lại !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Example #3
0
        public async Task <TaskStatus> AddProductAsync(ProductDto pr)
        {
            if (!CheckValidation.CheckObjectIsValid <ProductDto>(pr))
            {
                return(TaskStatus.Faulted);
            }
            var mapSource = mapper.Map <Product>(pr);
            await ctx.Product.AddAsync(mapSource);

            return(TaskStatus.RanToCompletion);
        }
Example #4
0
        protected override void CheckForResult(bool userTriggered, double timeOffset)
        {
            Debug.Assert(HitObject.HitWindows != null);

            if (CheckValidation == null)
            {
                return;
            }

            if (!userTriggered)
            {
                if (!HitObject.HitWindows.CanBeHit(timeOffset))
                {
                    ApplyResult(r => r.Type = HitResult.Miss);
                }

                return;
            }

            var validation = CheckValidation.Invoke(HitObject.Angle);

            if (validation.Item1)
            {
                var result = HitObject.HitWindows.ResultFor(timeOffset);

                if (result == HitResult.None || CheckHittable?.Invoke(this, Time.Current) == false)
                {
                    return;
                }

                if (!validActionPressed)
                {
                    ApplyResult(r => r.Type = HitResult.Miss);
                }
                else
                {
                    ApplyResult(r =>
                    {
                        var beatResult = (TauJudgementResult)r;

                        if (result.IsHit())
                        {
                            beatResult.DeltaAngle = validation.Item2;
                        }

                        beatResult.Type = result;
                    });
                }
            }
        }
        private void SaveAddvertisement()
        {
            try
            {
                if (FileUploadDocument.HasFile)
                {
                    filepath = FileUploadDocument.PostedFile.FileName; //IT CONTAINS FILNE NAME WITH EXTENTION
                    fileName = Path.GetFileName(filepath);


                    fileType    = objAdvertisement.getFileType(filepath);
                    fileContent = objAdvertisement.getFileContent((FileUploadDocument));
                }
                else
                {
                    fileContent = new byte[1];
                }
                CheckValidation  objIsValid = new CheckValidation();
                EntAdvertisement objEnt1    = new EntAdvertisement();//this(objEnt1) is send reffrence for getting output value without returning obj, we pass this refrence of the obj(objEnt1) fill the output value on this refrence and get without returnng ths one
                if (objAdvertisement.AddAdvertisementDetail(ddlLoanNo.SelectedValue, txtProjectName.Text, txtBidPackageNo.Text, txtEstimatedAmount.Text == string.Empty ? "0" : txtEstimatedAmount.Text, txtAddDate.Text, txtLocation.Text, txtLastSubmissionDate.Text, txtContactPerson.Text, txtDescription.Text, Convert.ToInt32(ddlDocCat.SelectedValue), fileType, fileContent, fileName, userInform.UserID, userInform.AgencyID, txtContactNumber.Text, txtEmailId.Text, objEnt1))
                {
                    lblMessage.ForeColor = System.Drawing.Color.Red;
                    lblMessage.Text      = "Insert Successfuly";
                    Utility ObjUtility = new Utility();



                    if (flag)
                    {
                        ListOfSelectedVendorGroup(objEnt1.OutputValue);
                    }
                    else
                    {
                        ObjUtility.ResetFormControl(divControl);
                    }
                }

                else
                {
                    lblMessage.ForeColor = System.Drawing.Color.Red;
                    lblMessage.Text      = "Error is there.";
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                lblMessage.ForeColor = System.Drawing.Color.Red;
                lblMessage.Text      = "Error is there.";
            }
        }
        public async Task <TaskStatus> AddPostAsync(PostDto postDto)
        {
            if (CheckValidation.CheckObjectIsValid <PostDto>(postDto))
            {
                var post = mapper.Map <Post>(postDto);
                await _ctx.Post.AddAsync(post);

                return(TaskStatus.RanToCompletion);
            }
            else
            {
                return(TaskStatus.Faulted);
            }
        }
Example #7
0
        //This process runs the live host and the nmap scan if the ping was a success.
        private void ScanprocessReturn()
        {
            //Error checking to make sure the IP Address is in the correct format

            if ((LocalNetwork.IsChecked == false) && (CheckValidation.IsValidateIP(IpAddress.Text) != "True"))
            {
                Output.Text = "This IP Address is not in the correct format!  Correct example 127.0.0.1";
            }
            else
            {
                //this variable is called from the nmap scan to run a scan on all 65535 ports
                AllPortCheck = AllPorts.IsChecked.Value;

                //this variable is called from the nmap scan to run a nmap scan on all devices on a class C network
                WholeNetworkCheck = WholeNetwork.IsChecked.Value;
                //this is set to true to show generic progress and not a percentage style
                pbStatus.IsIndeterminate = true;
                //start an async progress bar output
                BackgroundWorker worker = new BackgroundWorker();
                worker.WorkerReportsProgress = true;
                worker.DoWork += worker_DoWork;

                //output the results of the View model and scan and display them in the output text block
                Output.Text = (MPVM.DisplayOutput(IpAddress.Text));


                //if the live host scan was a success then make the progress bar visable

                if (State.SuccessfulPing)
                { //(ASCII ART FOR A BIT OF FUN) the formatting is for the center of the screen as it is a fixed size
                    Output.Text += "\n";
                    Output.Text += "\n                                 ##########################";
                    Output.Text += "\n                                 ### FULL SCAN IN PROGRESS ###";
                    Output.Text += "\n                                 ##########################";
                    Output.Text += "\n";

                    // show status bar when scan is running
                    pbStatus.Visibility = Visibility.Visible;
                }

                MPVM.ScanComplete += ScanCompleteHandler;

                worker.RunWorkerAsync();
            }
        }
Example #8
0
        protected override void CheckForResult(bool userTriggered, double timeOffset)
        {
            Debug.Assert(HitObject.HitWindows != null);

            if (CheckValidation == null)
            {
                return;
            }

            if (!userTriggered)
            {
                if (!HitObject.HitWindows.CanBeHit(timeOffset))
                {
                    ApplyResult(r => r.Type = HitResult.Miss);
                }

                return;
            }

            if (CheckValidation.Invoke(this))
            {
                var result = HitObject.HitWindows.ResultFor(timeOffset);

                if (result == HitResult.None)
                {
                    return;
                }

                if (!validActionPressed)
                {
                    ApplyResult(r => r.Type = HitResult.Miss);
                }
                else
                {
                    ApplyResult(r => r.Type = result);
                }
            }
        }
Example #9
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            CheckValidation  objIsValid = new CheckValidation();
            ClsModuleDetails objModule  = new ClsModuleDetails();

            //if (objIsValid.isAlphaNumeric(txtRoleName.Text) && objIsValid.isAlphaNumeric(txtDescription.Text))
            //{
            if (btnSubmit.Visible == true)
            {
                if (objModule.AddModuleDetails(txtModuleName.Text, txtDescription.Text))
                {
                    lblMessage.ForeColor = System.Drawing.Color.Black;
                    lblMessage.Text      = "Information has been saved successfully";
                    Utility util = new Utility();
                    util.ResetFormControl(pageDiv);
                }
                else
                {
                    lblMessage.ForeColor = System.Drawing.Color.Red;
                    lblMessage.Text      = "Sorry Unable to Save";
                }
            }
            else if (btnUpdate.Visible == true)
            {
                if (objModule.EditModuleDetails(int.Parse(lblModuleID.Text), txtModuleName.Text, txtDescription.Text))
                {
                    lblMessage.ForeColor = System.Drawing.Color.Black;
                    lblMessage.Text      = "Information has been saved successfully";
                    Utility util = new Utility();
                    util.ResetFormControl(pageDiv);
                }
                else
                {
                    lblMessage.ForeColor = System.Drawing.Color.Red;
                    lblMessage.Text      = "Sorry Unable to Save";
                }
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            CheckValidation objIsValid = new CheckValidation();
            RoleDetails     objRole    = new RoleDetails();

            if (btnSubmit.Visible == true)
            {
                if (objRole.AddRoleDetails(txtRoleName.Text, txtDescription.Text))
                {
                    lblMessage.ForeColor = System.Drawing.Color.Black;
                    lblMessage.Text      = "Information has been saved successfully";
                    Utility ObjUtility = new Utility();
                    ObjUtility.ResetFormControl(pageDiv);
                }
                else
                {
                    lblMessage.ForeColor = System.Drawing.Color.Red;
                    lblMessage.Text      = "Sorry Unable to Save";
                }
            }

            else if (btnUpdate.Visible == true)
            {
                if (objRole.EditRoleDetails(int.Parse(lblRoleID.Text), txtRoleName.Text, txtDescription.Text))
                {
                    lblMessage.ForeColor = System.Drawing.Color.Black;
                    lblMessage.Text      = "Information has been Updated successfully";
                    txtDescription.Text  = "";
                    txtRoleName.Text     = "";
                }
                else
                {
                    lblMessage.ForeColor = System.Drawing.Color.Red;
                    lblMessage.Text      = "Sorry Unable to Update";
                }
            }
        }