Пример #1
0
        public bool sendReport()
        {
            //MessageBox.Show("send request");
            _communication.Connect();


            _report = new Report(_view.getRecipientID(), _view.getRecipient(), _view.getTDescription(),
                                 _view.getTitle());
            Attachments attach;

            if (!String.IsNullOrEmpty(_view.getAttachments()))
            {
                attach = new Attachments();
                attach.FileLocation = _view.getAttachments();
                attach.uploadTime   = DateTime.Now;
            }
            else
            {
                attach = null;
            }

            ReportCategory repCat = new ReportCategory();

            repCat.Title = _view.getCategoryTitle();

            saveNewReport(_report, repCat, attach);

            Request reportRequest = new Request(RequestType.New_Report, new object[] { _report, repCat, attach });

            _communication.SendRequest(reportRequest);
            if (attach != null)
            {
                this.uploadFile();
            }

            _communication.Disconnect();

            return(true);
        }
Пример #2
0
        private void sendReport_b_Click(object sender, RoutedEventArgs e)
        {
            //////////////////////////////////////////////////////////
            //code by farzin
            //fill comboboxes

            clientContainer clientDb = new clientContainer();

            Report         re    = clientDb.Reports.Create();
            ReportCategory rc    = clientDb.ReportCategories.Create();
            Attachments    atach = clientDb.Attachments.Create();

            re.Attachment     = atach;
            re.Description    = "یییییییی";
            re.isMark         = true;
            re.isRead         = true;
            re.Recipient      = "ss";
            re.Recipient_ID   = 222;
            re.ReportCategory = rc;
            re.SendDate       = DateTime.Now;
            re.Sender         = "Ali";
            re.Sender_ID      = 23323;
            re.Title          = "hhhd";

            rc.Title = "تولید";
            rc.Reports.Add(re);

            atach.FileLocation = "fads";
            atach.Report       = re;
            atach.uploadTime   = DateTime.Now;

            clientDb.ReportCategories.Add(rc);

            try
            {
                clientDb.SaveChanges();
            }
            catch
            {
                Console.WriteLine("Not Addedddddddddddddddddd");
            }

            User usr  = clientDb.Users.Create();
            User usr1 = clientDb.Users.Create();

            usr.Address        = "لنگرود"; usr1.Address = "همدان";
            usr.Age            = 20; usr1.Age = 20;
            usr.AvatarLocation = "ABC"; usr1.AvatarLocation = "ABC";
            usr.Email          = "e@yahoo"; usr1.Email = "e@yahoo";
            usr.EmploymentDate = DateTime.Now; usr1.EmploymentDate = DateTime.Now;
            usr.FirstName      = "احسان"; usr1.FirstName = "فرزین";
            usr.Gender         = true; usr1.Gender = true;
            usr.LastName       = "گلشنی"; usr1.LastName = "امینی";
            usr.NationalId     = 32433; usr1.NationalId = 32433;
            usr.Password       = "******"; usr1.Password = "******";
            usr.PhoneNumber    = "000122312"; usr1.PhoneNumber = "000122312";
            usr.Resume         = "بیکار"; usr1.Resume = "رئیس";
            usr.RoleId         = 23433; usr1.RoleId = 234232;
            usr.RoleName       = "للل"; usr1.RoleName = "سیسشب";
            //usr.UserId = usr1.Id; usr1.UserId = usr.Id;
            usr.Username    = "******"; usr1.Username = "******";
            usr.DefaultUser = false; usr1.DefaultUser = false;
            usr.IsNew       = false; usr1.IsNew = false;

            clientDb.Users.Add(usr);
            clientDb.Users.Add(usr1);

            try
            {
                clientDb.SaveChanges();
            }
            catch
            {
                Console.WriteLine("Not Addedddddddddddddddddd");
            }

            //////////////////////////////////////////////////


            this.controller.sReportC.showView();
        }
 public bool saveNewReport(Report r, ReportCategory rC, Attachments a)
 {
     return(_db.newReport(r, rC, a));
 }
Пример #4
0
 private string NewReport(Report report, ReportCategory category, Attachments attachment)
 {
     //_dbCenter.NewReport(report, category, attachment);
     return(_response);
 }