Beispiel #1
0
 /// <summary>
 /// 修改企业安全文件上报明细信息
 /// </summary>
 /// <param name="subUnitReportItem"></param>
 public static void UpdateSubUnitReportItem(Model.Supervise_SubUnitReportItem subUnitReportItem)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Supervise_SubUnitReportItem newSubUnitReportItem = db.Supervise_SubUnitReportItem.FirstOrDefault(e => e.SubUnitReportItemId == subUnitReportItem.SubUnitReportItemId);
     if (newSubUnitReportItem != null)
     {
         newSubUnitReportItem.ReportTitle   = subUnitReportItem.ReportTitle;
         newSubUnitReportItem.ReportContent = subUnitReportItem.ReportContent;
         newSubUnitReportItem.AttachUrl     = subUnitReportItem.AttachUrl;
         newSubUnitReportItem.ReportDate    = subUnitReportItem.ReportDate;
         newSubUnitReportItem.State         = subUnitReportItem.State;
         newSubUnitReportItem.UpState       = subUnitReportItem.UpState;
         db.SubmitChanges();
     }
 }
        /// <summary>
        /// 企业安全文件上报明细从集团公司提取
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void poxy_GetSupervise_SubUnitReportItemListToSUBCompleted(object sender, HSSEService.GetSupervise_SubUnitReportItemListToSUBCompletedEventArgs e)
        {
            int count = 0;

            if (e.Error == null && e.Result != null)
            {
                var items = e.Result;
                if (items.Count() > 0)
                {
                    count = items.Count();
                    foreach (var item in items)
                    {
                        var newItem = BLL.SubUnitReportItemService.GetSubUnitReportItemById(item.SubUnitReportItemId);
                        if (newItem == null)
                        {
                            var newSubUnitReport = BLL.SubUnitReportService.GetSubUnitReportById(item.SubUnitReportId);
                            if (newSubUnitReport != null)
                            {
                                Model.Supervise_SubUnitReportItem newItem1 = new Model.Supervise_SubUnitReportItem
                                {
                                    SubUnitReportItemId = item.SubUnitReportItemId,
                                    SubUnitReportId     = item.SubUnitReportId,
                                    UnitId        = item.UnitId,
                                    PlanReortDate = item.PlanReortDate,
                                    State         = item.State
                                };
                                Funs.DB.Supervise_SubUnitReportItem.InsertOnSubmit(newItem1);
                                Funs.DB.SubmitChanges();
                            }
                        }
                        else
                        {
                            newItem.SubUnitReportId = item.SubUnitReportId;
                            newItem.UnitId          = item.UnitId;
                            newItem.PlanReortDate   = item.PlanReortDate;
                            newItem.State           = item.State;

                            Funs.DB.SubmitChanges();
                        }
                    }
                }
            }
        }