public ActionResult Create(EmployeeText employeeText)
 {
     if (CheckAccess())
     {
         if (ModelState.IsValid)
         {
             var checkperson = employeerepo.GetByUserName(employeeText.ReceiverUserName);
             if (checkperson != null)
             {
                 textrepo.Insert(employeeText);
                 return(RedirectToAction("SendByMe"));
             }
             TempData["Error"]    = "Their is no employee with this username";
             TempData["Receiver"] = employeeText.ReceiverUserName;
             TempData["TextBody"] = employeeText.TextBody;
             return(View(employeeText));
         }
         else
         {
             TempData["Receiver"] = employeeText.ReceiverUserName;
             TempData["TextBody"] = employeeText.TextBody;
             return(View(employeeText));
         }
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
Пример #2
0
        private void SubmitSaleButton_Click(object sender, RoutedEventArgs e)
        {
            string[] Data = new string[5];
            Data[0] = VehicleText.GetLineText(0);
            Data[1] = CustomerText.GetLineText(0);
            Data[2] = EmployeeText.GetLineText(0);
            Data[3] = DateText.GetLineText(0);
            Data[4] = PriceText.GetLineText(0);

            MakeSale S = new MakeSale(Data, cn);

            try
            {
                S.CreateSale();
            }
            catch (OleDbException ex)
            {
                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
                return;
            }

            VehicleText.Clear();
            CustomerText.Clear();
            EmployeeText.Clear();
            DateText.Clear();
            PriceText.Clear();
        }
 public IHttpActionResult Reply(EmployeeText employeeText)
 {
     if (ModelState.IsValid)
     {
         textrepo.Insert(employeeText);
         return(Created("http://localhost:51045//api/employeetexts/" + employeeText.TextId, textrepo.Link(employeeText)));
     }
     return(BadRequest(ModelState));
 }
Пример #4
0
        static void Main(string[] args)
        {
            //EmployeeText emp = new EmployeeText("AEG_ImportBTC1ImportEmployees.Designer.cs ", @"C:\Workspace\NET\FireflyFlavor\ABIMM_ARAPR\ABIMM_SR.AEG_Processes\TextIO\" , 289, "this.txtVScheduledEmployeeInput.Name = 'txtVScheduledEmployeeInput';");
            //string empName = emp.getName();
            //emp.addToHashTable(300, "test text");
            //Hashtable hash = emp.GetHashtable();
            //foreach (LineText pair in hash.Values)
            //{
            //    Console.WriteLine(pair.line);
            //}

            string textFile    = @"C:\Users\vsandhu\Desktop\employeeReport.txt";
            string desktopPath = @"C:\Users\vsandhu\Desktop\create.txt";

            string[] lines            = File.ReadAllLines(textFile);
            object[] allTheReferences = new object[lines.Length];
            if (File.Exists(textFile))
            {
                using (StreamWriter sw = File.CreateText(desktopPath))
                {
                    Console.WriteLine("new file created!");
                    int counter = 0;
                    foreach (string line in lines)
                    {
                        EmployeeText temp = new EmployeeText();
                        if (line[0] == 'C')
                        {
                        }
                        if (counter > 3)
                        {
                            sw.WriteLine(line.Split(' ')[0] + "       ------>      " + line.Split('?')[1]);
                            counter++;
                        }
                    }

                    counter = 0;
                    foreach (string line in lines)
                    {
                        if (counter > 3)
                        {
                            Console.WriteLine(line.Split('?')[1]);
                            break;
                        }
                        counter++;
                    }
                }
            }
            else
            {
                Console.WriteLine("File does not exist");
            }
        }
 public IHttpActionResult Create(EmployeeText employeeText)
 {
     if (ModelState.IsValid)
     {
         var checkperson = employeerepo.GetByUserName(employeeText.ReceiverUserName);
         if (checkperson != null)
         {
             textrepo.Insert(employeeText);
             return(Created("http://localhost:51045//api/employeetexts/" + employeeText.TextId, textrepo.Link(employeeText)));
         }
         return(BadRequest("Their is no employee with this username"));
     }
     return(BadRequest(ModelState));
 }
 public ActionResult Reply(string sun, EmployeeText employeeText)
 {
     if (CheckAccess())
     {
         if (ModelState.IsValid)
         {
             textrepo.Insert(employeeText);
             return(RedirectToAction("SendByMe"));
         }
         else
         {
             TempData["sun"]      = sun;
             TempData["TextBody"] = employeeText.TextBody;
             return(View(employeeText));
         }
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }