Ejemplo n.º 1
0
 /// <summary>
 /// 加载集抄箱里的所有户表实体
 /// </summary>
 private void LoadSHBS()
 {
     try
     {
         shbs.Clear();//清除之前的数据
         var t = DBManager.Instance.GetEntity <Detailreference_n>(o => o.G3E_FID == g3e_fid);
         if (t == null)
         {
             return;
         }
         var ents = DBEntityFinder.Instance.GetDYSHB_PT(t.G3E_DETAILID);
         if (ents != null)
         {
             foreach (long tmp in ents)
             {
                 var ent = SHBDeleteManager.GetDYSHB_N(tmp);
                 if (ent != null)
                 {
                     if (ent.EntityState != EntityState.Delete)
                     {
                         shbs.Add(new Pair(ent));
                     }
                 }
             }
             shbs.Sort();
         }
     }
     catch (Exception ex)
     {
         PublicMethod.Instance.ShowMessage(String.Format("加载数据过程中出现错误:{0}", ex.Message));
     }
 }
Ejemplo n.º 2
0
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("确定要删除?", "确定?", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
     {
         return;
     }
     try
     {
         int count = listView1.SelectedItems.Count;
         for (int i = 0; i < count; i++)
         {
             long fid = long.Parse(listView1.SelectedItems[i].Name);
             //删除户表数据本身
             SHBDeleteManager.DeleteItem(fid, new List <DBEntity>());
         }
     }
     catch (Exception ex)
     {
         PublicMethod.Instance.ShowMessage(String.Format("删除过程中出现错误:{0}", ex.Message));
     }
     finally
     {
         LoadSHBS();
         PageingSHB(curPageNum);
         Pageing(curPageNum);
     }
 }
Ejemplo n.º 3
0
        private void DelSHBItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show(@"确定要删除?", @"确定?", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                {
                    return;
                }
                try
                {
                    // 获取被删除计量表的FID
                    var tfid   = (long)contextMenuStrip2.Tag;
                    var isLock = DBEntityFinder.Instance.VerifyLTTID(detail_fid);
                    if (!isLock)
                    {
                        PublicMethod.Instance.AlertDialog("该设备没有被工单锁定,不能删除!");
                        return;
                    }

                    //var temshb =
                    //    DBManager.Instance.GetEntities<Gg_jx_shbd_pt>(
                    //        o => o.G3E_FID == tfid && o.EntityState != EntityState.Delete).FirstOrDefault();
                    //if (temshb != null && (temshb.LTT_ID != null && (DBEntityFinder.Instance.VerifyLTTID((decimal)temshb.LTT_ID) == false)))
                    //{
                    //    PublicMethod.Instance.AlertDialog("该设备没有被工单锁定,不能删除!");
                    //    return;
                    //}
                    SHBDeleteManager.DeleteSGB(tfid, new List <DBEntity>());
                    //删除一个户表控件,刷新界面
                    var t1 = Controls;
                    foreach (var t2 in Controls)
                    {
                        var t3 = t2 as Dyhb;
                        if (t3 != null && t3.DyhbFid == tfid)
                        {
                            pbs.Remove(t3);
                            Controls.Remove(t3);
                        }
                    }
                }
                catch (Exception ex)
                {
                    PublicMethod.Instance.AlertDialog(String.Format("删除过程中出现错误:{0}", ex.Message));
                }
            }
            catch (Exception ex)
            {
                PublicMethod.Instance.AlertDialog(ex.Message);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 批量删除
 /// </summary>
 /// <param name="fid"></param>
 /// <param name="backupDBEntity"> </param>
 /// <returns></returns>
 public static List <DBEntity> BatchDeleteFromSHB(long fid, List <DBEntity> backupDBEntity)
 {
     try
     {
         //获取所有计量表
         var t = DBManager.Instance.GetEntity <Detailreference_n>(fid);
         if (t != null)
         {
             var ents = GetSHB_PT(t.G3E_DETAILID);
             if (ents != null)
             {
                 foreach (long tmp in ents)
                 {
                     backupDBEntity = SHBDeleteManager.DeleteSGB(tmp, backupDBEntity);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.Instance.Error(ex);
     }
     return(backupDBEntity);
 }