public ServiceResponse AddTransportText(int accessCode, string value)
        {
            TransportText t = new TransportText();

            t.AccessCode                = accessCode;
            t.DateAddedOnUtc            = DateTime.Now;
            t.DateToDeleteByUtc         = DateTime.Now.AddMinutes(10);
            t.TransportTextDataEncypted = TextEncryptService.Encrypt(value);
            _transportTextRepository.Add(t);
            _transportTextRepository.Submit();
            return(new ServiceResponse()
            {
                Message = "Transported Successfully", WasSuccess = true
            });
        }
Exemple #2
0
        private void ReSavebtn_Click(object sender, EventArgs e)
        {
            string query = "";

            if (StaaFText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Employee ID");
                StaaFText.Focus();
                return;
            }



            if (BasicSalaryText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Password");
                BasicSalaryText.Focus();
                return;
            }

            if (TransportText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Transport Parcentage");
                TransportText.Focus();
                return;
            }
            if (MedicalText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Medicalbill Percentage");
                MedicalText.Focus();
                return;
            }
            if (MobileBill.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter MobileBill Percentage");
                MobileBill.Focus();
                return;
            }
            if (FoodbillText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter FoodBil Percentage");
                FoodbillText.Focus();
                return;
            }

            if (totalAllow.Text.Trim() == "")
            {
                totalAllow.Focus();
                return;
            }

            query = "SELECT COUNT(*) AS Count FROM Salary_Info WHERE StaffID = " + StaaFText.Text + "";
            if (stfID == 0)
            {
                if (DbAccess.NumberOfRecords(query) > 0)
                {
                    MessageBox.Show("This username already exists! Please try another ID!");
                    StaaFText.Focus();
                    return;
                }
            }
            else
            {
                if (DbAccess.NumberOfRecords(query) > 1)
                {
                    MessageBox.Show("This username already exists! Please try another ID!");
                    StaaFText.Focus();
                    return;
                }
            }
            try
            {
                if (stfID == 0)
                {
                    query = "INSERT INTO Salary_Info(StaffID,BasicSalary,Transport,Medical,MobileBill,Food,Total) VALUES(" + Convert.ToInt32(StaaFText.Text) + ",  '" + BasicSalaryText.Text + "',  '" + TransportText.Text + "', '" + MedicalText.Text + "', '" + MobileBill.Text + "', '" + FoodbillText.Text + "', '" + totalAllow.Text + "' )";
                }


                else
                {
                    query = "UPDATE Salary_Info SET  BasicSalary = '" + BasicSalaryText.Text + "', Transport = '" + TransportText.Text + "', Medical= '" + MedicalText.Text + "',MobileBill = '" + MobileBill.Text + "', Food = '" + FoodbillText.Text + "',  Total = '" + totalAllow.Text + "' WHERE StaffID = " + stfID;
                }

                if (DbAccess.ExecuteToDB(query))
                {
                    if (stfID == 0)
                    {
                        MessageBox.Show("Saved Successfully!!!");
                    }
                    else
                    {
                        MessageBox.Show("Update Successfully!!!");
                    }
                }
                else
                {
                    MessageBox.Show("Failed To Save!!!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Connection Error!!!");
            }
            finally
            {
                Reset();
            }
        }