Exemplo n.º 1
0
 private void DeleteDtl()
 {
     try
     {
         RmsOA.BFL.GK_OA_SubmitAccountDtlBFL bfl  = new RmsOA.BFL.GK_OA_SubmitAccountDtlBFL();
         List <GK_OA_SubmitAccountDtlModel>  Objs = bfl.GetGK_OA_SubmitAccountDtlList(RmsPM.BLL.ConvertRule.ToString(this.ViewState["Code"]));
         foreach (GK_OA_SubmitAccountDtlModel mObj in Objs)
         {
             bfl.Delete(mObj);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// 保存明细
    /// </summary>

    private void UpdateDtl()
    {
        List <GK_OA_SubmitAccountDtlModel> mObjs = GetScreenDtl();

        try
        {
            RmsOA.BFL.GK_OA_SubmitAccountDtlBFL bfl = new RmsOA.BFL.GK_OA_SubmitAccountDtlBFL();
            Hashtable tbInDtl = new Hashtable();

            //删除
            List <GK_OA_SubmitAccountDtlModel> oldObjs = bfl.GetGK_OA_SubmitAccountDtlList(Convert.ToString(this.ViewState["Code"]));
            foreach (GK_OA_SubmitAccountDtlModel mObj in oldObjs)
            {
                if (!tbInDtl.Contains(mObj.Code))
                {
                    tbInDtl.Add(mObj.Code, mObj.Code);
                }

                if (FindModel(mObjs, mObj.Code.ToString()) == null)
                {
                    bfl.Delete(mObj);
                }
            }

            foreach (GK_OA_SubmitAccountDtlModel mObj in mObjs)
            {
                if (!tbInDtl.Contains(mObj.Code))
                {
                    tbInDtl.Add(mObj.Code, mObj.Code);
                }

                if (mObj.Code <= 0)  //新增
                {
                    mObj.MastCode = Convert.ToString(this.ViewState["Code"]);
                    bfl.Insert(mObj);
                }
                else  //修改
                {
                    bfl.Update(mObj);
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }