示例#1
0
        public async Task <ActionResult <empInfo> > PostempInfo(empInfo empInfo)
        {
            _context.empTable.Add(empInfo);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetempInfo", new { id = empInfo.empId }, empInfo));
        }
示例#2
0
        public async Task <IActionResult> PutempInfo(int id, empInfo empInfo)
        {
            if (id != empInfo.empId)
            {
                return(BadRequest());
            }

            _context.Entry(empInfo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!empInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#3
0
        public ActionResult DeleteConfirmed(int id)
        {
            empInfo empInfo = db.empObject.Find(id);

            db.empObject.Remove(empInfo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#4
0
 public ActionResult Edit([Bind(Include = "empno,empname,projname,skills,alloc,exper,rmap")] empInfo empInfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(empInfo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(empInfo));
 }
示例#5
0
        public ActionResult Create([Bind(Include = "empno,empname,projname,skills,alloc,exper,rmap")] empInfo empInfo)
        {
            if (!ModelState.IsValid)
            {
                db.empObject.Add(empInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(empInfo));
        }
示例#6
0
        // GET: Detail/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            empInfo empInfo = db.empObject.Find(id);

            if (empInfo == null)
            {
                return(HttpNotFound());
            }
            return(View(empInfo));
        }
        private void agregarItem(empInfo empInfo)
        {
            try
            {
                ListViewItem list = listViewDeviceUsers.Items.Add(empInfo.Badge);
                list.UseItemStyleForSubItems = false;
                //list.SubItems.Add(s.Split(',')[0]);
                list.SubItems.Add(empInfo.Name);
                list.SubItems.Add(empInfo.Lastname);

                //n.Font = fontListView;
                //listViewDeviceUsers.Items.Add(n);
            }
            catch (Exception ex)
            {
                Tools.GetInstance().DoLog("Excepcion en agregarItem. Ex: " + ex.ToString());
            }
        }
        //end run report
        /// <summary>
        /// 3 reports and 1 data update
        /// </summary>
        /// <returns></returns>
        protected string process_discrepancy_reports(string sdate1, string sdate2)
        {
            //list of returned tmp files
            DataSet _ds  = new DataSet("all_reports");
            string  _xml = "";

            IList <empInfo> _ids = get_user_ids();
            IList <string>  _tmp = new List <string>(new string[] { "Orders_With_No_Delivery_Details", "Orders_Without_Customer_Contact",
                                                                    "Discrepancies_Report_Pre_Shipment", "Discrepancies_Report_Post_Shipment",
                                                                    "Check_Delivery_Status", "Usborne_ExWorks_Date_Overdue_Report" });


            //for each user (probably most of these users will not have any reports to send
            //process reports and get tmp filename for each
            for (int _ix = 0; _ix < _tmp.Count; _ix++)
            {
                //check to see if this report is scheduled

                if (in_schedule(_tmp[_ix]))
                {
                    DataTable _dt = process_report(_tmp[_ix], sdate1.ToString(), sdate2.ToString()); //append report results to report name
                    //141112 include all data tables so user knows if 0 rcords found
                    if (_dt != null)
                    //if (_dt != null && _dt.Rows.Count > 0)
                    {
                        _dt.TableName = _tmp[_ix]; //must have table names or can't parse to xml
                        _ds.Tables.Add(_dt);
                    }
                }
            }

            if (_ds.Tables.Count > 0)
            {
                //now step through users and filter data by user id
                for (int _ix = 0; _ix < _ids.Count; _ix++)
                {
                    empInfo _user = _ids[_ix];

                    IList <Attachment> _csvs       = new List <Attachment>();
                    string             _mailto     = _user.EmailAddress;
                    string             _controller = _user.Name;
                    string             _html       = "";

                    //step through all query datatables and filter by current user
                    for (int _dx = 0; _dx < _ds.Tables.Count; _dx++)
                    {
                        int _records = 0; //reset for each table for this user

                        if (_ds.Tables[_dx].Rows.Count > 0)
                        {
                            DataRow[] _set = _ds.Tables[_dx].Select("hfControllerID = " + _user.EmployeeID);

                            //copy table def without rows
                            DataTable _du = _ds.Tables[_dx].Clone();
                            //drop filtered rows into sub dataset
                            foreach (DataRow _dr in _set)
                            {
                                _du.ImportRow(_dr);
                            }

                            //create email attachment if has rows
                            if (_du.Rows.Count > 0)
                            {
                                // Stream the Excel spreadsheet to the client in a format
                                // compatible with Excel 97/2000/XP/2003/2007/2010.
                                System.IO.MemoryStream _stream = new System.IO.MemoryStream(ASCIIEncoding.Default.GetBytes(return_formatted_csv(_du)));
                                Attachment             _a      = new Attachment(_stream, _tmp[_dx] + ".csv");
                                _csvs.Add(_a);
                                _records = _du.Rows.Count;
                            }
                        }
                        //look for a descriptive note
                        string _note = "<em>" + wwi_func.get_from_global_resx(_tmp[_dx] + "_Note") + "</em>";
                        //build summary of results for each query name include report name even if no records found and thereefore no csv for that report
                        _html += "<li>" + _tmp[_dx].Replace("_", " ") + ": " + _records.ToString() + " records<br/>" + _note + "</li>";
                        //
                    }//end loop through datatables

                    //append list tags
                    _html = "<ul>" + _html + "</ul>";

                    //send mail if we have attachments
                    if (_csvs.Count > 0)
                    {
                        string[] _to = { _mailto, "*****@*****.**" };
                        //string[] _to = { "*****@*****.**" };
                        //email
                        send_spreadsheet(_to, "Discrepancy reports " + DateTime.Now.ToShortDateString() + " for " + _controller, _html, _controller, _csvs);
                    }
                } //end loop through users
            }     //end if table.count

            //output xml
            _xml = serialize_list(_tmp);
            return(_xml);
        }