public TY_OA_MgrTaskModel GetModel(int Code, SqlConnection Connection) { TY_OA_MgrTaskDAL kdal = new TY_OA_MgrTaskDAL(Connection); return(kdal.GetModel(Code)); }
public TY_OA_MgrTaskModel GetModel(int Code, SqlTransaction Transaction) { TY_OA_MgrTaskDAL kdal = new TY_OA_MgrTaskDAL(Transaction); return(kdal.GetModel(Code)); }
public int UpdateTY_OA_MgrTaskDtlList(SqlTransaction Transaction, List <TY_OA_MgrTaskDtlModel> mObjs, int MgrCodeID) { try { TY_OA_MgrTaskDAL kdal; TY_OA_MgrTaskModel mObj; TY_OA_MgrTaskDtlDAL ldal = new TY_OA_MgrTaskDtlDAL(Transaction); bool flag = false; bool flag2 = false; List <TY_OA_MgrTaskDtlModel> list = ldal.GetTY_OA_MgrTaskDtlListByMgrCodeID(MgrCodeID); foreach (TY_OA_MgrTaskDtlModel model in list) { if (FindModel(mObjs, model.MgrDtlCode.ToString()) == null) { flag2 = true; ldal.Delete(model.MgrDtlCode); } } foreach (TY_OA_MgrTaskDtlModel model in mObjs) { if (model.MgrDtlCode <= 0) { model.MgrDtlCode = int.Parse(SystemManageDAO.GetNewSysCode("MgrDtlCode")); flag = true; model.MgrCodeID = MgrCodeID; ldal.Insert(model); } else { ldal.Update(model); } } if (flag2) { bool flag3 = true; List <TY_OA_MgrTaskDtlModel> list2 = ldal.GetTY_OA_MgrTaskDtlListByMgrCodeID(MgrCodeID); foreach (TY_OA_MgrTaskDtlModel model in list2) { if (model.State != "3") { flag3 = false; break; } } if (flag3) { kdal = new TY_OA_MgrTaskDAL(Transaction); mObj = kdal.GetModel(MgrCodeID); mObj.State = "3"; kdal.Update(mObj); } } if (flag) { kdal = new TY_OA_MgrTaskDAL(Transaction); mObj = kdal.GetModel(MgrCodeID); mObj.State = "1"; kdal.Update(mObj); } } catch (Exception exception) { throw exception; } return(1); }