コード例 #1
0
        public List<TypeAssignmentCostCode> TargetListAssignmentComponentProgress(string offset, string max, List<string> s_option, List<string> s_key, string o_option, string o_desc)
        {
            List<TypeAssignmentCostCode> result = new List<TypeAssignmentCostCode>();

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            // Compose parameters
            List<SqlParameter> parameters = new List<SqlParameter>();

            for (int i = 0; i < s_option.Count; i++)
            {
                parameters.Add(new SqlParameter(s_option[i], s_key[i]));
            }

            parameters.Add(new SqlParameter("@MaxNumRows", 10000));
            parameters.Add(new SqlParameter("@RetrieveOffset",  int.Parse("0")));

            parameters.Add(new SqlParameter("@SortColumn", o_option));
            parameters.Add(new SqlParameter("@SortOrder", (o_desc != null ? o_desc.ToUpper() : null)));

            // Get Data
            DataSet ds = SqlHelper.ExecuteDataset(connStr, "usp_ListComponentProgress", parameters.ToArray());

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                TypeAssignmentCostCode obj = new TypeAssignmentCostCode();
                obj.ComponentProgressId = Convert.ToInt32(ds.Tables[0].Rows[i]["ComponentProgressId"]);
                result.Add(obj);
            }
            // return
            return result;
        }
コード例 #2
0
        public SigmaResultType UpdateAssignmentComponentProgress(TypeAssignmentCostCode objAssignmentcostcode)
        {
            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            // Compose parameters
            SqlParameter[] parameters = new SqlParameter[] {
                    new SqlParameter("@CostCodeId", objAssignmentcostcode.CostCodeId),
                    new SqlParameter("@ComponentProgressId", objAssignmentcostcode.ComponentProgressId)
                };

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, "usp_UpdateComponentProgressForAssignCostCode", parameters);
                result.IsSuccessful = true;
                scope.Complete();

            }

            return result;
        }