Esempio n. 1
0
 public DataSet GetRelGroupDept(int comp_id
                                , string rel_grp_id
                                , int dept_ref_id
                                , string est_id
                                , int estterm_ref_id)
 {
     return(_relGroupDept.Select(null
                                 , null
                                 , comp_id
                                 , rel_grp_id
                                 , dept_ref_id
                                 , est_id
                                 , estterm_ref_id));
 }
Esempio n. 2
0
        public bool CopyDataFromTo(int comp_id
                                   , int estterm_ref_id_from
                                   , int estterm_ref_id_to
                                   , DateTime create_date
                                   , int create_user)
        {
            int affectedRow = 0;

            Dac_KeyGens keyGen = new Dac_KeyGens();

            IDbConnection conn = DbAgentHelper.CreateDbConnection();

            conn.Open();
            IDbTransaction trx = conn.BeginTransaction();

            try
            {
                DataTable dtRelGrpInfo = _relGroupInfo.Select(conn, trx, comp_id, "", "", estterm_ref_id_from).Tables[0];

                foreach (DataRow drRelGrpInfo in dtRelGrpInfo.Rows)
                {
                    string rel_grp_id = keyGen.GetCode(conn, trx, "EST_REL_GROUP_INFO");

                    affectedRow += _relGroupInfo.Insert(conn
                                                        , trx
                                                        , comp_id
                                                        , rel_grp_id
                                                        , DataTypeUtility.GetValue(drRelGrpInfo["EST_ID"])
                                                        , estterm_ref_id_to
                                                        , DataTypeUtility.GetValue(drRelGrpInfo["REL_GRP_NAME"])
                                                        , DataTypeUtility.GetValue(drRelGrpInfo["REL_GRP_DESC"])
                                                        , create_date
                                                        , create_user);

                    DataTable dtRelGrpDept = _relGroupDept.Select(conn
                                                                  , trx
                                                                  , comp_id
                                                                  , DataTypeUtility.GetValue(drRelGrpInfo["REL_GRP_ID"])
                                                                  , 0
                                                                  , ""
                                                                  , estterm_ref_id_from).Tables[0];

                    foreach (DataRow drRelGrpDept in dtRelGrpDept.Rows)
                    {
                        affectedRow += _relGroupDept.Insert(conn
                                                            , trx
                                                            , comp_id
                                                            , rel_grp_id
                                                            , DataTypeUtility.GetToInt32(drRelGrpDept["DEPT_REF_ID"])
                                                            , DataTypeUtility.GetValue(drRelGrpDept["EST_ID"])
                                                            , estterm_ref_id_to
                                                            , create_date
                                                            , create_user);
                    }

                    DataTable dtRelGrpPosInfo = _relGroupPosInfo.Select(conn
                                                                        , trx
                                                                        , comp_id
                                                                        , ""
                                                                        , DataTypeUtility.GetValue(drRelGrpInfo["REL_GRP_ID"])
                                                                        , ""
                                                                        , estterm_ref_id_from).Tables[0];

                    foreach (DataRow drRelGrpPosInfo in dtRelGrpPosInfo.Rows)
                    {
                        string rel_grp_pos_id = keyGen.GetCode(conn, trx, "EST_REL_GROUP_POS_INFO");

                        affectedRow += _relGroupPosInfo.Insert(conn
                                                               , trx
                                                               , comp_id
                                                               , rel_grp_pos_id
                                                               , DataTypeUtility.GetValue(drRelGrpInfo["REL_GRP_ID"])
                                                               , DataTypeUtility.GetValue(drRelGrpPosInfo["EST_ID"])
                                                               , estterm_ref_id_to
                                                               , DataTypeUtility.GetValue(drRelGrpPosInfo["REL_GRP_POS_NAME"])
                                                               , DataTypeUtility.GetValue(drRelGrpPosInfo["REL_GRP_POS_DESC"])
                                                               , DataTypeUtility.GetValue(drRelGrpPosInfo["OPT_VALUE"])
                                                               , create_date
                                                               , create_user);

                        DataTable dtRelGrpPosData = _relGroupPosData.Select(conn
                                                                            , trx
                                                                            , comp_id
                                                                            , ""
                                                                            , DataTypeUtility.GetValue(drRelGrpInfo["REL_GRP_ID"])
                                                                            , DataTypeUtility.GetValue(drRelGrpPosInfo["REL_GRP_POS_ID"])
                                                                            , ""
                                                                            , estterm_ref_id_from).Tables[0];

                        foreach (DataRow drRelGrpPosData in dtRelGrpPosData.Rows)
                        {
                            string rel_grp_pos_data_id = keyGen.GetCode(conn, trx, "EST_REL_GROUP_POS_DATA");

                            affectedRow += _relGroupPosData.Insert(conn
                                                                   , trx
                                                                   , comp_id
                                                                   , rel_grp_pos_data_id
                                                                   , DataTypeUtility.GetValue(drRelGrpInfo["REL_GRP_ID"])
                                                                   , DataTypeUtility.GetValue(drRelGrpPosData["REL_GRP_POS_ID"])
                                                                   , DataTypeUtility.GetValue(drRelGrpPosData["EST_ID"])
                                                                   , estterm_ref_id_to
                                                                   , DataTypeUtility.GetValue(drRelGrpPosData["POS_ID"])
                                                                   , DataTypeUtility.GetValue(drRelGrpPosData["POS_ID_NAME"])
                                                                   , DataTypeUtility.GetValue(drRelGrpPosData["POS_VALUE"])
                                                                   , DataTypeUtility.GetValue(drRelGrpPosData["POS_VALUE_NAME"])
                                                                   , DataTypeUtility.GetValue(drRelGrpPosData["OPT_VALUE"])
                                                                   , create_date
                                                                   , create_user);
                        }
                    }
                }

                trx.Commit();
            }
            catch (Exception ex)
            {
                trx.Rollback();
                return(false);
            }
            finally
            {
                conn.Close();
            }

            return((affectedRow > 0) ? true : false);
        }